UNPKG

1.23 MBJavaScriptView Raw
1(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.bkmrkd = 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(require,module,exports){
2module.exports={
3 "development": {
4 "port": 3000,
5 "rethinkdbHost": "localhost",
6 "rethinkdbPort": 28015,
7 "rethinkdbName": "bkmrkd_development",
8 "snippetHost": "https://localhost:3000",
9 "cert": "./ssl/server.crt",
10 "certKey": "./ssl/server.key",
11 "publicKeyPins": ["TROyeItK/2uzqYisNiSlkJshWmxQqMH+M9OJD4N+JEM=", "TROyeItK/2uzqYisNiSlkJshWmxQqMH+M9OJD4N+JEM="]
12 },
13 "stage": {
14 "port": 3000,
15 "rethinkdbHost": "localhost",
16 "rethinkdbPort": 28015,
17 "rethinkdbName": "bkmrkd_stage",
18 "snippetHost": "https://bkmrkd.com",
19 "cert": "./ssl/server.crt",
20 "certKey": "./ssl/server.key",
21 "publicKeyPins": ["TROyeItK/2uzqYisNiSlkJshWmxQqMH+M9OJD4N+JEM=", "TROyeItK/2uzqYisNiSlkJshWmxQqMH+M9OJD4N+JEM="]
22 },
23 "production": {
24 "port": 3000,
25 "rethinkdbHost": "localhost",
26 "rethinkdbPort": 28015,
27 "rethinkdbName": "bkmrkd_production",
28 "snippetHost": "https://bkmrkd.com",
29 "cert": "./ssl/server.crt",
30 "certKey": "./ssl/server.key",
31 "publicKeyPins": ["TROyeItK/2uzqYisNiSlkJshWmxQqMH+M9OJD4N+JEM=", "TROyeItK/2uzqYisNiSlkJshWmxQqMH+M9OJD4N+JEM="]
32 }
33}
34
35},{}],2:[function(require,module,exports){
36(function (process){
37'use strict';
38
39Object.defineProperty(exports, "__esModule", {
40 value: true
41});
42exports.args = undefined;
43
44var _fs = require(8);
45
46var _fs2 = _interopRequireDefault(_fs);
47
48var _path = require(90);
49
50var _path2 = _interopRequireDefault(_path);
51
52var _subarg = require(332);
53
54var _subarg2 = _interopRequireDefault(_subarg);
55
56var _environments = require(1);
57
58var _environments2 = _interopRequireDefault(_environments);
59
60function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
61
62var args = exports.args = (0, _subarg2.default)(process.argv.slice(2));
63
64function readConfig() {
65 return JSON.parse(_fs2.default.readFileSync(_path2.default.resolve(process.cwd(), args.c || args.config || process.env.BKMRKD_CONFIG_PATH), {
66 encoding: 'utf8'
67 }));
68}
69
70exports.default = args.c || args.config || process.env.BKMRKD_CONFIG_PATH ? readConfig() : _environments2.default;
71
72}).call(this,require(91))
73},{"1":1,"332":332,"8":8,"90":90,"91":91}],3:[function(require,module,exports){
74module.exports = after
75
76function after(count, callback, err_cb) {
77 var bail = false
78 err_cb = err_cb || noop
79 proxy.count = count
80
81 return (count === 0) ? callback() : proxy
82
83 function proxy(err, result) {
84 if (proxy.count <= 0) {
85 throw new Error('after called too many times')
86 }
87 --proxy.count
88
89 // after first error, rest are passed to err_cb
90 if (err) {
91 bail = true
92 callback(err)
93 // future error callbacks will go to error handler
94 callback = err_cb
95 } else if (proxy.count === 0 && !bail) {
96 callback(null, result)
97 }
98 }
99}
100
101function noop() {}
102
103},{}],4:[function(require,module,exports){
104/**
105 * An abstraction for slicing an arraybuffer even when
106 * ArrayBuffer.prototype.slice is not supported
107 *
108 * @api public
109 */
110
111module.exports = function(arraybuffer, start, end) {
112 var bytes = arraybuffer.byteLength;
113 start = start || 0;
114 end = end || bytes;
115
116 if (arraybuffer.slice) { return arraybuffer.slice(start, end); }
117
118 if (start < 0) { start += bytes; }
119 if (end < 0) { end += bytes; }
120 if (end > bytes) { end = bytes; }
121
122 if (start >= bytes || start >= end || bytes === 0) {
123 return new ArrayBuffer(0);
124 }
125
126 var abv = new Uint8Array(arraybuffer);
127 var result = new Uint8Array(end - start);
128 for (var i = start, ii = 0; i < end; i++, ii++) {
129 result[ii] = abv[i];
130 }
131 return result.buffer;
132};
133
134},{}],5:[function(require,module,exports){
135
136/**
137 * Expose `Backoff`.
138 */
139
140module.exports = Backoff;
141
142/**
143 * Initialize backoff timer with `opts`.
144 *
145 * - `min` initial timeout in milliseconds [100]
146 * - `max` max timeout [10000]
147 * - `jitter` [0]
148 * - `factor` [2]
149 *
150 * @param {Object} opts
151 * @api public
152 */
153
154function Backoff(opts) {
155 opts = opts || {};
156 this.ms = opts.min || 100;
157 this.max = opts.max || 10000;
158 this.factor = opts.factor || 2;
159 this.jitter = opts.jitter > 0 && opts.jitter <= 1 ? opts.jitter : 0;
160 this.attempts = 0;
161}
162
163/**
164 * Return the backoff duration.
165 *
166 * @return {Number}
167 * @api public
168 */
169
170Backoff.prototype.duration = function(){
171 var ms = this.ms * Math.pow(this.factor, this.attempts++);
172 if (this.jitter) {
173 var rand = Math.random();
174 var deviation = Math.floor(rand * this.jitter * ms);
175 ms = (Math.floor(rand * 10) & 1) == 0 ? ms - deviation : ms + deviation;
176 }
177 return Math.min(ms, this.max) | 0;
178};
179
180/**
181 * Reset the number of attempts.
182 *
183 * @api public
184 */
185
186Backoff.prototype.reset = function(){
187 this.attempts = 0;
188};
189
190/**
191 * Set the minimum duration
192 *
193 * @api public
194 */
195
196Backoff.prototype.setMin = function(min){
197 this.ms = min;
198};
199
200/**
201 * Set the maximum duration
202 *
203 * @api public
204 */
205
206Backoff.prototype.setMax = function(max){
207 this.max = max;
208};
209
210/**
211 * Set the jitter
212 *
213 * @api public
214 */
215
216Backoff.prototype.setJitter = function(jitter){
217 this.jitter = jitter;
218};
219
220
221},{}],6:[function(require,module,exports){
222/*
223 * base64-arraybuffer
224 * https://github.com/niklasvh/base64-arraybuffer
225 *
226 * Copyright (c) 2012 Niklas von Hertzen
227 * Licensed under the MIT license.
228 */
229(function(chars){
230 "use strict";
231
232 exports.encode = function(arraybuffer) {
233 var bytes = new Uint8Array(arraybuffer),
234 i, len = bytes.length, base64 = "";
235
236 for (i = 0; i < len; i+=3) {
237 base64 += chars[bytes[i] >> 2];
238 base64 += chars[((bytes[i] & 3) << 4) | (bytes[i + 1] >> 4)];
239 base64 += chars[((bytes[i + 1] & 15) << 2) | (bytes[i + 2] >> 6)];
240 base64 += chars[bytes[i + 2] & 63];
241 }
242
243 if ((len % 3) === 2) {
244 base64 = base64.substring(0, base64.length - 1) + "=";
245 } else if (len % 3 === 1) {
246 base64 = base64.substring(0, base64.length - 2) + "==";
247 }
248
249 return base64;
250 };
251
252 exports.decode = function(base64) {
253 var bufferLength = base64.length * 0.75,
254 len = base64.length, i, p = 0,
255 encoded1, encoded2, encoded3, encoded4;
256
257 if (base64[base64.length - 1] === "=") {
258 bufferLength--;
259 if (base64[base64.length - 2] === "=") {
260 bufferLength--;
261 }
262 }
263
264 var arraybuffer = new ArrayBuffer(bufferLength),
265 bytes = new Uint8Array(arraybuffer);
266
267 for (i = 0; i < len; i+=4) {
268 encoded1 = chars.indexOf(base64[i]);
269 encoded2 = chars.indexOf(base64[i+1]);
270 encoded3 = chars.indexOf(base64[i+2]);
271 encoded4 = chars.indexOf(base64[i+3]);
272
273 bytes[p++] = (encoded1 << 2) | (encoded2 >> 4);
274 bytes[p++] = ((encoded2 & 15) << 4) | (encoded3 >> 2);
275 bytes[p++] = ((encoded3 & 3) << 6) | (encoded4 & 63);
276 }
277
278 return arraybuffer;
279 };
280})("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/");
281
282},{}],7:[function(require,module,exports){
283(function (global){
284/**
285 * Create a blob builder even when vendor prefixes exist
286 */
287
288var BlobBuilder = global.BlobBuilder
289 || global.WebKitBlobBuilder
290 || global.MSBlobBuilder
291 || global.MozBlobBuilder;
292
293/**
294 * Check if Blob constructor is supported
295 */
296
297var blobSupported = (function() {
298 try {
299 var a = new Blob(['hi']);
300 return a.size === 2;
301 } catch(e) {
302 return false;
303 }
304})();
305
306/**
307 * Check if Blob constructor supports ArrayBufferViews
308 * Fails in Safari 6, so we need to map to ArrayBuffers there.
309 */
310
311var blobSupportsArrayBufferView = blobSupported && (function() {
312 try {
313 var b = new Blob([new Uint8Array([1,2])]);
314 return b.size === 2;
315 } catch(e) {
316 return false;
317 }
318})();
319
320/**
321 * Check if BlobBuilder is supported
322 */
323
324var blobBuilderSupported = BlobBuilder
325 && BlobBuilder.prototype.append
326 && BlobBuilder.prototype.getBlob;
327
328/**
329 * Helper function that maps ArrayBufferViews to ArrayBuffers
330 * Used by BlobBuilder constructor and old browsers that didn't
331 * support it in the Blob constructor.
332 */
333
334function mapArrayBufferViews(ary) {
335 for (var i = 0; i < ary.length; i++) {
336 var chunk = ary[i];
337 if (chunk.buffer instanceof ArrayBuffer) {
338 var buf = chunk.buffer;
339
340 // if this is a subarray, make a copy so we only
341 // include the subarray region from the underlying buffer
342 if (chunk.byteLength !== buf.byteLength) {
343 var copy = new Uint8Array(chunk.byteLength);
344 copy.set(new Uint8Array(buf, chunk.byteOffset, chunk.byteLength));
345 buf = copy.buffer;
346 }
347
348 ary[i] = buf;
349 }
350 }
351}
352
353function BlobBuilderConstructor(ary, options) {
354 options = options || {};
355
356 var bb = new BlobBuilder();
357 mapArrayBufferViews(ary);
358
359 for (var i = 0; i < ary.length; i++) {
360 bb.append(ary[i]);
361 }
362
363 return (options.type) ? bb.getBlob(options.type) : bb.getBlob();
364};
365
366function BlobConstructor(ary, options) {
367 mapArrayBufferViews(ary);
368 return new Blob(ary, options || {});
369};
370
371module.exports = (function() {
372 if (blobSupported) {
373 return blobSupportsArrayBufferView ? global.Blob : BlobConstructor;
374 } else if (blobBuilderSupported) {
375 return BlobBuilderConstructor;
376 } else {
377 return undefined;
378 }
379})();
380
381}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
382},{}],8:[function(require,module,exports){
383
384},{}],9:[function(require,module,exports){
385/**
386 * Slice reference.
387 */
388
389var slice = [].slice;
390
391/**
392 * Bind `obj` to `fn`.
393 *
394 * @param {Object} obj
395 * @param {Function|String} fn or string
396 * @return {Function}
397 * @api public
398 */
399
400module.exports = function(obj, fn){
401 if ('string' == typeof fn) fn = obj[fn];
402 if ('function' != typeof fn) throw new Error('bind() requires a function');
403 var args = slice.call(arguments, 2);
404 return function(){
405 return fn.apply(obj, args.concat(slice.call(arguments)));
406 }
407};
408
409},{}],10:[function(require,module,exports){
410
411/**
412 * Expose `Emitter`.
413 */
414
415module.exports = Emitter;
416
417/**
418 * Initialize a new `Emitter`.
419 *
420 * @api public
421 */
422
423function Emitter(obj) {
424 if (obj) return mixin(obj);
425};
426
427/**
428 * Mixin the emitter properties.
429 *
430 * @param {Object} obj
431 * @return {Object}
432 * @api private
433 */
434
435function mixin(obj) {
436 for (var key in Emitter.prototype) {
437 obj[key] = Emitter.prototype[key];
438 }
439 return obj;
440}
441
442/**
443 * Listen on the given `event` with `fn`.
444 *
445 * @param {String} event
446 * @param {Function} fn
447 * @return {Emitter}
448 * @api public
449 */
450
451Emitter.prototype.on =
452Emitter.prototype.addEventListener = function(event, fn){
453 this._callbacks = this._callbacks || {};
454 (this._callbacks[event] = this._callbacks[event] || [])
455 .push(fn);
456 return this;
457};
458
459/**
460 * Adds an `event` listener that will be invoked a single
461 * time then automatically removed.
462 *
463 * @param {String} event
464 * @param {Function} fn
465 * @return {Emitter}
466 * @api public
467 */
468
469Emitter.prototype.once = function(event, fn){
470 var self = this;
471 this._callbacks = this._callbacks || {};
472
473 function on() {
474 self.off(event, on);
475 fn.apply(this, arguments);
476 }
477
478 on.fn = fn;
479 this.on(event, on);
480 return this;
481};
482
483/**
484 * Remove the given callback for `event` or all
485 * registered callbacks.
486 *
487 * @param {String} event
488 * @param {Function} fn
489 * @return {Emitter}
490 * @api public
491 */
492
493Emitter.prototype.off =
494Emitter.prototype.removeListener =
495Emitter.prototype.removeAllListeners =
496Emitter.prototype.removeEventListener = function(event, fn){
497 this._callbacks = this._callbacks || {};
498
499 // all
500 if (0 == arguments.length) {
501 this._callbacks = {};
502 return this;
503 }
504
505 // specific event
506 var callbacks = this._callbacks[event];
507 if (!callbacks) return this;
508
509 // remove all handlers
510 if (1 == arguments.length) {
511 delete this._callbacks[event];
512 return this;
513 }
514
515 // remove specific handler
516 var cb;
517 for (var i = 0; i < callbacks.length; i++) {
518 cb = callbacks[i];
519 if (cb === fn || cb.fn === fn) {
520 callbacks.splice(i, 1);
521 break;
522 }
523 }
524 return this;
525};
526
527/**
528 * Emit `event` with the given args.
529 *
530 * @param {String} event
531 * @param {Mixed} ...
532 * @return {Emitter}
533 */
534
535Emitter.prototype.emit = function(event){
536 this._callbacks = this._callbacks || {};
537 var args = [].slice.call(arguments, 1)
538 , callbacks = this._callbacks[event];
539
540 if (callbacks) {
541 callbacks = callbacks.slice(0);
542 for (var i = 0, len = callbacks.length; i < len; ++i) {
543 callbacks[i].apply(this, args);
544 }
545 }
546
547 return this;
548};
549
550/**
551 * Return array of callbacks for `event`.
552 *
553 * @param {String} event
554 * @return {Array}
555 * @api public
556 */
557
558Emitter.prototype.listeners = function(event){
559 this._callbacks = this._callbacks || {};
560 return this._callbacks[event] || [];
561};
562
563/**
564 * Check if this emitter has `event` handlers.
565 *
566 * @param {String} event
567 * @return {Boolean}
568 * @api public
569 */
570
571Emitter.prototype.hasListeners = function(event){
572 return !! this.listeners(event).length;
573};
574
575},{}],11:[function(require,module,exports){
576
577module.exports = function(a, b){
578 var fn = function(){};
579 fn.prototype = b.prototype;
580 a.prototype = new fn;
581 a.prototype.constructor = a;
582};
583},{}],12:[function(require,module,exports){
584
585/**
586 * This is the web browser implementation of `debug()`.
587 *
588 * Expose `debug()` as the module.
589 */
590
591exports = module.exports = require(13);
592exports.log = log;
593exports.formatArgs = formatArgs;
594exports.save = save;
595exports.load = load;
596exports.useColors = useColors;
597exports.storage = 'undefined' != typeof chrome
598 && 'undefined' != typeof chrome.storage
599 ? chrome.storage.local
600 : localstorage();
601
602/**
603 * Colors.
604 */
605
606exports.colors = [
607 'lightseagreen',
608 'forestgreen',
609 'goldenrod',
610 'dodgerblue',
611 'darkorchid',
612 'crimson'
613];
614
615/**
616 * Currently only WebKit-based Web Inspectors, Firefox >= v31,
617 * and the Firebug extension (any Firefox version) are known
618 * to support "%c" CSS customizations.
619 *
620 * TODO: add a `localStorage` variable to explicitly enable/disable colors
621 */
622
623function useColors() {
624 // is webkit? http://stackoverflow.com/a/16459606/376773
625 return ('WebkitAppearance' in document.documentElement.style) ||
626 // is firebug? http://stackoverflow.com/a/398120/376773
627 (window.console && (console.firebug || (console.exception && console.table))) ||
628 // is firefox >= v31?
629 // https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Styling_messages
630 (navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/) && parseInt(RegExp.$1, 10) >= 31);
631}
632
633/**
634 * Map %j to `JSON.stringify()`, since no Web Inspectors do that by default.
635 */
636
637exports.formatters.j = function(v) {
638 return JSON.stringify(v);
639};
640
641
642/**
643 * Colorize log arguments if enabled.
644 *
645 * @api public
646 */
647
648function formatArgs() {
649 var args = arguments;
650 var useColors = this.useColors;
651
652 args[0] = (useColors ? '%c' : '')
653 + this.namespace
654 + (useColors ? ' %c' : ' ')
655 + args[0]
656 + (useColors ? '%c ' : ' ')
657 + '+' + exports.humanize(this.diff);
658
659 if (!useColors) return args;
660
661 var c = 'color: ' + this.color;
662 args = [args[0], c, 'color: inherit'].concat(Array.prototype.slice.call(args, 1));
663
664 // the final "%c" is somewhat tricky, because there could be other
665 // arguments passed either before or after the %c, so we need to
666 // figure out the correct index to insert the CSS into
667 var index = 0;
668 var lastC = 0;
669 args[0].replace(/%[a-z%]/g, function(match) {
670 if ('%%' === match) return;
671 index++;
672 if ('%c' === match) {
673 // we only are interested in the *last* %c
674 // (the user may have provided their own)
675 lastC = index;
676 }
677 });
678
679 args.splice(lastC, 0, c);
680 return args;
681}
682
683/**
684 * Invokes `console.log()` when available.
685 * No-op when `console.log` is not a "function".
686 *
687 * @api public
688 */
689
690function log() {
691 // this hackery is required for IE8/9, where
692 // the `console.log` function doesn't have 'apply'
693 return 'object' === typeof console
694 && console.log
695 && Function.prototype.apply.call(console.log, console, arguments);
696}
697
698/**
699 * Save `namespaces`.
700 *
701 * @param {String} namespaces
702 * @api private
703 */
704
705function save(namespaces) {
706 try {
707 if (null == namespaces) {
708 exports.storage.removeItem('debug');
709 } else {
710 exports.storage.debug = namespaces;
711 }
712 } catch(e) {}
713}
714
715/**
716 * Load `namespaces`.
717 *
718 * @return {String} returns the previously persisted debug modes
719 * @api private
720 */
721
722function load() {
723 var r;
724 try {
725 r = exports.storage.debug;
726 } catch(e) {}
727 return r;
728}
729
730/**
731 * Enable namespaces listed in `localStorage.debug` initially.
732 */
733
734exports.enable(load());
735
736/**
737 * Localstorage attempts to return the localstorage.
738 *
739 * This is necessary because safari throws
740 * when a user disables cookies/localstorage
741 * and you attempt to access it.
742 *
743 * @return {LocalStorage}
744 * @api private
745 */
746
747function localstorage(){
748 try {
749 return window.localStorage;
750 } catch (e) {}
751}
752
753},{"13":13}],13:[function(require,module,exports){
754
755/**
756 * This is the common logic for both the Node.js and web browser
757 * implementations of `debug()`.
758 *
759 * Expose `debug()` as the module.
760 */
761
762exports = module.exports = debug;
763exports.coerce = coerce;
764exports.disable = disable;
765exports.enable = enable;
766exports.enabled = enabled;
767exports.humanize = require(86);
768
769/**
770 * The currently active debug mode names, and names to skip.
771 */
772
773exports.names = [];
774exports.skips = [];
775
776/**
777 * Map of special "%n" handling functions, for the debug "format" argument.
778 *
779 * Valid key names are a single, lowercased letter, i.e. "n".
780 */
781
782exports.formatters = {};
783
784/**
785 * Previously assigned color.
786 */
787
788var prevColor = 0;
789
790/**
791 * Previous log timestamp.
792 */
793
794var prevTime;
795
796/**
797 * Select a color.
798 *
799 * @return {Number}
800 * @api private
801 */
802
803function selectColor() {
804 return exports.colors[prevColor++ % exports.colors.length];
805}
806
807/**
808 * Create a debugger with the given `namespace`.
809 *
810 * @param {String} namespace
811 * @return {Function}
812 * @api public
813 */
814
815function debug(namespace) {
816
817 // define the `disabled` version
818 function disabled() {
819 }
820 disabled.enabled = false;
821
822 // define the `enabled` version
823 function enabled() {
824
825 var self = enabled;
826
827 // set `diff` timestamp
828 var curr = +new Date();
829 var ms = curr - (prevTime || curr);
830 self.diff = ms;
831 self.prev = prevTime;
832 self.curr = curr;
833 prevTime = curr;
834
835 // add the `color` if not set
836 if (null == self.useColors) self.useColors = exports.useColors();
837 if (null == self.color && self.useColors) self.color = selectColor();
838
839 var args = Array.prototype.slice.call(arguments);
840
841 args[0] = exports.coerce(args[0]);
842
843 if ('string' !== typeof args[0]) {
844 // anything else let's inspect with %o
845 args = ['%o'].concat(args);
846 }
847
848 // apply any `formatters` transformations
849 var index = 0;
850 args[0] = args[0].replace(/%([a-z%])/g, function(match, format) {
851 // if we encounter an escaped % then don't increase the array index
852 if (match === '%%') return match;
853 index++;
854 var formatter = exports.formatters[format];
855 if ('function' === typeof formatter) {
856 var val = args[index];
857 match = formatter.call(self, val);
858
859 // now we need to remove `args[index]` since it's inlined in the `format`
860 args.splice(index, 1);
861 index--;
862 }
863 return match;
864 });
865
866 if ('function' === typeof exports.formatArgs) {
867 args = exports.formatArgs.apply(self, args);
868 }
869 var logFn = enabled.log || exports.log || console.log.bind(console);
870 logFn.apply(self, args);
871 }
872 enabled.enabled = true;
873
874 var fn = exports.enabled(namespace) ? enabled : disabled;
875
876 fn.namespace = namespace;
877
878 return fn;
879}
880
881/**
882 * Enables a debug mode by namespaces. This can include modes
883 * separated by a colon and wildcards.
884 *
885 * @param {String} namespaces
886 * @api public
887 */
888
889function enable(namespaces) {
890 exports.save(namespaces);
891
892 var split = (namespaces || '').split(/[\s,]+/);
893 var len = split.length;
894
895 for (var i = 0; i < len; i++) {
896 if (!split[i]) continue; // ignore empty strings
897 namespaces = split[i].replace(/\*/g, '.*?');
898 if (namespaces[0] === '-') {
899 exports.skips.push(new RegExp('^' + namespaces.substr(1) + '$'));
900 } else {
901 exports.names.push(new RegExp('^' + namespaces + '$'));
902 }
903 }
904}
905
906/**
907 * Disable debug output.
908 *
909 * @api public
910 */
911
912function disable() {
913 exports.enable('');
914}
915
916/**
917 * Returns true if the given mode name is enabled, false otherwise.
918 *
919 * @param {String} name
920 * @return {Boolean}
921 * @api public
922 */
923
924function enabled(name) {
925 var i, len;
926 for (i = 0, len = exports.skips.length; i < len; i++) {
927 if (exports.skips[i].test(name)) {
928 return false;
929 }
930 }
931 for (i = 0, len = exports.names.length; i < len; i++) {
932 if (exports.names[i].test(name)) {
933 return true;
934 }
935 }
936 return false;
937}
938
939/**
940 * Coerce `val`.
941 *
942 * @param {Mixed} val
943 * @return {Mixed}
944 * @api private
945 */
946
947function coerce(val) {
948 if (val instanceof Error) return val.stack || val.message;
949 return val;
950}
951
952},{"86":86}],14:[function(require,module,exports){
953var pSlice = Array.prototype.slice;
954var objectKeys = require(16);
955var isArguments = require(15);
956
957var deepEqual = module.exports = function (actual, expected, opts) {
958 if (!opts) opts = {};
959 // 7.1. All identical values are equivalent, as determined by ===.
960 if (actual === expected) {
961 return true;
962
963 } else if (actual instanceof Date && expected instanceof Date) {
964 return actual.getTime() === expected.getTime();
965
966 // 7.3. Other pairs that do not both pass typeof value == 'object',
967 // equivalence is determined by ==.
968 } else if (!actual || !expected || typeof actual != 'object' && typeof expected != 'object') {
969 return opts.strict ? actual === expected : actual == expected;
970
971 // 7.4. For all other Object pairs, including Array objects, equivalence is
972 // determined by having the same number of owned properties (as verified
973 // with Object.prototype.hasOwnProperty.call), the same set of keys
974 // (although not necessarily the same order), equivalent values for every
975 // corresponding key, and an identical 'prototype' property. Note: this
976 // accounts for both named and indexed properties on Arrays.
977 } else {
978 return objEquiv(actual, expected, opts);
979 }
980}
981
982function isUndefinedOrNull(value) {
983 return value === null || value === undefined;
984}
985
986function isBuffer (x) {
987 if (!x || typeof x !== 'object' || typeof x.length !== 'number') return false;
988 if (typeof x.copy !== 'function' || typeof x.slice !== 'function') {
989 return false;
990 }
991 if (x.length > 0 && typeof x[0] !== 'number') return false;
992 return true;
993}
994
995function objEquiv(a, b, opts) {
996 var i, key;
997 if (isUndefinedOrNull(a) || isUndefinedOrNull(b))
998 return false;
999 // an identical 'prototype' property.
1000 if (a.prototype !== b.prototype) return false;
1001 //~~~I've managed to break Object.keys through screwy arguments passing.
1002 // Converting to array solves the problem.
1003 if (isArguments(a)) {
1004 if (!isArguments(b)) {
1005 return false;
1006 }
1007 a = pSlice.call(a);
1008 b = pSlice.call(b);
1009 return deepEqual(a, b, opts);
1010 }
1011 if (isBuffer(a)) {
1012 if (!isBuffer(b)) {
1013 return false;
1014 }
1015 if (a.length !== b.length) return false;
1016 for (i = 0; i < a.length; i++) {
1017 if (a[i] !== b[i]) return false;
1018 }
1019 return true;
1020 }
1021 try {
1022 var ka = objectKeys(a),
1023 kb = objectKeys(b);
1024 } catch (e) {//happens when one is a string literal and the other isn't
1025 return false;
1026 }
1027 // having the same number of owned properties (keys incorporates
1028 // hasOwnProperty)
1029 if (ka.length != kb.length)
1030 return false;
1031 //the same set of keys (although not necessarily the same order),
1032 ka.sort();
1033 kb.sort();
1034 //~~~cheap key test
1035 for (i = ka.length - 1; i >= 0; i--) {
1036 if (ka[i] != kb[i])
1037 return false;
1038 }
1039 //equivalent values for every corresponding key, and
1040 //~~~possibly expensive deep test
1041 for (i = ka.length - 1; i >= 0; i--) {
1042 key = ka[i];
1043 if (!deepEqual(a[key], b[key], opts)) return false;
1044 }
1045 return typeof a === typeof b;
1046}
1047
1048},{"15":15,"16":16}],15:[function(require,module,exports){
1049var supportsArgumentsClass = (function(){
1050 return Object.prototype.toString.call(arguments)
1051})() == '[object Arguments]';
1052
1053exports = module.exports = supportsArgumentsClass ? supported : unsupported;
1054
1055exports.supported = supported;
1056function supported(object) {
1057 return Object.prototype.toString.call(object) == '[object Arguments]';
1058};
1059
1060exports.unsupported = unsupported;
1061function unsupported(object){
1062 return object &&
1063 typeof object == 'object' &&
1064 typeof object.length == 'number' &&
1065 Object.prototype.hasOwnProperty.call(object, 'callee') &&
1066 !Object.prototype.propertyIsEnumerable.call(object, 'callee') ||
1067 false;
1068};
1069
1070},{}],16:[function(require,module,exports){
1071exports = module.exports = typeof Object.keys === 'function'
1072 ? Object.keys : shim;
1073
1074exports.shim = shim;
1075function shim (obj) {
1076 var keys = [];
1077 for (var key in obj) keys.push(key);
1078 return keys;
1079}
1080
1081},{}],17:[function(require,module,exports){
1082
1083module.exports = require(18);
1084
1085},{"18":18}],18:[function(require,module,exports){
1086
1087module.exports = require(19);
1088
1089/**
1090 * Exports parser
1091 *
1092 * @api public
1093 *
1094 */
1095module.exports.parser = require(27);
1096
1097},{"19":19,"27":27}],19:[function(require,module,exports){
1098(function (global){
1099/**
1100 * Module dependencies.
1101 */
1102
1103var transports = require(21);
1104var Emitter = require(10);
1105var debug = require(12)('engine.io-client:socket');
1106var index = require(80);
1107var parser = require(27);
1108var parseuri = require(89);
1109var parsejson = require(87);
1110var parseqs = require(88);
1111
1112/**
1113 * Module exports.
1114 */
1115
1116module.exports = Socket;
1117
1118/**
1119 * Noop function.
1120 *
1121 * @api private
1122 */
1123
1124function noop(){}
1125
1126/**
1127 * Socket constructor.
1128 *
1129 * @param {String|Object} uri or options
1130 * @param {Object} options
1131 * @api public
1132 */
1133
1134function Socket(uri, opts){
1135 if (!(this instanceof Socket)) return new Socket(uri, opts);
1136
1137 opts = opts || {};
1138
1139 if (uri && 'object' == typeof uri) {
1140 opts = uri;
1141 uri = null;
1142 }
1143
1144 if (uri) {
1145 uri = parseuri(uri);
1146 opts.hostname = uri.host;
1147 opts.secure = uri.protocol == 'https' || uri.protocol == 'wss';
1148 opts.port = uri.port;
1149 if (uri.query) opts.query = uri.query;
1150 } else if (opts.host) {
1151 opts.hostname = parseuri(opts.host).host;
1152 }
1153
1154 this.secure = null != opts.secure ? opts.secure :
1155 (global.location && 'https:' == location.protocol);
1156
1157 if (opts.hostname && !opts.port) {
1158 // if no port is specified manually, use the protocol default
1159 opts.port = this.secure ? '443' : '80';
1160 }
1161
1162 this.agent = opts.agent || false;
1163 this.hostname = opts.hostname ||
1164 (global.location ? location.hostname : 'localhost');
1165 this.port = opts.port || (global.location && location.port ?
1166 location.port :
1167 (this.secure ? 443 : 80));
1168 this.query = opts.query || {};
1169 if ('string' == typeof this.query) this.query = parseqs.decode(this.query);
1170 this.upgrade = false !== opts.upgrade;
1171 this.path = (opts.path || '/engine.io').replace(/\/$/, '') + '/';
1172 this.forceJSONP = !!opts.forceJSONP;
1173 this.jsonp = false !== opts.jsonp;
1174 this.forceBase64 = !!opts.forceBase64;
1175 this.enablesXDR = !!opts.enablesXDR;
1176 this.timestampParam = opts.timestampParam || 't';
1177 this.timestampRequests = opts.timestampRequests;
1178 this.transports = opts.transports || ['polling', 'websocket'];
1179 this.readyState = '';
1180 this.writeBuffer = [];
1181 this.policyPort = opts.policyPort || 843;
1182 this.rememberUpgrade = opts.rememberUpgrade || false;
1183 this.binaryType = null;
1184 this.onlyBinaryUpgrades = opts.onlyBinaryUpgrades;
1185 this.perMessageDeflate = false !== opts.perMessageDeflate ? (opts.perMessageDeflate || {}) : false;
1186
1187 if (true === this.perMessageDeflate) this.perMessageDeflate = {};
1188 if (this.perMessageDeflate && null == this.perMessageDeflate.threshold) {
1189 this.perMessageDeflate.threshold = 1024;
1190 }
1191
1192 // SSL options for Node.js client
1193 this.pfx = opts.pfx || null;
1194 this.key = opts.key || null;
1195 this.passphrase = opts.passphrase || null;
1196 this.cert = opts.cert || null;
1197 this.ca = opts.ca || null;
1198 this.ciphers = opts.ciphers || null;
1199 this.rejectUnauthorized = opts.rejectUnauthorized === undefined ? null : opts.rejectUnauthorized;
1200
1201 // other options for Node.js client
1202 var freeGlobal = typeof global == 'object' && global;
1203 if (freeGlobal.global === freeGlobal) {
1204 if (opts.extraHeaders && Object.keys(opts.extraHeaders).length > 0) {
1205 this.extraHeaders = opts.extraHeaders;
1206 }
1207 }
1208
1209 this.open();
1210}
1211
1212Socket.priorWebsocketSuccess = false;
1213
1214/**
1215 * Mix in `Emitter`.
1216 */
1217
1218Emitter(Socket.prototype);
1219
1220/**
1221 * Protocol version.
1222 *
1223 * @api public
1224 */
1225
1226Socket.protocol = parser.protocol; // this is an int
1227
1228/**
1229 * Expose deps for legacy compatibility
1230 * and standalone browser access.
1231 */
1232
1233Socket.Socket = Socket;
1234Socket.Transport = require(20);
1235Socket.transports = require(21);
1236Socket.parser = require(27);
1237
1238/**
1239 * Creates transport of the given type.
1240 *
1241 * @param {String} transport name
1242 * @return {Transport}
1243 * @api private
1244 */
1245
1246Socket.prototype.createTransport = function (name) {
1247 debug('creating transport "%s"', name);
1248 var query = clone(this.query);
1249
1250 // append engine.io protocol identifier
1251 query.EIO = parser.protocol;
1252
1253 // transport name
1254 query.transport = name;
1255
1256 // session id if we already have one
1257 if (this.id) query.sid = this.id;
1258
1259 var transport = new transports[name]({
1260 agent: this.agent,
1261 hostname: this.hostname,
1262 port: this.port,
1263 secure: this.secure,
1264 path: this.path,
1265 query: query,
1266 forceJSONP: this.forceJSONP,
1267 jsonp: this.jsonp,
1268 forceBase64: this.forceBase64,
1269 enablesXDR: this.enablesXDR,
1270 timestampRequests: this.timestampRequests,
1271 timestampParam: this.timestampParam,
1272 policyPort: this.policyPort,
1273 socket: this,
1274 pfx: this.pfx,
1275 key: this.key,
1276 passphrase: this.passphrase,
1277 cert: this.cert,
1278 ca: this.ca,
1279 ciphers: this.ciphers,
1280 rejectUnauthorized: this.rejectUnauthorized,
1281 perMessageDeflate: this.perMessageDeflate,
1282 extraHeaders: this.extraHeaders
1283 });
1284
1285 return transport;
1286};
1287
1288function clone (obj) {
1289 var o = {};
1290 for (var i in obj) {
1291 if (obj.hasOwnProperty(i)) {
1292 o[i] = obj[i];
1293 }
1294 }
1295 return o;
1296}
1297
1298/**
1299 * Initializes transport to use and starts probe.
1300 *
1301 * @api private
1302 */
1303Socket.prototype.open = function () {
1304 var transport;
1305 if (this.rememberUpgrade && Socket.priorWebsocketSuccess && this.transports.indexOf('websocket') != -1) {
1306 transport = 'websocket';
1307 } else if (0 === this.transports.length) {
1308 // Emit error on next tick so it can be listened to
1309 var self = this;
1310 setTimeout(function() {
1311 self.emit('error', 'No transports available');
1312 }, 0);
1313 return;
1314 } else {
1315 transport = this.transports[0];
1316 }
1317 this.readyState = 'opening';
1318
1319 // Retry with the next transport if the transport is disabled (jsonp: false)
1320 try {
1321 transport = this.createTransport(transport);
1322 } catch (e) {
1323 this.transports.shift();
1324 this.open();
1325 return;
1326 }
1327
1328 transport.open();
1329 this.setTransport(transport);
1330};
1331
1332/**
1333 * Sets the current transport. Disables the existing one (if any).
1334 *
1335 * @api private
1336 */
1337
1338Socket.prototype.setTransport = function(transport){
1339 debug('setting transport %s', transport.name);
1340 var self = this;
1341
1342 if (this.transport) {
1343 debug('clearing existing transport %s', this.transport.name);
1344 this.transport.removeAllListeners();
1345 }
1346
1347 // set up transport
1348 this.transport = transport;
1349
1350 // set up transport listeners
1351 transport
1352 .on('drain', function(){
1353 self.onDrain();
1354 })
1355 .on('packet', function(packet){
1356 self.onPacket(packet);
1357 })
1358 .on('error', function(e){
1359 self.onError(e);
1360 })
1361 .on('close', function(){
1362 self.onClose('transport close');
1363 });
1364};
1365
1366/**
1367 * Probes a transport.
1368 *
1369 * @param {String} transport name
1370 * @api private
1371 */
1372
1373Socket.prototype.probe = function (name) {
1374 debug('probing transport "%s"', name);
1375 var transport = this.createTransport(name, { probe: 1 })
1376 , failed = false
1377 , self = this;
1378
1379 Socket.priorWebsocketSuccess = false;
1380
1381 function onTransportOpen(){
1382 if (self.onlyBinaryUpgrades) {
1383 var upgradeLosesBinary = !this.supportsBinary && self.transport.supportsBinary;
1384 failed = failed || upgradeLosesBinary;
1385 }
1386 if (failed) return;
1387
1388 debug('probe transport "%s" opened', name);
1389 transport.send([{ type: 'ping', data: 'probe' }]);
1390 transport.once('packet', function (msg) {
1391 if (failed) return;
1392 if ('pong' == msg.type && 'probe' == msg.data) {
1393 debug('probe transport "%s" pong', name);
1394 self.upgrading = true;
1395 self.emit('upgrading', transport);
1396 if (!transport) return;
1397 Socket.priorWebsocketSuccess = 'websocket' == transport.name;
1398
1399 debug('pausing current transport "%s"', self.transport.name);
1400 self.transport.pause(function () {
1401 if (failed) return;
1402 if ('closed' == self.readyState) return;
1403 debug('changing transport and sending upgrade packet');
1404
1405 cleanup();
1406
1407 self.setTransport(transport);
1408 transport.send([{ type: 'upgrade' }]);
1409 self.emit('upgrade', transport);
1410 transport = null;
1411 self.upgrading = false;
1412 self.flush();
1413 });
1414 } else {
1415 debug('probe transport "%s" failed', name);
1416 var err = new Error('probe error');
1417 err.transport = transport.name;
1418 self.emit('upgradeError', err);
1419 }
1420 });
1421 }
1422
1423 function freezeTransport() {
1424 if (failed) return;
1425
1426 // Any callback called by transport should be ignored since now
1427 failed = true;
1428
1429 cleanup();
1430
1431 transport.close();
1432 transport = null;
1433 }
1434
1435 //Handle any error that happens while probing
1436 function onerror(err) {
1437 var error = new Error('probe error: ' + err);
1438 error.transport = transport.name;
1439
1440 freezeTransport();
1441
1442 debug('probe transport "%s" failed because of error: %s', name, err);
1443
1444 self.emit('upgradeError', error);
1445 }
1446
1447 function onTransportClose(){
1448 onerror("transport closed");
1449 }
1450
1451 //When the socket is closed while we're probing
1452 function onclose(){
1453 onerror("socket closed");
1454 }
1455
1456 //When the socket is upgraded while we're probing
1457 function onupgrade(to){
1458 if (transport && to.name != transport.name) {
1459 debug('"%s" works - aborting "%s"', to.name, transport.name);
1460 freezeTransport();
1461 }
1462 }
1463
1464 //Remove all listeners on the transport and on self
1465 function cleanup(){
1466 transport.removeListener('open', onTransportOpen);
1467 transport.removeListener('error', onerror);
1468 transport.removeListener('close', onTransportClose);
1469 self.removeListener('close', onclose);
1470 self.removeListener('upgrading', onupgrade);
1471 }
1472
1473 transport.once('open', onTransportOpen);
1474 transport.once('error', onerror);
1475 transport.once('close', onTransportClose);
1476
1477 this.once('close', onclose);
1478 this.once('upgrading', onupgrade);
1479
1480 transport.open();
1481
1482};
1483
1484/**
1485 * Called when connection is deemed open.
1486 *
1487 * @api public
1488 */
1489
1490Socket.prototype.onOpen = function () {
1491 debug('socket open');
1492 this.readyState = 'open';
1493 Socket.priorWebsocketSuccess = 'websocket' == this.transport.name;
1494 this.emit('open');
1495 this.flush();
1496
1497 // we check for `readyState` in case an `open`
1498 // listener already closed the socket
1499 if ('open' == this.readyState && this.upgrade && this.transport.pause) {
1500 debug('starting upgrade probes');
1501 for (var i = 0, l = this.upgrades.length; i < l; i++) {
1502 this.probe(this.upgrades[i]);
1503 }
1504 }
1505};
1506
1507/**
1508 * Handles a packet.
1509 *
1510 * @api private
1511 */
1512
1513Socket.prototype.onPacket = function (packet) {
1514 if ('opening' == this.readyState || 'open' == this.readyState) {
1515 debug('socket receive: type "%s", data "%s"', packet.type, packet.data);
1516
1517 this.emit('packet', packet);
1518
1519 // Socket is live - any packet counts
1520 this.emit('heartbeat');
1521
1522 switch (packet.type) {
1523 case 'open':
1524 this.onHandshake(parsejson(packet.data));
1525 break;
1526
1527 case 'pong':
1528 this.setPing();
1529 this.emit('pong');
1530 break;
1531
1532 case 'error':
1533 var err = new Error('server error');
1534 err.code = packet.data;
1535 this.onError(err);
1536 break;
1537
1538 case 'message':
1539 this.emit('data', packet.data);
1540 this.emit('message', packet.data);
1541 break;
1542 }
1543 } else {
1544 debug('packet received with socket readyState "%s"', this.readyState);
1545 }
1546};
1547
1548/**
1549 * Called upon handshake completion.
1550 *
1551 * @param {Object} handshake obj
1552 * @api private
1553 */
1554
1555Socket.prototype.onHandshake = function (data) {
1556 this.emit('handshake', data);
1557 this.id = data.sid;
1558 this.transport.query.sid = data.sid;
1559 this.upgrades = this.filterUpgrades(data.upgrades);
1560 this.pingInterval = data.pingInterval;
1561 this.pingTimeout = data.pingTimeout;
1562 this.onOpen();
1563 // In case open handler closes socket
1564 if ('closed' == this.readyState) return;
1565 this.setPing();
1566
1567 // Prolong liveness of socket on heartbeat
1568 this.removeListener('heartbeat', this.onHeartbeat);
1569 this.on('heartbeat', this.onHeartbeat);
1570};
1571
1572/**
1573 * Resets ping timeout.
1574 *
1575 * @api private
1576 */
1577
1578Socket.prototype.onHeartbeat = function (timeout) {
1579 clearTimeout(this.pingTimeoutTimer);
1580 var self = this;
1581 self.pingTimeoutTimer = setTimeout(function () {
1582 if ('closed' == self.readyState) return;
1583 self.onClose('ping timeout');
1584 }, timeout || (self.pingInterval + self.pingTimeout));
1585};
1586
1587/**
1588 * Pings server every `this.pingInterval` and expects response
1589 * within `this.pingTimeout` or closes connection.
1590 *
1591 * @api private
1592 */
1593
1594Socket.prototype.setPing = function () {
1595 var self = this;
1596 clearTimeout(self.pingIntervalTimer);
1597 self.pingIntervalTimer = setTimeout(function () {
1598 debug('writing ping packet - expecting pong within %sms', self.pingTimeout);
1599 self.ping();
1600 self.onHeartbeat(self.pingTimeout);
1601 }, self.pingInterval);
1602};
1603
1604/**
1605* Sends a ping packet.
1606*
1607* @api private
1608*/
1609
1610Socket.prototype.ping = function () {
1611 var self = this;
1612 this.sendPacket('ping', function(){
1613 self.emit('ping');
1614 });
1615};
1616
1617/**
1618 * Called on `drain` event
1619 *
1620 * @api private
1621 */
1622
1623Socket.prototype.onDrain = function() {
1624 this.writeBuffer.splice(0, this.prevBufferLen);
1625
1626 // setting prevBufferLen = 0 is very important
1627 // for example, when upgrading, upgrade packet is sent over,
1628 // and a nonzero prevBufferLen could cause problems on `drain`
1629 this.prevBufferLen = 0;
1630
1631 if (0 === this.writeBuffer.length) {
1632 this.emit('drain');
1633 } else {
1634 this.flush();
1635 }
1636};
1637
1638/**
1639 * Flush write buffers.
1640 *
1641 * @api private
1642 */
1643
1644Socket.prototype.flush = function () {
1645 if ('closed' != this.readyState && this.transport.writable &&
1646 !this.upgrading && this.writeBuffer.length) {
1647 debug('flushing %d packets in socket', this.writeBuffer.length);
1648 this.transport.send(this.writeBuffer);
1649 // keep track of current length of writeBuffer
1650 // splice writeBuffer and callbackBuffer on `drain`
1651 this.prevBufferLen = this.writeBuffer.length;
1652 this.emit('flush');
1653 }
1654};
1655
1656/**
1657 * Sends a message.
1658 *
1659 * @param {String} message.
1660 * @param {Function} callback function.
1661 * @param {Object} options.
1662 * @return {Socket} for chaining.
1663 * @api public
1664 */
1665
1666Socket.prototype.write =
1667Socket.prototype.send = function (msg, options, fn) {
1668 this.sendPacket('message', msg, options, fn);
1669 return this;
1670};
1671
1672/**
1673 * Sends a packet.
1674 *
1675 * @param {String} packet type.
1676 * @param {String} data.
1677 * @param {Object} options.
1678 * @param {Function} callback function.
1679 * @api private
1680 */
1681
1682Socket.prototype.sendPacket = function (type, data, options, fn) {
1683 if('function' == typeof data) {
1684 fn = data;
1685 data = undefined;
1686 }
1687
1688 if ('function' == typeof options) {
1689 fn = options;
1690 options = null;
1691 }
1692
1693 if ('closing' == this.readyState || 'closed' == this.readyState) {
1694 return;
1695 }
1696
1697 options = options || {};
1698 options.compress = false !== options.compress;
1699
1700 var packet = {
1701 type: type,
1702 data: data,
1703 options: options
1704 };
1705 this.emit('packetCreate', packet);
1706 this.writeBuffer.push(packet);
1707 if (fn) this.once('flush', fn);
1708 this.flush();
1709};
1710
1711/**
1712 * Closes the connection.
1713 *
1714 * @api private
1715 */
1716
1717Socket.prototype.close = function () {
1718 if ('opening' == this.readyState || 'open' == this.readyState) {
1719 this.readyState = 'closing';
1720
1721 var self = this;
1722
1723 if (this.writeBuffer.length) {
1724 this.once('drain', function() {
1725 if (this.upgrading) {
1726 waitForUpgrade();
1727 } else {
1728 close();
1729 }
1730 });
1731 } else if (this.upgrading) {
1732 waitForUpgrade();
1733 } else {
1734 close();
1735 }
1736 }
1737
1738 function close() {
1739 self.onClose('forced close');
1740 debug('socket closing - telling transport to close');
1741 self.transport.close();
1742 }
1743
1744 function cleanupAndClose() {
1745 self.removeListener('upgrade', cleanupAndClose);
1746 self.removeListener('upgradeError', cleanupAndClose);
1747 close();
1748 }
1749
1750 function waitForUpgrade() {
1751 // wait for upgrade to finish since we can't send packets while pausing a transport
1752 self.once('upgrade', cleanupAndClose);
1753 self.once('upgradeError', cleanupAndClose);
1754 }
1755
1756 return this;
1757};
1758
1759/**
1760 * Called upon transport error
1761 *
1762 * @api private
1763 */
1764
1765Socket.prototype.onError = function (err) {
1766 debug('socket error %j', err);
1767 Socket.priorWebsocketSuccess = false;
1768 this.emit('error', err);
1769 this.onClose('transport error', err);
1770};
1771
1772/**
1773 * Called upon transport close.
1774 *
1775 * @api private
1776 */
1777
1778Socket.prototype.onClose = function (reason, desc) {
1779 if ('opening' == this.readyState || 'open' == this.readyState || 'closing' == this.readyState) {
1780 debug('socket close with reason: "%s"', reason);
1781 var self = this;
1782
1783 // clear timers
1784 clearTimeout(this.pingIntervalTimer);
1785 clearTimeout(this.pingTimeoutTimer);
1786
1787 // stop event from firing again for transport
1788 this.transport.removeAllListeners('close');
1789
1790 // ensure transport won't stay open
1791 this.transport.close();
1792
1793 // ignore further transport communication
1794 this.transport.removeAllListeners();
1795
1796 // set ready state
1797 this.readyState = 'closed';
1798
1799 // clear session id
1800 this.id = null;
1801
1802 // emit close event
1803 this.emit('close', reason, desc);
1804
1805 // clean buffers after, so users can still
1806 // grab the buffers on `close` event
1807 self.writeBuffer = [];
1808 self.prevBufferLen = 0;
1809 }
1810};
1811
1812/**
1813 * Filters upgrades, returning only those matching client transports.
1814 *
1815 * @param {Array} server upgrades
1816 * @api private
1817 *
1818 */
1819
1820Socket.prototype.filterUpgrades = function (upgrades) {
1821 var filteredUpgrades = [];
1822 for (var i = 0, j = upgrades.length; i<j; i++) {
1823 if (~index(this.transports, upgrades[i])) filteredUpgrades.push(upgrades[i]);
1824 }
1825 return filteredUpgrades;
1826};
1827
1828}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
1829},{"10":10,"12":12,"20":20,"21":21,"27":27,"80":80,"87":87,"88":88,"89":89}],20:[function(require,module,exports){
1830/**
1831 * Module dependencies.
1832 */
1833
1834var parser = require(27);
1835var Emitter = require(10);
1836
1837/**
1838 * Module exports.
1839 */
1840
1841module.exports = Transport;
1842
1843/**
1844 * Transport abstract constructor.
1845 *
1846 * @param {Object} options.
1847 * @api private
1848 */
1849
1850function Transport (opts) {
1851 this.path = opts.path;
1852 this.hostname = opts.hostname;
1853 this.port = opts.port;
1854 this.secure = opts.secure;
1855 this.query = opts.query;
1856 this.timestampParam = opts.timestampParam;
1857 this.timestampRequests = opts.timestampRequests;
1858 this.readyState = '';
1859 this.agent = opts.agent || false;
1860 this.socket = opts.socket;
1861 this.enablesXDR = opts.enablesXDR;
1862
1863 // SSL options for Node.js client
1864 this.pfx = opts.pfx;
1865 this.key = opts.key;
1866 this.passphrase = opts.passphrase;
1867 this.cert = opts.cert;
1868 this.ca = opts.ca;
1869 this.ciphers = opts.ciphers;
1870 this.rejectUnauthorized = opts.rejectUnauthorized;
1871
1872 // other options for Node.js client
1873 this.extraHeaders = opts.extraHeaders;
1874}
1875
1876/**
1877 * Mix in `Emitter`.
1878 */
1879
1880Emitter(Transport.prototype);
1881
1882/**
1883 * Emits an error.
1884 *
1885 * @param {String} str
1886 * @return {Transport} for chaining
1887 * @api public
1888 */
1889
1890Transport.prototype.onError = function (msg, desc) {
1891 var err = new Error(msg);
1892 err.type = 'TransportError';
1893 err.description = desc;
1894 this.emit('error', err);
1895 return this;
1896};
1897
1898/**
1899 * Opens the transport.
1900 *
1901 * @api public
1902 */
1903
1904Transport.prototype.open = function () {
1905 if ('closed' == this.readyState || '' == this.readyState) {
1906 this.readyState = 'opening';
1907 this.doOpen();
1908 }
1909
1910 return this;
1911};
1912
1913/**
1914 * Closes the transport.
1915 *
1916 * @api private
1917 */
1918
1919Transport.prototype.close = function () {
1920 if ('opening' == this.readyState || 'open' == this.readyState) {
1921 this.doClose();
1922 this.onClose();
1923 }
1924
1925 return this;
1926};
1927
1928/**
1929 * Sends multiple packets.
1930 *
1931 * @param {Array} packets
1932 * @api private
1933 */
1934
1935Transport.prototype.send = function(packets){
1936 if ('open' == this.readyState) {
1937 this.write(packets);
1938 } else {
1939 throw new Error('Transport not open');
1940 }
1941};
1942
1943/**
1944 * Called upon open
1945 *
1946 * @api private
1947 */
1948
1949Transport.prototype.onOpen = function () {
1950 this.readyState = 'open';
1951 this.writable = true;
1952 this.emit('open');
1953};
1954
1955/**
1956 * Called with data.
1957 *
1958 * @param {String} data
1959 * @api private
1960 */
1961
1962Transport.prototype.onData = function(data){
1963 var packet = parser.decodePacket(data, this.socket.binaryType);
1964 this.onPacket(packet);
1965};
1966
1967/**
1968 * Called with a decoded packet.
1969 */
1970
1971Transport.prototype.onPacket = function (packet) {
1972 this.emit('packet', packet);
1973};
1974
1975/**
1976 * Called upon close.
1977 *
1978 * @api private
1979 */
1980
1981Transport.prototype.onClose = function () {
1982 this.readyState = 'closed';
1983 this.emit('close');
1984};
1985
1986},{"10":10,"27":27}],21:[function(require,module,exports){
1987(function (global){
1988/**
1989 * Module dependencies
1990 */
1991
1992var XMLHttpRequest = require(26);
1993var XHR = require(23);
1994var JSONP = require(22);
1995var websocket = require(25);
1996
1997/**
1998 * Export transports.
1999 */
2000
2001exports.polling = polling;
2002exports.websocket = websocket;
2003
2004/**
2005 * Polling transport polymorphic constructor.
2006 * Decides on xhr vs jsonp based on feature detection.
2007 *
2008 * @api private
2009 */
2010
2011function polling(opts){
2012 var xhr;
2013 var xd = false;
2014 var xs = false;
2015 var jsonp = false !== opts.jsonp;
2016
2017 if (global.location) {
2018 var isSSL = 'https:' == location.protocol;
2019 var port = location.port;
2020
2021 // some user agents have empty `location.port`
2022 if (!port) {
2023 port = isSSL ? 443 : 80;
2024 }
2025
2026 xd = opts.hostname != location.hostname || port != opts.port;
2027 xs = opts.secure != isSSL;
2028 }
2029
2030 opts.xdomain = xd;
2031 opts.xscheme = xs;
2032 xhr = new XMLHttpRequest(opts);
2033
2034 if ('open' in xhr && !opts.forceJSONP) {
2035 return new XHR(opts);
2036 } else {
2037 if (!jsonp) throw new Error('JSONP disabled');
2038 return new JSONP(opts);
2039 }
2040}
2041
2042}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
2043},{"22":22,"23":23,"25":25,"26":26}],22:[function(require,module,exports){
2044(function (global){
2045
2046/**
2047 * Module requirements.
2048 */
2049
2050var Polling = require(24);
2051var inherit = require(11);
2052
2053/**
2054 * Module exports.
2055 */
2056
2057module.exports = JSONPPolling;
2058
2059/**
2060 * Cached regular expressions.
2061 */
2062
2063var rNewline = /\n/g;
2064var rEscapedNewline = /\\n/g;
2065
2066/**
2067 * Global JSONP callbacks.
2068 */
2069
2070var callbacks;
2071
2072/**
2073 * Callbacks count.
2074 */
2075
2076var index = 0;
2077
2078/**
2079 * Noop.
2080 */
2081
2082function empty () { }
2083
2084/**
2085 * JSONP Polling constructor.
2086 *
2087 * @param {Object} opts.
2088 * @api public
2089 */
2090
2091function JSONPPolling (opts) {
2092 Polling.call(this, opts);
2093
2094 this.query = this.query || {};
2095
2096 // define global callbacks array if not present
2097 // we do this here (lazily) to avoid unneeded global pollution
2098 if (!callbacks) {
2099 // we need to consider multiple engines in the same page
2100 if (!global.___eio) global.___eio = [];
2101 callbacks = global.___eio;
2102 }
2103
2104 // callback identifier
2105 this.index = callbacks.length;
2106
2107 // add callback to jsonp global
2108 var self = this;
2109 callbacks.push(function (msg) {
2110 self.onData(msg);
2111 });
2112
2113 // append to query string
2114 this.query.j = this.index;
2115
2116 // prevent spurious errors from being emitted when the window is unloaded
2117 if (global.document && global.addEventListener) {
2118 global.addEventListener('beforeunload', function () {
2119 if (self.script) self.script.onerror = empty;
2120 }, false);
2121 }
2122}
2123
2124/**
2125 * Inherits from Polling.
2126 */
2127
2128inherit(JSONPPolling, Polling);
2129
2130/*
2131 * JSONP only supports binary as base64 encoded strings
2132 */
2133
2134JSONPPolling.prototype.supportsBinary = false;
2135
2136/**
2137 * Closes the socket.
2138 *
2139 * @api private
2140 */
2141
2142JSONPPolling.prototype.doClose = function () {
2143 if (this.script) {
2144 this.script.parentNode.removeChild(this.script);
2145 this.script = null;
2146 }
2147
2148 if (this.form) {
2149 this.form.parentNode.removeChild(this.form);
2150 this.form = null;
2151 this.iframe = null;
2152 }
2153
2154 Polling.prototype.doClose.call(this);
2155};
2156
2157/**
2158 * Starts a poll cycle.
2159 *
2160 * @api private
2161 */
2162
2163JSONPPolling.prototype.doPoll = function () {
2164 var self = this;
2165 var script = document.createElement('script');
2166
2167 if (this.script) {
2168 this.script.parentNode.removeChild(this.script);
2169 this.script = null;
2170 }
2171
2172 script.async = true;
2173 script.src = this.uri();
2174 script.onerror = function(e){
2175 self.onError('jsonp poll error',e);
2176 };
2177
2178 var insertAt = document.getElementsByTagName('script')[0];
2179 if (insertAt) {
2180 insertAt.parentNode.insertBefore(script, insertAt);
2181 }
2182 else {
2183 (document.head || document.body).appendChild(script);
2184 }
2185 this.script = script;
2186
2187 var isUAgecko = 'undefined' != typeof navigator && /gecko/i.test(navigator.userAgent);
2188
2189 if (isUAgecko) {
2190 setTimeout(function () {
2191 var iframe = document.createElement('iframe');
2192 document.body.appendChild(iframe);
2193 document.body.removeChild(iframe);
2194 }, 100);
2195 }
2196};
2197
2198/**
2199 * Writes with a hidden iframe.
2200 *
2201 * @param {String} data to send
2202 * @param {Function} called upon flush.
2203 * @api private
2204 */
2205
2206JSONPPolling.prototype.doWrite = function (data, fn) {
2207 var self = this;
2208
2209 if (!this.form) {
2210 var form = document.createElement('form');
2211 var area = document.createElement('textarea');
2212 var id = this.iframeId = 'eio_iframe_' + this.index;
2213 var iframe;
2214
2215 form.className = 'socketio';
2216 form.style.position = 'absolute';
2217 form.style.top = '-1000px';
2218 form.style.left = '-1000px';
2219 form.target = id;
2220 form.method = 'POST';
2221 form.setAttribute('accept-charset', 'utf-8');
2222 area.name = 'd';
2223 form.appendChild(area);
2224 document.body.appendChild(form);
2225
2226 this.form = form;
2227 this.area = area;
2228 }
2229
2230 this.form.action = this.uri();
2231
2232 function complete () {
2233 initIframe();
2234 fn();
2235 }
2236
2237 function initIframe () {
2238 if (self.iframe) {
2239 try {
2240 self.form.removeChild(self.iframe);
2241 } catch (e) {
2242 self.onError('jsonp polling iframe removal error', e);
2243 }
2244 }
2245
2246 try {
2247 // ie6 dynamic iframes with target="" support (thanks Chris Lambacher)
2248 var html = '<iframe src="javascript:0" name="'+ self.iframeId +'">';
2249 iframe = document.createElement(html);
2250 } catch (e) {
2251 iframe = document.createElement('iframe');
2252 iframe.name = self.iframeId;
2253 iframe.src = 'javascript:0';
2254 }
2255
2256 iframe.id = self.iframeId;
2257
2258 self.form.appendChild(iframe);
2259 self.iframe = iframe;
2260 }
2261
2262 initIframe();
2263
2264 // escape \n to prevent it from being converted into \r\n by some UAs
2265 // double escaping is required for escaped new lines because unescaping of new lines can be done safely on server-side
2266 data = data.replace(rEscapedNewline, '\\\n');
2267 this.area.value = data.replace(rNewline, '\\n');
2268
2269 try {
2270 this.form.submit();
2271 } catch(e) {}
2272
2273 if (this.iframe.attachEvent) {
2274 this.iframe.onreadystatechange = function(){
2275 if (self.iframe.readyState == 'complete') {
2276 complete();
2277 }
2278 };
2279 } else {
2280 this.iframe.onload = complete;
2281 }
2282};
2283
2284}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
2285},{"11":11,"24":24}],23:[function(require,module,exports){
2286(function (global){
2287/**
2288 * Module requirements.
2289 */
2290
2291var XMLHttpRequest = require(26);
2292var Polling = require(24);
2293var Emitter = require(10);
2294var inherit = require(11);
2295var debug = require(12)('engine.io-client:polling-xhr');
2296
2297/**
2298 * Module exports.
2299 */
2300
2301module.exports = XHR;
2302module.exports.Request = Request;
2303
2304/**
2305 * Empty function
2306 */
2307
2308function empty(){}
2309
2310/**
2311 * XHR Polling constructor.
2312 *
2313 * @param {Object} opts
2314 * @api public
2315 */
2316
2317function XHR(opts){
2318 Polling.call(this, opts);
2319
2320 if (global.location) {
2321 var isSSL = 'https:' == location.protocol;
2322 var port = location.port;
2323
2324 // some user agents have empty `location.port`
2325 if (!port) {
2326 port = isSSL ? 443 : 80;
2327 }
2328
2329 this.xd = opts.hostname != global.location.hostname ||
2330 port != opts.port;
2331 this.xs = opts.secure != isSSL;
2332 } else {
2333 this.extraHeaders = opts.extraHeaders;
2334 }
2335}
2336
2337/**
2338 * Inherits from Polling.
2339 */
2340
2341inherit(XHR, Polling);
2342
2343/**
2344 * XHR supports binary
2345 */
2346
2347XHR.prototype.supportsBinary = true;
2348
2349/**
2350 * Creates a request.
2351 *
2352 * @param {String} method
2353 * @api private
2354 */
2355
2356XHR.prototype.request = function(opts){
2357 opts = opts || {};
2358 opts.uri = this.uri();
2359 opts.xd = this.xd;
2360 opts.xs = this.xs;
2361 opts.agent = this.agent || false;
2362 opts.supportsBinary = this.supportsBinary;
2363 opts.enablesXDR = this.enablesXDR;
2364
2365 // SSL options for Node.js client
2366 opts.pfx = this.pfx;
2367 opts.key = this.key;
2368 opts.passphrase = this.passphrase;
2369 opts.cert = this.cert;
2370 opts.ca = this.ca;
2371 opts.ciphers = this.ciphers;
2372 opts.rejectUnauthorized = this.rejectUnauthorized;
2373
2374 // other options for Node.js client
2375 opts.extraHeaders = this.extraHeaders;
2376
2377 return new Request(opts);
2378};
2379
2380/**
2381 * Sends data.
2382 *
2383 * @param {String} data to send.
2384 * @param {Function} called upon flush.
2385 * @api private
2386 */
2387
2388XHR.prototype.doWrite = function(data, fn){
2389 var isBinary = typeof data !== 'string' && data !== undefined;
2390 var req = this.request({ method: 'POST', data: data, isBinary: isBinary });
2391 var self = this;
2392 req.on('success', fn);
2393 req.on('error', function(err){
2394 self.onError('xhr post error', err);
2395 });
2396 this.sendXhr = req;
2397};
2398
2399/**
2400 * Starts a poll cycle.
2401 *
2402 * @api private
2403 */
2404
2405XHR.prototype.doPoll = function(){
2406 debug('xhr poll');
2407 var req = this.request();
2408 var self = this;
2409 req.on('data', function(data){
2410 self.onData(data);
2411 });
2412 req.on('error', function(err){
2413 self.onError('xhr poll error', err);
2414 });
2415 this.pollXhr = req;
2416};
2417
2418/**
2419 * Request constructor
2420 *
2421 * @param {Object} options
2422 * @api public
2423 */
2424
2425function Request(opts){
2426 this.method = opts.method || 'GET';
2427 this.uri = opts.uri;
2428 this.xd = !!opts.xd;
2429 this.xs = !!opts.xs;
2430 this.async = false !== opts.async;
2431 this.data = undefined != opts.data ? opts.data : null;
2432 this.agent = opts.agent;
2433 this.isBinary = opts.isBinary;
2434 this.supportsBinary = opts.supportsBinary;
2435 this.enablesXDR = opts.enablesXDR;
2436
2437 // SSL options for Node.js client
2438 this.pfx = opts.pfx;
2439 this.key = opts.key;
2440 this.passphrase = opts.passphrase;
2441 this.cert = opts.cert;
2442 this.ca = opts.ca;
2443 this.ciphers = opts.ciphers;
2444 this.rejectUnauthorized = opts.rejectUnauthorized;
2445
2446 // other options for Node.js client
2447 this.extraHeaders = opts.extraHeaders;
2448
2449 this.create();
2450}
2451
2452/**
2453 * Mix in `Emitter`.
2454 */
2455
2456Emitter(Request.prototype);
2457
2458/**
2459 * Creates the XHR object and sends the request.
2460 *
2461 * @api private
2462 */
2463
2464Request.prototype.create = function(){
2465 var opts = { agent: this.agent, xdomain: this.xd, xscheme: this.xs, enablesXDR: this.enablesXDR };
2466
2467 // SSL options for Node.js client
2468 opts.pfx = this.pfx;
2469 opts.key = this.key;
2470 opts.passphrase = this.passphrase;
2471 opts.cert = this.cert;
2472 opts.ca = this.ca;
2473 opts.ciphers = this.ciphers;
2474 opts.rejectUnauthorized = this.rejectUnauthorized;
2475
2476 var xhr = this.xhr = new XMLHttpRequest(opts);
2477 var self = this;
2478
2479 try {
2480 debug('xhr open %s: %s', this.method, this.uri);
2481 xhr.open(this.method, this.uri, this.async);
2482 try {
2483 if (this.extraHeaders) {
2484 xhr.setDisableHeaderCheck(true);
2485 for (var i in this.extraHeaders) {
2486 if (this.extraHeaders.hasOwnProperty(i)) {
2487 xhr.setRequestHeader(i, this.extraHeaders[i]);
2488 }
2489 }
2490 }
2491 } catch (e) {}
2492 if (this.supportsBinary) {
2493 // This has to be done after open because Firefox is stupid
2494 // http://stackoverflow.com/questions/13216903/get-binary-data-with-xmlhttprequest-in-a-firefox-extension
2495 xhr.responseType = 'arraybuffer';
2496 }
2497
2498 if ('POST' == this.method) {
2499 try {
2500 if (this.isBinary) {
2501 xhr.setRequestHeader('Content-type', 'application/octet-stream');
2502 } else {
2503 xhr.setRequestHeader('Content-type', 'text/plain;charset=UTF-8');
2504 }
2505 } catch (e) {}
2506 }
2507
2508 // ie6 check
2509 if ('withCredentials' in xhr) {
2510 xhr.withCredentials = true;
2511 }
2512
2513 if (this.hasXDR()) {
2514 xhr.onload = function(){
2515 self.onLoad();
2516 };
2517 xhr.onerror = function(){
2518 self.onError(xhr.responseText);
2519 };
2520 } else {
2521 xhr.onreadystatechange = function(){
2522 if (4 != xhr.readyState) return;
2523 if (200 == xhr.status || 1223 == xhr.status) {
2524 self.onLoad();
2525 } else {
2526 // make sure the `error` event handler that's user-set
2527 // does not throw in the same tick and gets caught here
2528 setTimeout(function(){
2529 self.onError(xhr.status);
2530 }, 0);
2531 }
2532 };
2533 }
2534
2535 debug('xhr data %s', this.data);
2536 xhr.send(this.data);
2537 } catch (e) {
2538 // Need to defer since .create() is called directly fhrom the constructor
2539 // and thus the 'error' event can only be only bound *after* this exception
2540 // occurs. Therefore, also, we cannot throw here at all.
2541 setTimeout(function() {
2542 self.onError(e);
2543 }, 0);
2544 return;
2545 }
2546
2547 if (global.document) {
2548 this.index = Request.requestsCount++;
2549 Request.requests[this.index] = this;
2550 }
2551};
2552
2553/**
2554 * Called upon successful response.
2555 *
2556 * @api private
2557 */
2558
2559Request.prototype.onSuccess = function(){
2560 this.emit('success');
2561 this.cleanup();
2562};
2563
2564/**
2565 * Called if we have data.
2566 *
2567 * @api private
2568 */
2569
2570Request.prototype.onData = function(data){
2571 this.emit('data', data);
2572 this.onSuccess();
2573};
2574
2575/**
2576 * Called upon error.
2577 *
2578 * @api private
2579 */
2580
2581Request.prototype.onError = function(err){
2582 this.emit('error', err);
2583 this.cleanup(true);
2584};
2585
2586/**
2587 * Cleans up house.
2588 *
2589 * @api private
2590 */
2591
2592Request.prototype.cleanup = function(fromError){
2593 if ('undefined' == typeof this.xhr || null === this.xhr) {
2594 return;
2595 }
2596 // xmlhttprequest
2597 if (this.hasXDR()) {
2598 this.xhr.onload = this.xhr.onerror = empty;
2599 } else {
2600 this.xhr.onreadystatechange = empty;
2601 }
2602
2603 if (fromError) {
2604 try {
2605 this.xhr.abort();
2606 } catch(e) {}
2607 }
2608
2609 if (global.document) {
2610 delete Request.requests[this.index];
2611 }
2612
2613 this.xhr = null;
2614};
2615
2616/**
2617 * Called upon load.
2618 *
2619 * @api private
2620 */
2621
2622Request.prototype.onLoad = function(){
2623 var data;
2624 try {
2625 var contentType;
2626 try {
2627 contentType = this.xhr.getResponseHeader('Content-Type').split(';')[0];
2628 } catch (e) {}
2629 if (contentType === 'application/octet-stream') {
2630 data = this.xhr.response;
2631 } else {
2632 if (!this.supportsBinary) {
2633 data = this.xhr.responseText;
2634 } else {
2635 try {
2636 data = String.fromCharCode.apply(null, new Uint8Array(this.xhr.response));
2637 } catch (e) {
2638 var ui8Arr = new Uint8Array(this.xhr.response);
2639 var dataArray = [];
2640 for (var idx = 0, length = ui8Arr.length; idx < length; idx++) {
2641 dataArray.push(ui8Arr[idx]);
2642 }
2643
2644 data = String.fromCharCode.apply(null, dataArray);
2645 }
2646 }
2647 }
2648 } catch (e) {
2649 this.onError(e);
2650 }
2651 if (null != data) {
2652 this.onData(data);
2653 }
2654};
2655
2656/**
2657 * Check if it has XDomainRequest.
2658 *
2659 * @api private
2660 */
2661
2662Request.prototype.hasXDR = function(){
2663 return 'undefined' !== typeof global.XDomainRequest && !this.xs && this.enablesXDR;
2664};
2665
2666/**
2667 * Aborts the request.
2668 *
2669 * @api public
2670 */
2671
2672Request.prototype.abort = function(){
2673 this.cleanup();
2674};
2675
2676/**
2677 * Aborts pending requests when unloading the window. This is needed to prevent
2678 * memory leaks (e.g. when using IE) and to ensure that no spurious error is
2679 * emitted.
2680 */
2681
2682if (global.document) {
2683 Request.requestsCount = 0;
2684 Request.requests = {};
2685 if (global.attachEvent) {
2686 global.attachEvent('onunload', unloadHandler);
2687 } else if (global.addEventListener) {
2688 global.addEventListener('beforeunload', unloadHandler, false);
2689 }
2690}
2691
2692function unloadHandler() {
2693 for (var i in Request.requests) {
2694 if (Request.requests.hasOwnProperty(i)) {
2695 Request.requests[i].abort();
2696 }
2697 }
2698}
2699
2700}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
2701},{"10":10,"11":11,"12":12,"24":24,"26":26}],24:[function(require,module,exports){
2702/**
2703 * Module dependencies.
2704 */
2705
2706var Transport = require(20);
2707var parseqs = require(88);
2708var parser = require(27);
2709var inherit = require(11);
2710var yeast = require(338);
2711var debug = require(12)('engine.io-client:polling');
2712
2713/**
2714 * Module exports.
2715 */
2716
2717module.exports = Polling;
2718
2719/**
2720 * Is XHR2 supported?
2721 */
2722
2723var hasXHR2 = (function() {
2724 var XMLHttpRequest = require(26);
2725 var xhr = new XMLHttpRequest({ xdomain: false });
2726 return null != xhr.responseType;
2727})();
2728
2729/**
2730 * Polling interface.
2731 *
2732 * @param {Object} opts
2733 * @api private
2734 */
2735
2736function Polling(opts){
2737 var forceBase64 = (opts && opts.forceBase64);
2738 if (!hasXHR2 || forceBase64) {
2739 this.supportsBinary = false;
2740 }
2741 Transport.call(this, opts);
2742}
2743
2744/**
2745 * Inherits from Transport.
2746 */
2747
2748inherit(Polling, Transport);
2749
2750/**
2751 * Transport name.
2752 */
2753
2754Polling.prototype.name = 'polling';
2755
2756/**
2757 * Opens the socket (triggers polling). We write a PING message to determine
2758 * when the transport is open.
2759 *
2760 * @api private
2761 */
2762
2763Polling.prototype.doOpen = function(){
2764 this.poll();
2765};
2766
2767/**
2768 * Pauses polling.
2769 *
2770 * @param {Function} callback upon buffers are flushed and transport is paused
2771 * @api private
2772 */
2773
2774Polling.prototype.pause = function(onPause){
2775 var pending = 0;
2776 var self = this;
2777
2778 this.readyState = 'pausing';
2779
2780 function pause(){
2781 debug('paused');
2782 self.readyState = 'paused';
2783 onPause();
2784 }
2785
2786 if (this.polling || !this.writable) {
2787 var total = 0;
2788
2789 if (this.polling) {
2790 debug('we are currently polling - waiting to pause');
2791 total++;
2792 this.once('pollComplete', function(){
2793 debug('pre-pause polling complete');
2794 --total || pause();
2795 });
2796 }
2797
2798 if (!this.writable) {
2799 debug('we are currently writing - waiting to pause');
2800 total++;
2801 this.once('drain', function(){
2802 debug('pre-pause writing complete');
2803 --total || pause();
2804 });
2805 }
2806 } else {
2807 pause();
2808 }
2809};
2810
2811/**
2812 * Starts polling cycle.
2813 *
2814 * @api public
2815 */
2816
2817Polling.prototype.poll = function(){
2818 debug('polling');
2819 this.polling = true;
2820 this.doPoll();
2821 this.emit('poll');
2822};
2823
2824/**
2825 * Overloads onData to detect payloads.
2826 *
2827 * @api private
2828 */
2829
2830Polling.prototype.onData = function(data){
2831 var self = this;
2832 debug('polling got data %s', data);
2833 var callback = function(packet, index, total) {
2834 // if its the first message we consider the transport open
2835 if ('opening' == self.readyState) {
2836 self.onOpen();
2837 }
2838
2839 // if its a close packet, we close the ongoing requests
2840 if ('close' == packet.type) {
2841 self.onClose();
2842 return false;
2843 }
2844
2845 // otherwise bypass onData and handle the message
2846 self.onPacket(packet);
2847 };
2848
2849 // decode payload
2850 parser.decodePayload(data, this.socket.binaryType, callback);
2851
2852 // if an event did not trigger closing
2853 if ('closed' != this.readyState) {
2854 // if we got data we're not polling
2855 this.polling = false;
2856 this.emit('pollComplete');
2857
2858 if ('open' == this.readyState) {
2859 this.poll();
2860 } else {
2861 debug('ignoring poll - transport state "%s"', this.readyState);
2862 }
2863 }
2864};
2865
2866/**
2867 * For polling, send a close packet.
2868 *
2869 * @api private
2870 */
2871
2872Polling.prototype.doClose = function(){
2873 var self = this;
2874
2875 function close(){
2876 debug('writing close packet');
2877 self.write([{ type: 'close' }]);
2878 }
2879
2880 if ('open' == this.readyState) {
2881 debug('transport open - closing');
2882 close();
2883 } else {
2884 // in case we're trying to close while
2885 // handshaking is in progress (GH-164)
2886 debug('transport not open - deferring close');
2887 this.once('open', close);
2888 }
2889};
2890
2891/**
2892 * Writes a packets payload.
2893 *
2894 * @param {Array} data packets
2895 * @param {Function} drain callback
2896 * @api private
2897 */
2898
2899Polling.prototype.write = function(packets){
2900 var self = this;
2901 this.writable = false;
2902 var callbackfn = function() {
2903 self.writable = true;
2904 self.emit('drain');
2905 };
2906
2907 var self = this;
2908 parser.encodePayload(packets, this.supportsBinary, function(data) {
2909 self.doWrite(data, callbackfn);
2910 });
2911};
2912
2913/**
2914 * Generates uri for connection.
2915 *
2916 * @api private
2917 */
2918
2919Polling.prototype.uri = function(){
2920 var query = this.query || {};
2921 var schema = this.secure ? 'https' : 'http';
2922 var port = '';
2923
2924 // cache busting is forced
2925 if (false !== this.timestampRequests) {
2926 query[this.timestampParam] = yeast();
2927 }
2928
2929 if (!this.supportsBinary && !query.sid) {
2930 query.b64 = 1;
2931 }
2932
2933 query = parseqs.encode(query);
2934
2935 // avoid port if default for schema
2936 if (this.port && (('https' == schema && this.port != 443) ||
2937 ('http' == schema && this.port != 80))) {
2938 port = ':' + this.port;
2939 }
2940
2941 // prepend ? to query
2942 if (query.length) {
2943 query = '?' + query;
2944 }
2945
2946 var ipv6 = this.hostname.indexOf(':') !== -1;
2947 return schema + '://' + (ipv6 ? '[' + this.hostname + ']' : this.hostname) + port + this.path + query;
2948};
2949
2950},{"11":11,"12":12,"20":20,"26":26,"27":27,"338":338,"88":88}],25:[function(require,module,exports){
2951(function (global){
2952/**
2953 * Module dependencies.
2954 */
2955
2956var Transport = require(20);
2957var parser = require(27);
2958var parseqs = require(88);
2959var inherit = require(11);
2960var yeast = require(338);
2961var debug = require(12)('engine.io-client:websocket');
2962var BrowserWebSocket = global.WebSocket || global.MozWebSocket;
2963
2964/**
2965 * Get either the `WebSocket` or `MozWebSocket` globals
2966 * in the browser or try to resolve WebSocket-compatible
2967 * interface exposed by `ws` for Node-like environment.
2968 */
2969
2970var WebSocket = BrowserWebSocket;
2971if (!WebSocket && typeof window === 'undefined') {
2972 try {
2973 WebSocket = require('ws');
2974 } catch (e) { }
2975}
2976
2977/**
2978 * Module exports.
2979 */
2980
2981module.exports = WS;
2982
2983/**
2984 * WebSocket transport constructor.
2985 *
2986 * @api {Object} connection options
2987 * @api public
2988 */
2989
2990function WS(opts){
2991 var forceBase64 = (opts && opts.forceBase64);
2992 if (forceBase64) {
2993 this.supportsBinary = false;
2994 }
2995 this.perMessageDeflate = opts.perMessageDeflate;
2996 Transport.call(this, opts);
2997}
2998
2999/**
3000 * Inherits from Transport.
3001 */
3002
3003inherit(WS, Transport);
3004
3005/**
3006 * Transport name.
3007 *
3008 * @api public
3009 */
3010
3011WS.prototype.name = 'websocket';
3012
3013/*
3014 * WebSockets support binary
3015 */
3016
3017WS.prototype.supportsBinary = true;
3018
3019/**
3020 * Opens socket.
3021 *
3022 * @api private
3023 */
3024
3025WS.prototype.doOpen = function(){
3026 if (!this.check()) {
3027 // let probe timeout
3028 return;
3029 }
3030
3031 var self = this;
3032 var uri = this.uri();
3033 var protocols = void(0);
3034 var opts = {
3035 agent: this.agent,
3036 perMessageDeflate: this.perMessageDeflate
3037 };
3038
3039 // SSL options for Node.js client
3040 opts.pfx = this.pfx;
3041 opts.key = this.key;
3042 opts.passphrase = this.passphrase;
3043 opts.cert = this.cert;
3044 opts.ca = this.ca;
3045 opts.ciphers = this.ciphers;
3046 opts.rejectUnauthorized = this.rejectUnauthorized;
3047 if (this.extraHeaders) {
3048 opts.headers = this.extraHeaders;
3049 }
3050
3051 this.ws = BrowserWebSocket ? new WebSocket(uri) : new WebSocket(uri, protocols, opts);
3052
3053 if (this.ws.binaryType === undefined) {
3054 this.supportsBinary = false;
3055 }
3056
3057 if (this.ws.supports && this.ws.supports.binary) {
3058 this.supportsBinary = true;
3059 this.ws.binaryType = 'buffer';
3060 } else {
3061 this.ws.binaryType = 'arraybuffer';
3062 }
3063
3064 this.addEventListeners();
3065};
3066
3067/**
3068 * Adds event listeners to the socket
3069 *
3070 * @api private
3071 */
3072
3073WS.prototype.addEventListeners = function(){
3074 var self = this;
3075
3076 this.ws.onopen = function(){
3077 self.onOpen();
3078 };
3079 this.ws.onclose = function(){
3080 self.onClose();
3081 };
3082 this.ws.onmessage = function(ev){
3083 self.onData(ev.data);
3084 };
3085 this.ws.onerror = function(e){
3086 self.onError('websocket error', e);
3087 };
3088};
3089
3090/**
3091 * Override `onData` to use a timer on iOS.
3092 * See: https://gist.github.com/mloughran/2052006
3093 *
3094 * @api private
3095 */
3096
3097if ('undefined' != typeof navigator
3098 && /iPad|iPhone|iPod/i.test(navigator.userAgent)) {
3099 WS.prototype.onData = function(data){
3100 var self = this;
3101 setTimeout(function(){
3102 Transport.prototype.onData.call(self, data);
3103 }, 0);
3104 };
3105}
3106
3107/**
3108 * Writes data to socket.
3109 *
3110 * @param {Array} array of packets.
3111 * @api private
3112 */
3113
3114WS.prototype.write = function(packets){
3115 var self = this;
3116 this.writable = false;
3117
3118 // encodePacket efficient as it uses WS framing
3119 // no need for encodePayload
3120 var total = packets.length;
3121 for (var i = 0, l = total; i < l; i++) {
3122 (function(packet) {
3123 parser.encodePacket(packet, self.supportsBinary, function(data) {
3124 if (!BrowserWebSocket) {
3125 // always create a new object (GH-437)
3126 var opts = {};
3127 if (packet.options) {
3128 opts.compress = packet.options.compress;
3129 }
3130
3131 if (self.perMessageDeflate) {
3132 var len = 'string' == typeof data ? global.Buffer.byteLength(data) : data.length;
3133 if (len < self.perMessageDeflate.threshold) {
3134 opts.compress = false;
3135 }
3136 }
3137 }
3138
3139 //Sometimes the websocket has already been closed but the browser didn't
3140 //have a chance of informing us about it yet, in that case send will
3141 //throw an error
3142 try {
3143 if (BrowserWebSocket) {
3144 // TypeError is thrown when passing the second argument on Safari
3145 self.ws.send(data);
3146 } else {
3147 self.ws.send(data, opts);
3148 }
3149 } catch (e){
3150 debug('websocket closed before onclose event');
3151 }
3152
3153 --total || done();
3154 });
3155 })(packets[i]);
3156 }
3157
3158 function done(){
3159 self.emit('flush');
3160
3161 // fake drain
3162 // defer to next tick to allow Socket to clear writeBuffer
3163 setTimeout(function(){
3164 self.writable = true;
3165 self.emit('drain');
3166 }, 0);
3167 }
3168};
3169
3170/**
3171 * Called upon close
3172 *
3173 * @api private
3174 */
3175
3176WS.prototype.onClose = function(){
3177 Transport.prototype.onClose.call(this);
3178};
3179
3180/**
3181 * Closes socket.
3182 *
3183 * @api private
3184 */
3185
3186WS.prototype.doClose = function(){
3187 if (typeof this.ws !== 'undefined') {
3188 this.ws.close();
3189 }
3190};
3191
3192/**
3193 * Generates uri for connection.
3194 *
3195 * @api private
3196 */
3197
3198WS.prototype.uri = function(){
3199 var query = this.query || {};
3200 var schema = this.secure ? 'wss' : 'ws';
3201 var port = '';
3202
3203 // avoid port if default for schema
3204 if (this.port && (('wss' == schema && this.port != 443)
3205 || ('ws' == schema && this.port != 80))) {
3206 port = ':' + this.port;
3207 }
3208
3209 // append timestamp to URI
3210 if (this.timestampRequests) {
3211 query[this.timestampParam] = yeast();
3212 }
3213
3214 // communicate binary support capabilities
3215 if (!this.supportsBinary) {
3216 query.b64 = 1;
3217 }
3218
3219 query = parseqs.encode(query);
3220
3221 // prepend ? to query
3222 if (query.length) {
3223 query = '?' + query;
3224 }
3225
3226 var ipv6 = this.hostname.indexOf(':') !== -1;
3227 return schema + '://' + (ipv6 ? '[' + this.hostname + ']' : this.hostname) + port + this.path + query;
3228};
3229
3230/**
3231 * Feature detection for WebSocket.
3232 *
3233 * @return {Boolean} whether this transport is available.
3234 * @api public
3235 */
3236
3237WS.prototype.check = function(){
3238 return !!WebSocket && !('__initialize' in WebSocket && this.name === WS.prototype.name);
3239};
3240
3241}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
3242},{"11":11,"12":12,"20":20,"27":27,"338":338,"88":88,"undefined":undefined}],26:[function(require,module,exports){
3243// browser shim for xmlhttprequest module
3244var hasCORS = require(57);
3245
3246module.exports = function(opts) {
3247 var xdomain = opts.xdomain;
3248
3249 // scheme must be same when usign XDomainRequest
3250 // http://blogs.msdn.com/b/ieinternals/archive/2010/05/13/xdomainrequest-restrictions-limitations-and-workarounds.aspx
3251 var xscheme = opts.xscheme;
3252
3253 // XDomainRequest has a flow of not sending cookie, therefore it should be disabled as a default.
3254 // https://github.com/Automattic/engine.io-client/pull/217
3255 var enablesXDR = opts.enablesXDR;
3256
3257 // XMLHttpRequest can be disabled on IE
3258 try {
3259 if ('undefined' != typeof XMLHttpRequest && (!xdomain || hasCORS)) {
3260 return new XMLHttpRequest();
3261 }
3262 } catch (e) { }
3263
3264 // Use XDomainRequest for IE8 if enablesXDR is true
3265 // because loading bar keeps flashing when using jsonp-polling
3266 // https://github.com/yujiosaka/socke.io-ie8-loading-example
3267 try {
3268 if ('undefined' != typeof XDomainRequest && !xscheme && enablesXDR) {
3269 return new XDomainRequest();
3270 }
3271 } catch (e) { }
3272
3273 if (!xdomain) {
3274 try {
3275 return new ActiveXObject('Microsoft.XMLHTTP');
3276 } catch(e) { }
3277 }
3278}
3279
3280},{"57":57}],27:[function(require,module,exports){
3281(function (global){
3282/**
3283 * Module dependencies.
3284 */
3285
3286var keys = require(28);
3287var hasBinary = require(29);
3288var sliceBuffer = require(4);
3289var base64encoder = require(6);
3290var after = require(3);
3291var utf8 = require(336);
3292
3293/**
3294 * Check if we are running an android browser. That requires us to use
3295 * ArrayBuffer with polling transports...
3296 *
3297 * http://ghinda.net/jpeg-blob-ajax-android/
3298 */
3299
3300var isAndroid = navigator.userAgent.match(/Android/i);
3301
3302/**
3303 * Check if we are running in PhantomJS.
3304 * Uploading a Blob with PhantomJS does not work correctly, as reported here:
3305 * https://github.com/ariya/phantomjs/issues/11395
3306 * @type boolean
3307 */
3308var isPhantomJS = /PhantomJS/i.test(navigator.userAgent);
3309
3310/**
3311 * When true, avoids using Blobs to encode payloads.
3312 * @type boolean
3313 */
3314var dontSendBlobs = isAndroid || isPhantomJS;
3315
3316/**
3317 * Current protocol version.
3318 */
3319
3320exports.protocol = 3;
3321
3322/**
3323 * Packet types.
3324 */
3325
3326var packets = exports.packets = {
3327 open: 0 // non-ws
3328 , close: 1 // non-ws
3329 , ping: 2
3330 , pong: 3
3331 , message: 4
3332 , upgrade: 5
3333 , noop: 6
3334};
3335
3336var packetslist = keys(packets);
3337
3338/**
3339 * Premade error packet.
3340 */
3341
3342var err = { type: 'error', data: 'parser error' };
3343
3344/**
3345 * Create a blob api even for blob builder when vendor prefixes exist
3346 */
3347
3348var Blob = require(7);
3349
3350/**
3351 * Encodes a packet.
3352 *
3353 * <packet type id> [ <data> ]
3354 *
3355 * Example:
3356 *
3357 * 5hello world
3358 * 3
3359 * 4
3360 *
3361 * Binary is encoded in an identical principle
3362 *
3363 * @api private
3364 */
3365
3366exports.encodePacket = function (packet, supportsBinary, utf8encode, callback) {
3367 if ('function' == typeof supportsBinary) {
3368 callback = supportsBinary;
3369 supportsBinary = false;
3370 }
3371
3372 if ('function' == typeof utf8encode) {
3373 callback = utf8encode;
3374 utf8encode = null;
3375 }
3376
3377 var data = (packet.data === undefined)
3378 ? undefined
3379 : packet.data.buffer || packet.data;
3380
3381 if (global.ArrayBuffer && data instanceof ArrayBuffer) {
3382 return encodeArrayBuffer(packet, supportsBinary, callback);
3383 } else if (Blob && data instanceof global.Blob) {
3384 return encodeBlob(packet, supportsBinary, callback);
3385 }
3386
3387 // might be an object with { base64: true, data: dataAsBase64String }
3388 if (data && data.base64) {
3389 return encodeBase64Object(packet, callback);
3390 }
3391
3392 // Sending data as a utf-8 string
3393 var encoded = packets[packet.type];
3394
3395 // data fragment is optional
3396 if (undefined !== packet.data) {
3397 encoded += utf8encode ? utf8.encode(String(packet.data)) : String(packet.data);
3398 }
3399
3400 return callback('' + encoded);
3401
3402};
3403
3404function encodeBase64Object(packet, callback) {
3405 // packet data is an object { base64: true, data: dataAsBase64String }
3406 var message = 'b' + exports.packets[packet.type] + packet.data.data;
3407 return callback(message);
3408}
3409
3410/**
3411 * Encode packet helpers for binary types
3412 */
3413
3414function encodeArrayBuffer(packet, supportsBinary, callback) {
3415 if (!supportsBinary) {
3416 return exports.encodeBase64Packet(packet, callback);
3417 }
3418
3419 var data = packet.data;
3420 var contentArray = new Uint8Array(data);
3421 var resultBuffer = new Uint8Array(1 + data.byteLength);
3422
3423 resultBuffer[0] = packets[packet.type];
3424 for (var i = 0; i < contentArray.length; i++) {
3425 resultBuffer[i+1] = contentArray[i];
3426 }
3427
3428 return callback(resultBuffer.buffer);
3429}
3430
3431function encodeBlobAsArrayBuffer(packet, supportsBinary, callback) {
3432 if (!supportsBinary) {
3433 return exports.encodeBase64Packet(packet, callback);
3434 }
3435
3436 var fr = new FileReader();
3437 fr.onload = function() {
3438 packet.data = fr.result;
3439 exports.encodePacket(packet, supportsBinary, true, callback);
3440 };
3441 return fr.readAsArrayBuffer(packet.data);
3442}
3443
3444function encodeBlob(packet, supportsBinary, callback) {
3445 if (!supportsBinary) {
3446 return exports.encodeBase64Packet(packet, callback);
3447 }
3448
3449 if (dontSendBlobs) {
3450 return encodeBlobAsArrayBuffer(packet, supportsBinary, callback);
3451 }
3452
3453 var length = new Uint8Array(1);
3454 length[0] = packets[packet.type];
3455 var blob = new Blob([length.buffer, packet.data]);
3456
3457 return callback(blob);
3458}
3459
3460/**
3461 * Encodes a packet with binary data in a base64 string
3462 *
3463 * @param {Object} packet, has `type` and `data`
3464 * @return {String} base64 encoded message
3465 */
3466
3467exports.encodeBase64Packet = function(packet, callback) {
3468 var message = 'b' + exports.packets[packet.type];
3469 if (Blob && packet.data instanceof global.Blob) {
3470 var fr = new FileReader();
3471 fr.onload = function() {
3472 var b64 = fr.result.split(',')[1];
3473 callback(message + b64);
3474 };
3475 return fr.readAsDataURL(packet.data);
3476 }
3477
3478 var b64data;
3479 try {
3480 b64data = String.fromCharCode.apply(null, new Uint8Array(packet.data));
3481 } catch (e) {
3482 // iPhone Safari doesn't let you apply with typed arrays
3483 var typed = new Uint8Array(packet.data);
3484 var basic = new Array(typed.length);
3485 for (var i = 0; i < typed.length; i++) {
3486 basic[i] = typed[i];
3487 }
3488 b64data = String.fromCharCode.apply(null, basic);
3489 }
3490 message += global.btoa(b64data);
3491 return callback(message);
3492};
3493
3494/**
3495 * Decodes a packet. Changes format to Blob if requested.
3496 *
3497 * @return {Object} with `type` and `data` (if any)
3498 * @api private
3499 */
3500
3501exports.decodePacket = function (data, binaryType, utf8decode) {
3502 // String data
3503 if (typeof data == 'string' || data === undefined) {
3504 if (data.charAt(0) == 'b') {
3505 return exports.decodeBase64Packet(data.substr(1), binaryType);
3506 }
3507
3508 if (utf8decode) {
3509 try {
3510 data = utf8.decode(data);
3511 } catch (e) {
3512 return err;
3513 }
3514 }
3515 var type = data.charAt(0);
3516
3517 if (Number(type) != type || !packetslist[type]) {
3518 return err;
3519 }
3520
3521 if (data.length > 1) {
3522 return { type: packetslist[type], data: data.substring(1) };
3523 } else {
3524 return { type: packetslist[type] };
3525 }
3526 }
3527
3528 var asArray = new Uint8Array(data);
3529 var type = asArray[0];
3530 var rest = sliceBuffer(data, 1);
3531 if (Blob && binaryType === 'blob') {
3532 rest = new Blob([rest]);
3533 }
3534 return { type: packetslist[type], data: rest };
3535};
3536
3537/**
3538 * Decodes a packet encoded in a base64 string
3539 *
3540 * @param {String} base64 encoded message
3541 * @return {Object} with `type` and `data` (if any)
3542 */
3543
3544exports.decodeBase64Packet = function(msg, binaryType) {
3545 var type = packetslist[msg.charAt(0)];
3546 if (!global.ArrayBuffer) {
3547 return { type: type, data: { base64: true, data: msg.substr(1) } };
3548 }
3549
3550 var data = base64encoder.decode(msg.substr(1));
3551
3552 if (binaryType === 'blob' && Blob) {
3553 data = new Blob([data]);
3554 }
3555
3556 return { type: type, data: data };
3557};
3558
3559/**
3560 * Encodes multiple messages (payload).
3561 *
3562 * <length>:data
3563 *
3564 * Example:
3565 *
3566 * 11:hello world2:hi
3567 *
3568 * If any contents are binary, they will be encoded as base64 strings. Base64
3569 * encoded strings are marked with a b before the length specifier
3570 *
3571 * @param {Array} packets
3572 * @api private
3573 */
3574
3575exports.encodePayload = function (packets, supportsBinary, callback) {
3576 if (typeof supportsBinary == 'function') {
3577 callback = supportsBinary;
3578 supportsBinary = null;
3579 }
3580
3581 var isBinary = hasBinary(packets);
3582
3583 if (supportsBinary && isBinary) {
3584 if (Blob && !dontSendBlobs) {
3585 return exports.encodePayloadAsBlob(packets, callback);
3586 }
3587
3588 return exports.encodePayloadAsArrayBuffer(packets, callback);
3589 }
3590
3591 if (!packets.length) {
3592 return callback('0:');
3593 }
3594
3595 function setLengthHeader(message) {
3596 return message.length + ':' + message;
3597 }
3598
3599 function encodeOne(packet, doneCallback) {
3600 exports.encodePacket(packet, !isBinary ? false : supportsBinary, true, function(message) {
3601 doneCallback(null, setLengthHeader(message));
3602 });
3603 }
3604
3605 map(packets, encodeOne, function(err, results) {
3606 return callback(results.join(''));
3607 });
3608};
3609
3610/**
3611 * Async array map using after
3612 */
3613
3614function map(ary, each, done) {
3615 var result = new Array(ary.length);
3616 var next = after(ary.length, done);
3617
3618 var eachWithIndex = function(i, el, cb) {
3619 each(el, function(error, msg) {
3620 result[i] = msg;
3621 cb(error, result);
3622 });
3623 };
3624
3625 for (var i = 0; i < ary.length; i++) {
3626 eachWithIndex(i, ary[i], next);
3627 }
3628}
3629
3630/*
3631 * Decodes data when a payload is maybe expected. Possible binary contents are
3632 * decoded from their base64 representation
3633 *
3634 * @param {String} data, callback method
3635 * @api public
3636 */
3637
3638exports.decodePayload = function (data, binaryType, callback) {
3639 if (typeof data != 'string') {
3640 return exports.decodePayloadAsBinary(data, binaryType, callback);
3641 }
3642
3643 if (typeof binaryType === 'function') {
3644 callback = binaryType;
3645 binaryType = null;
3646 }
3647
3648 var packet;
3649 if (data == '') {
3650 // parser error - ignoring payload
3651 return callback(err, 0, 1);
3652 }
3653
3654 var length = ''
3655 , n, msg;
3656
3657 for (var i = 0, l = data.length; i < l; i++) {
3658 var chr = data.charAt(i);
3659
3660 if (':' != chr) {
3661 length += chr;
3662 } else {
3663 if ('' == length || (length != (n = Number(length)))) {
3664 // parser error - ignoring payload
3665 return callback(err, 0, 1);
3666 }
3667
3668 msg = data.substr(i + 1, n);
3669
3670 if (length != msg.length) {
3671 // parser error - ignoring payload
3672 return callback(err, 0, 1);
3673 }
3674
3675 if (msg.length) {
3676 packet = exports.decodePacket(msg, binaryType, true);
3677
3678 if (err.type == packet.type && err.data == packet.data) {
3679 // parser error in individual packet - ignoring payload
3680 return callback(err, 0, 1);
3681 }
3682
3683 var ret = callback(packet, i + n, l);
3684 if (false === ret) return;
3685 }
3686
3687 // advance cursor
3688 i += n;
3689 length = '';
3690 }
3691 }
3692
3693 if (length != '') {
3694 // parser error - ignoring payload
3695 return callback(err, 0, 1);
3696 }
3697
3698};
3699
3700/**
3701 * Encodes multiple messages (payload) as binary.
3702 *
3703 * <1 = binary, 0 = string><number from 0-9><number from 0-9>[...]<number
3704 * 255><data>
3705 *
3706 * Example:
3707 * 1 3 255 1 2 3, if the binary contents are interpreted as 8 bit integers
3708 *
3709 * @param {Array} packets
3710 * @return {ArrayBuffer} encoded payload
3711 * @api private
3712 */
3713
3714exports.encodePayloadAsArrayBuffer = function(packets, callback) {
3715 if (!packets.length) {
3716 return callback(new ArrayBuffer(0));
3717 }
3718
3719 function encodeOne(packet, doneCallback) {
3720 exports.encodePacket(packet, true, true, function(data) {
3721 return doneCallback(null, data);
3722 });
3723 }
3724
3725 map(packets, encodeOne, function(err, encodedPackets) {
3726 var totalLength = encodedPackets.reduce(function(acc, p) {
3727 var len;
3728 if (typeof p === 'string'){
3729 len = p.length;
3730 } else {
3731 len = p.byteLength;
3732 }
3733 return acc + len.toString().length + len + 2; // string/binary identifier + separator = 2
3734 }, 0);
3735
3736 var resultArray = new Uint8Array(totalLength);
3737
3738 var bufferIndex = 0;
3739 encodedPackets.forEach(function(p) {
3740 var isString = typeof p === 'string';
3741 var ab = p;
3742 if (isString) {
3743 var view = new Uint8Array(p.length);
3744 for (var i = 0; i < p.length; i++) {
3745 view[i] = p.charCodeAt(i);
3746 }
3747 ab = view.buffer;
3748 }
3749
3750 if (isString) { // not true binary
3751 resultArray[bufferIndex++] = 0;
3752 } else { // true binary
3753 resultArray[bufferIndex++] = 1;
3754 }
3755
3756 var lenStr = ab.byteLength.toString();
3757 for (var i = 0; i < lenStr.length; i++) {
3758 resultArray[bufferIndex++] = parseInt(lenStr[i]);
3759 }
3760 resultArray[bufferIndex++] = 255;
3761
3762 var view = new Uint8Array(ab);
3763 for (var i = 0; i < view.length; i++) {
3764 resultArray[bufferIndex++] = view[i];
3765 }
3766 });
3767
3768 return callback(resultArray.buffer);
3769 });
3770};
3771
3772/**
3773 * Encode as Blob
3774 */
3775
3776exports.encodePayloadAsBlob = function(packets, callback) {
3777 function encodeOne(packet, doneCallback) {
3778 exports.encodePacket(packet, true, true, function(encoded) {
3779 var binaryIdentifier = new Uint8Array(1);
3780 binaryIdentifier[0] = 1;
3781 if (typeof encoded === 'string') {
3782 var view = new Uint8Array(encoded.length);
3783 for (var i = 0; i < encoded.length; i++) {
3784 view[i] = encoded.charCodeAt(i);
3785 }
3786 encoded = view.buffer;
3787 binaryIdentifier[0] = 0;
3788 }
3789
3790 var len = (encoded instanceof ArrayBuffer)
3791 ? encoded.byteLength
3792 : encoded.size;
3793
3794 var lenStr = len.toString();
3795 var lengthAry = new Uint8Array(lenStr.length + 1);
3796 for (var i = 0; i < lenStr.length; i++) {
3797 lengthAry[i] = parseInt(lenStr[i]);
3798 }
3799 lengthAry[lenStr.length] = 255;
3800
3801 if (Blob) {
3802 var blob = new Blob([binaryIdentifier.buffer, lengthAry.buffer, encoded]);
3803 doneCallback(null, blob);
3804 }
3805 });
3806 }
3807
3808 map(packets, encodeOne, function(err, results) {
3809 return callback(new Blob(results));
3810 });
3811};
3812
3813/*
3814 * Decodes data when a payload is maybe expected. Strings are decoded by
3815 * interpreting each byte as a key code for entries marked to start with 0. See
3816 * description of encodePayloadAsBinary
3817 *
3818 * @param {ArrayBuffer} data, callback method
3819 * @api public
3820 */
3821
3822exports.decodePayloadAsBinary = function (data, binaryType, callback) {
3823 if (typeof binaryType === 'function') {
3824 callback = binaryType;
3825 binaryType = null;
3826 }
3827
3828 var bufferTail = data;
3829 var buffers = [];
3830
3831 var numberTooLong = false;
3832 while (bufferTail.byteLength > 0) {
3833 var tailArray = new Uint8Array(bufferTail);
3834 var isString = tailArray[0] === 0;
3835 var msgLength = '';
3836
3837 for (var i = 1; ; i++) {
3838 if (tailArray[i] == 255) break;
3839
3840 if (msgLength.length > 310) {
3841 numberTooLong = true;
3842 break;
3843 }
3844
3845 msgLength += tailArray[i];
3846 }
3847
3848 if(numberTooLong) return callback(err, 0, 1);
3849
3850 bufferTail = sliceBuffer(bufferTail, 2 + msgLength.length);
3851 msgLength = parseInt(msgLength);
3852
3853 var msg = sliceBuffer(bufferTail, 0, msgLength);
3854 if (isString) {
3855 try {
3856 msg = String.fromCharCode.apply(null, new Uint8Array(msg));
3857 } catch (e) {
3858 // iPhone Safari doesn't let you apply to typed arrays
3859 var typed = new Uint8Array(msg);
3860 msg = '';
3861 for (var i = 0; i < typed.length; i++) {
3862 msg += String.fromCharCode(typed[i]);
3863 }
3864 }
3865 }
3866
3867 buffers.push(msg);
3868 bufferTail = sliceBuffer(bufferTail, msgLength);
3869 }
3870
3871 var total = buffers.length;
3872 buffers.forEach(function(buffer, i) {
3873 callback(exports.decodePacket(buffer, binaryType, true), i, total);
3874 });
3875};
3876
3877}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
3878},{"28":28,"29":29,"3":3,"336":336,"4":4,"6":6,"7":7}],28:[function(require,module,exports){
3879
3880/**
3881 * Gets the keys for an object.
3882 *
3883 * @return {Array} keys
3884 * @api private
3885 */
3886
3887module.exports = Object.keys || function keys (obj){
3888 var arr = [];
3889 var has = Object.prototype.hasOwnProperty;
3890
3891 for (var i in obj) {
3892 if (has.call(obj, i)) {
3893 arr.push(i);
3894 }
3895 }
3896 return arr;
3897};
3898
3899},{}],29:[function(require,module,exports){
3900(function (global){
3901
3902/*
3903 * Module requirements.
3904 */
3905
3906var isArray = require(82);
3907
3908/**
3909 * Module exports.
3910 */
3911
3912module.exports = hasBinary;
3913
3914/**
3915 * Checks for binary data.
3916 *
3917 * Right now only Buffer and ArrayBuffer are supported..
3918 *
3919 * @param {Object} anything
3920 * @api public
3921 */
3922
3923function hasBinary(data) {
3924
3925 function _hasBinary(obj) {
3926 if (!obj) return false;
3927
3928 if ( (global.Buffer && global.Buffer.isBuffer(obj)) ||
3929 (global.ArrayBuffer && obj instanceof ArrayBuffer) ||
3930 (global.Blob && obj instanceof Blob) ||
3931 (global.File && obj instanceof File)
3932 ) {
3933 return true;
3934 }
3935
3936 if (isArray(obj)) {
3937 for (var i = 0; i < obj.length; i++) {
3938 if (_hasBinary(obj[i])) {
3939 return true;
3940 }
3941 }
3942 } else if (obj && 'object' == typeof obj) {
3943 if (obj.toJSON) {
3944 obj = obj.toJSON();
3945 }
3946
3947 for (var key in obj) {
3948 if (Object.prototype.hasOwnProperty.call(obj, key) && _hasBinary(obj[key])) {
3949 return true;
3950 }
3951 }
3952 }
3953
3954 return false;
3955 }
3956
3957 return _hasBinary(data);
3958}
3959
3960}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
3961},{"82":82}],30:[function(require,module,exports){
3962(function (process){
3963'use strict';
3964
3965/**
3966 * Copyright (c) 2013-present, Facebook, Inc.
3967 *
3968 * Licensed under the Apache License, Version 2.0 (the "License");
3969 * you may not use this file except in compliance with the License.
3970 * You may obtain a copy of the License at
3971 *
3972 * http://www.apache.org/licenses/LICENSE-2.0
3973 *
3974 * Unless required by applicable law or agreed to in writing, software
3975 * distributed under the License is distributed on an "AS IS" BASIS,
3976 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3977 * See the License for the specific language governing permissions and
3978 * limitations under the License.
3979 *
3980 * @typechecks
3981 */
3982
3983var emptyFunction = require(37);
3984
3985/**
3986 * Upstream version of event listener. Does not take into account specific
3987 * nature of platform.
3988 */
3989var EventListener = {
3990 /**
3991 * Listen to DOM events during the bubble phase.
3992 *
3993 * @param {DOMEventTarget} target DOM element to register listener on.
3994 * @param {string} eventType Event type, e.g. 'click' or 'mouseover'.
3995 * @param {function} callback Callback function.
3996 * @return {object} Object with a `remove` method.
3997 */
3998 listen: function (target, eventType, callback) {
3999 if (target.addEventListener) {
4000 target.addEventListener(eventType, callback, false);
4001 return {
4002 remove: function () {
4003 target.removeEventListener(eventType, callback, false);
4004 }
4005 };
4006 } else if (target.attachEvent) {
4007 target.attachEvent('on' + eventType, callback);
4008 return {
4009 remove: function () {
4010 target.detachEvent('on' + eventType, callback);
4011 }
4012 };
4013 }
4014 },
4015
4016 /**
4017 * Listen to DOM events during the capture phase.
4018 *
4019 * @param {DOMEventTarget} target DOM element to register listener on.
4020 * @param {string} eventType Event type, e.g. 'click' or 'mouseover'.
4021 * @param {function} callback Callback function.
4022 * @return {object} Object with a `remove` method.
4023 */
4024 capture: function (target, eventType, callback) {
4025 if (target.addEventListener) {
4026 target.addEventListener(eventType, callback, true);
4027 return {
4028 remove: function () {
4029 target.removeEventListener(eventType, callback, true);
4030 }
4031 };
4032 } else {
4033 if (process.env.NODE_ENV !== 'production') {
4034 console.error('Attempted to listen to events during the capture phase on a ' + 'browser that does not support the capture phase. Your application ' + 'will not receive some events.');
4035 }
4036 return {
4037 remove: emptyFunction
4038 };
4039 }
4040 },
4041
4042 registerDefault: function () {}
4043};
4044
4045module.exports = EventListener;
4046}).call(this,require(91))
4047},{"37":37,"91":91}],31:[function(require,module,exports){
4048/**
4049 * Copyright (c) 2013-present, Facebook, Inc.
4050 * All rights reserved.
4051 *
4052 * This source code is licensed under the BSD-style license found in the
4053 * LICENSE file in the root directory of this source tree. An additional grant
4054 * of patent rights can be found in the PATENTS file in the same directory.
4055 *
4056 */
4057
4058'use strict';
4059
4060var canUseDOM = !!(typeof window !== 'undefined' && window.document && window.document.createElement);
4061
4062/**
4063 * Simple, lightweight module assisting with the detection and context of
4064 * Worker. Helps avoid circular dependencies and allows code to reason about
4065 * whether or not they are in a Worker, even if they never include the main
4066 * `ReactWorker` dependency.
4067 */
4068var ExecutionEnvironment = {
4069
4070 canUseDOM: canUseDOM,
4071
4072 canUseWorkers: typeof Worker !== 'undefined',
4073
4074 canUseEventListeners: canUseDOM && !!(window.addEventListener || window.attachEvent),
4075
4076 canUseViewport: canUseDOM && !!window.screen,
4077
4078 isInWorker: !canUseDOM // For now, this is true - might change in the future.
4079
4080};
4081
4082module.exports = ExecutionEnvironment;
4083},{}],32:[function(require,module,exports){
4084"use strict";
4085
4086/**
4087 * Copyright (c) 2013-present, Facebook, Inc.
4088 * All rights reserved.
4089 *
4090 * This source code is licensed under the BSD-style license found in the
4091 * LICENSE file in the root directory of this source tree. An additional grant
4092 * of patent rights can be found in the PATENTS file in the same directory.
4093 *
4094 * @typechecks
4095 */
4096
4097var _hyphenPattern = /-(.)/g;
4098
4099/**
4100 * Camelcases a hyphenated string, for example:
4101 *
4102 * > camelize('background-color')
4103 * < "backgroundColor"
4104 *
4105 * @param {string} string
4106 * @return {string}
4107 */
4108function camelize(string) {
4109 return string.replace(_hyphenPattern, function (_, character) {
4110 return character.toUpperCase();
4111 });
4112}
4113
4114module.exports = camelize;
4115},{}],33:[function(require,module,exports){
4116/**
4117 * Copyright (c) 2013-present, Facebook, Inc.
4118 * All rights reserved.
4119 *
4120 * This source code is licensed under the BSD-style license found in the
4121 * LICENSE file in the root directory of this source tree. An additional grant
4122 * of patent rights can be found in the PATENTS file in the same directory.
4123 *
4124 * @typechecks
4125 */
4126
4127'use strict';
4128
4129var camelize = require(32);
4130
4131var msPattern = /^-ms-/;
4132
4133/**
4134 * Camelcases a hyphenated CSS property name, for example:
4135 *
4136 * > camelizeStyleName('background-color')
4137 * < "backgroundColor"
4138 * > camelizeStyleName('-moz-transition')
4139 * < "MozTransition"
4140 * > camelizeStyleName('-ms-transition')
4141 * < "msTransition"
4142 *
4143 * As Andi Smith suggests
4144 * (http://www.andismith.com/blog/2012/02/modernizr-prefixed/), an `-ms` prefix
4145 * is converted to lowercase `ms`.
4146 *
4147 * @param {string} string
4148 * @return {string}
4149 */
4150function camelizeStyleName(string) {
4151 return camelize(string.replace(msPattern, 'ms-'));
4152}
4153
4154module.exports = camelizeStyleName;
4155},{"32":32}],34:[function(require,module,exports){
4156'use strict';
4157
4158/**
4159 * Copyright (c) 2013-present, Facebook, Inc.
4160 * All rights reserved.
4161 *
4162 * This source code is licensed under the BSD-style license found in the
4163 * LICENSE file in the root directory of this source tree. An additional grant
4164 * of patent rights can be found in the PATENTS file in the same directory.
4165 *
4166 * @typechecks
4167 */
4168
4169var isTextNode = require(47);
4170
4171/*eslint-disable no-bitwise */
4172
4173/**
4174 * Checks if a given DOM node contains or is another DOM node.
4175 *
4176 * @param {?DOMNode} outerNode Outer DOM node.
4177 * @param {?DOMNode} innerNode Inner DOM node.
4178 * @return {boolean} True if `outerNode` contains or is `innerNode`.
4179 */
4180function containsNode(outerNode, innerNode) {
4181 if (!outerNode || !innerNode) {
4182 return false;
4183 } else if (outerNode === innerNode) {
4184 return true;
4185 } else if (isTextNode(outerNode)) {
4186 return false;
4187 } else if (isTextNode(innerNode)) {
4188 return containsNode(outerNode, innerNode.parentNode);
4189 } else if (outerNode.contains) {
4190 return outerNode.contains(innerNode);
4191 } else if (outerNode.compareDocumentPosition) {
4192 return !!(outerNode.compareDocumentPosition(innerNode) & 16);
4193 } else {
4194 return false;
4195 }
4196}
4197
4198module.exports = containsNode;
4199},{"47":47}],35:[function(require,module,exports){
4200(function (process){
4201'use strict';
4202
4203/**
4204 * Copyright (c) 2013-present, Facebook, Inc.
4205 * All rights reserved.
4206 *
4207 * This source code is licensed under the BSD-style license found in the
4208 * LICENSE file in the root directory of this source tree. An additional grant
4209 * of patent rights can be found in the PATENTS file in the same directory.
4210 *
4211 * @typechecks
4212 */
4213
4214var invariant = require(45);
4215
4216/**
4217 * Convert array-like objects to arrays.
4218 *
4219 * This API assumes the caller knows the contents of the data type. For less
4220 * well defined inputs use createArrayFromMixed.
4221 *
4222 * @param {object|function|filelist} obj
4223 * @return {array}
4224 */
4225function toArray(obj) {
4226 var length = obj.length;
4227
4228 // Some browsers builtin objects can report typeof 'function' (e.g. NodeList
4229 // in old versions of Safari).
4230 !(!Array.isArray(obj) && (typeof obj === 'object' || typeof obj === 'function')) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'toArray: Array-like object expected') : invariant(false) : void 0;
4231
4232 !(typeof length === 'number') ? process.env.NODE_ENV !== 'production' ? invariant(false, 'toArray: Object needs a length property') : invariant(false) : void 0;
4233
4234 !(length === 0 || length - 1 in obj) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'toArray: Object should have keys for indices') : invariant(false) : void 0;
4235
4236 !(typeof obj.callee !== 'function') ? process.env.NODE_ENV !== 'production' ? invariant(false, 'toArray: Object can\'t be `arguments`. Use rest params ' + '(function(...args) {}) or Array.from() instead.') : invariant(false) : void 0;
4237
4238 // Old IE doesn't give collections access to hasOwnProperty. Assume inputs
4239 // without method will throw during the slice call and skip straight to the
4240 // fallback.
4241 if (obj.hasOwnProperty) {
4242 try {
4243 return Array.prototype.slice.call(obj);
4244 } catch (e) {
4245 // IE < 9 does not support Array#slice on collections objects
4246 }
4247 }
4248
4249 // Fall back to copying key by key. This assumes all keys have a value,
4250 // so will not preserve sparsely populated inputs.
4251 var ret = Array(length);
4252 for (var ii = 0; ii < length; ii++) {
4253 ret[ii] = obj[ii];
4254 }
4255 return ret;
4256}
4257
4258/**
4259 * Perform a heuristic test to determine if an object is "array-like".
4260 *
4261 * A monk asked Joshu, a Zen master, "Has a dog Buddha nature?"
4262 * Joshu replied: "Mu."
4263 *
4264 * This function determines if its argument has "array nature": it returns
4265 * true if the argument is an actual array, an `arguments' object, or an
4266 * HTMLCollection (e.g. node.childNodes or node.getElementsByTagName()).
4267 *
4268 * It will return false for other array-like objects like Filelist.
4269 *
4270 * @param {*} obj
4271 * @return {boolean}
4272 */
4273function hasArrayNature(obj) {
4274 return(
4275 // not null/false
4276 !!obj && (
4277 // arrays are objects, NodeLists are functions in Safari
4278 typeof obj == 'object' || typeof obj == 'function') &&
4279 // quacks like an array
4280 'length' in obj &&
4281 // not window
4282 !('setInterval' in obj) &&
4283 // no DOM node should be considered an array-like
4284 // a 'select' element has 'length' and 'item' properties on IE8
4285 typeof obj.nodeType != 'number' && (
4286 // a real array
4287 Array.isArray(obj) ||
4288 // arguments
4289 'callee' in obj ||
4290 // HTMLCollection/NodeList
4291 'item' in obj)
4292 );
4293}
4294
4295/**
4296 * Ensure that the argument is an array by wrapping it in an array if it is not.
4297 * Creates a copy of the argument if it is already an array.
4298 *
4299 * This is mostly useful idiomatically:
4300 *
4301 * var createArrayFromMixed = require('createArrayFromMixed');
4302 *
4303 * function takesOneOrMoreThings(things) {
4304 * things = createArrayFromMixed(things);
4305 * ...
4306 * }
4307 *
4308 * This allows you to treat `things' as an array, but accept scalars in the API.
4309 *
4310 * If you need to convert an array-like object, like `arguments`, into an array
4311 * use toArray instead.
4312 *
4313 * @param {*} obj
4314 * @return {array}
4315 */
4316function createArrayFromMixed(obj) {
4317 if (!hasArrayNature(obj)) {
4318 return [obj];
4319 } else if (Array.isArray(obj)) {
4320 return obj.slice();
4321 } else {
4322 return toArray(obj);
4323 }
4324}
4325
4326module.exports = createArrayFromMixed;
4327}).call(this,require(91))
4328},{"45":45,"91":91}],36:[function(require,module,exports){
4329(function (process){
4330'use strict';
4331
4332/**
4333 * Copyright (c) 2013-present, Facebook, Inc.
4334 * All rights reserved.
4335 *
4336 * This source code is licensed under the BSD-style license found in the
4337 * LICENSE file in the root directory of this source tree. An additional grant
4338 * of patent rights can be found in the PATENTS file in the same directory.
4339 *
4340 * @typechecks
4341 */
4342
4343/*eslint-disable fb-www/unsafe-html*/
4344
4345var ExecutionEnvironment = require(31);
4346
4347var createArrayFromMixed = require(35);
4348var getMarkupWrap = require(41);
4349var invariant = require(45);
4350
4351/**
4352 * Dummy container used to render all markup.
4353 */
4354var dummyNode = ExecutionEnvironment.canUseDOM ? document.createElement('div') : null;
4355
4356/**
4357 * Pattern used by `getNodeName`.
4358 */
4359var nodeNamePattern = /^\s*<(\w+)/;
4360
4361/**
4362 * Extracts the `nodeName` of the first element in a string of markup.
4363 *
4364 * @param {string} markup String of markup.
4365 * @return {?string} Node name of the supplied markup.
4366 */
4367function getNodeName(markup) {
4368 var nodeNameMatch = markup.match(nodeNamePattern);
4369 return nodeNameMatch && nodeNameMatch[1].toLowerCase();
4370}
4371
4372/**
4373 * Creates an array containing the nodes rendered from the supplied markup. The
4374 * optionally supplied `handleScript` function will be invoked once for each
4375 * <script> element that is rendered. If no `handleScript` function is supplied,
4376 * an exception is thrown if any <script> elements are rendered.
4377 *
4378 * @param {string} markup A string of valid HTML markup.
4379 * @param {?function} handleScript Invoked once for each rendered <script>.
4380 * @return {array<DOMElement|DOMTextNode>} An array of rendered nodes.
4381 */
4382function createNodesFromMarkup(markup, handleScript) {
4383 var node = dummyNode;
4384 !!!dummyNode ? process.env.NODE_ENV !== 'production' ? invariant(false, 'createNodesFromMarkup dummy not initialized') : invariant(false) : void 0;
4385 var nodeName = getNodeName(markup);
4386
4387 var wrap = nodeName && getMarkupWrap(nodeName);
4388 if (wrap) {
4389 node.innerHTML = wrap[1] + markup + wrap[2];
4390
4391 var wrapDepth = wrap[0];
4392 while (wrapDepth--) {
4393 node = node.lastChild;
4394 }
4395 } else {
4396 node.innerHTML = markup;
4397 }
4398
4399 var scripts = node.getElementsByTagName('script');
4400 if (scripts.length) {
4401 !handleScript ? process.env.NODE_ENV !== 'production' ? invariant(false, 'createNodesFromMarkup(...): Unexpected <script> element rendered.') : invariant(false) : void 0;
4402 createArrayFromMixed(scripts).forEach(handleScript);
4403 }
4404
4405 var nodes = Array.from(node.childNodes);
4406 while (node.lastChild) {
4407 node.removeChild(node.lastChild);
4408 }
4409 return nodes;
4410}
4411
4412module.exports = createNodesFromMarkup;
4413}).call(this,require(91))
4414},{"31":31,"35":35,"41":41,"45":45,"91":91}],37:[function(require,module,exports){
4415"use strict";
4416
4417/**
4418 * Copyright (c) 2013-present, Facebook, Inc.
4419 * All rights reserved.
4420 *
4421 * This source code is licensed under the BSD-style license found in the
4422 * LICENSE file in the root directory of this source tree. An additional grant
4423 * of patent rights can be found in the PATENTS file in the same directory.
4424 *
4425 */
4426
4427function makeEmptyFunction(arg) {
4428 return function () {
4429 return arg;
4430 };
4431}
4432
4433/**
4434 * This function accepts and discards inputs; it has no side effects. This is
4435 * primarily useful idiomatically for overridable function endpoints which
4436 * always need to be callable, since JS lacks a null-call idiom ala Cocoa.
4437 */
4438function emptyFunction() {}
4439
4440emptyFunction.thatReturns = makeEmptyFunction;
4441emptyFunction.thatReturnsFalse = makeEmptyFunction(false);
4442emptyFunction.thatReturnsTrue = makeEmptyFunction(true);
4443emptyFunction.thatReturnsNull = makeEmptyFunction(null);
4444emptyFunction.thatReturnsThis = function () {
4445 return this;
4446};
4447emptyFunction.thatReturnsArgument = function (arg) {
4448 return arg;
4449};
4450
4451module.exports = emptyFunction;
4452},{}],38:[function(require,module,exports){
4453(function (process){
4454/**
4455 * Copyright (c) 2013-present, Facebook, Inc.
4456 * All rights reserved.
4457 *
4458 * This source code is licensed under the BSD-style license found in the
4459 * LICENSE file in the root directory of this source tree. An additional grant
4460 * of patent rights can be found in the PATENTS file in the same directory.
4461 *
4462 */
4463
4464'use strict';
4465
4466var emptyObject = {};
4467
4468if (process.env.NODE_ENV !== 'production') {
4469 Object.freeze(emptyObject);
4470}
4471
4472module.exports = emptyObject;
4473}).call(this,require(91))
4474},{"91":91}],39:[function(require,module,exports){
4475/**
4476 * Copyright (c) 2013-present, Facebook, Inc.
4477 * All rights reserved.
4478 *
4479 * This source code is licensed under the BSD-style license found in the
4480 * LICENSE file in the root directory of this source tree. An additional grant
4481 * of patent rights can be found in the PATENTS file in the same directory.
4482 *
4483 */
4484
4485'use strict';
4486
4487/**
4488 * @param {DOMElement} node input/textarea to focus
4489 */
4490
4491function focusNode(node) {
4492 // IE8 can throw "Can't move focus to the control because it is invisible,
4493 // not enabled, or of a type that does not accept the focus." for all kinds of
4494 // reasons that are too expensive and fragile to test.
4495 try {
4496 node.focus();
4497 } catch (e) {}
4498}
4499
4500module.exports = focusNode;
4501},{}],40:[function(require,module,exports){
4502'use strict';
4503
4504/**
4505 * Copyright (c) 2013-present, Facebook, Inc.
4506 * All rights reserved.
4507 *
4508 * This source code is licensed under the BSD-style license found in the
4509 * LICENSE file in the root directory of this source tree. An additional grant
4510 * of patent rights can be found in the PATENTS file in the same directory.
4511 *
4512 * @typechecks
4513 */
4514
4515/* eslint-disable fb-www/typeof-undefined */
4516
4517/**
4518 * Same as document.activeElement but wraps in a try-catch block. In IE it is
4519 * not safe to call document.activeElement if there is nothing focused.
4520 *
4521 * The activeElement will be null only if the document or document body is not
4522 * yet defined.
4523 */
4524function getActiveElement() /*?DOMElement*/{
4525 if (typeof document === 'undefined') {
4526 return null;
4527 }
4528 try {
4529 return document.activeElement || document.body;
4530 } catch (e) {
4531 return document.body;
4532 }
4533}
4534
4535module.exports = getActiveElement;
4536},{}],41:[function(require,module,exports){
4537(function (process){
4538'use strict';
4539
4540/**
4541 * Copyright (c) 2013-present, Facebook, Inc.
4542 * All rights reserved.
4543 *
4544 * This source code is licensed under the BSD-style license found in the
4545 * LICENSE file in the root directory of this source tree. An additional grant
4546 * of patent rights can be found in the PATENTS file in the same directory.
4547 *
4548 */
4549
4550/*eslint-disable fb-www/unsafe-html */
4551
4552var ExecutionEnvironment = require(31);
4553
4554var invariant = require(45);
4555
4556/**
4557 * Dummy container used to detect which wraps are necessary.
4558 */
4559var dummyNode = ExecutionEnvironment.canUseDOM ? document.createElement('div') : null;
4560
4561/**
4562 * Some browsers cannot use `innerHTML` to render certain elements standalone,
4563 * so we wrap them, render the wrapped nodes, then extract the desired node.
4564 *
4565 * In IE8, certain elements cannot render alone, so wrap all elements ('*').
4566 */
4567
4568var shouldWrap = {};
4569
4570var selectWrap = [1, '<select multiple="true">', '</select>'];
4571var tableWrap = [1, '<table>', '</table>'];
4572var trWrap = [3, '<table><tbody><tr>', '</tr></tbody></table>'];
4573
4574var svgWrap = [1, '<svg xmlns="http://www.w3.org/2000/svg">', '</svg>'];
4575
4576var markupWrap = {
4577 '*': [1, '?<div>', '</div>'],
4578
4579 'area': [1, '<map>', '</map>'],
4580 'col': [2, '<table><tbody></tbody><colgroup>', '</colgroup></table>'],
4581 'legend': [1, '<fieldset>', '</fieldset>'],
4582 'param': [1, '<object>', '</object>'],
4583 'tr': [2, '<table><tbody>', '</tbody></table>'],
4584
4585 'optgroup': selectWrap,
4586 'option': selectWrap,
4587
4588 'caption': tableWrap,
4589 'colgroup': tableWrap,
4590 'tbody': tableWrap,
4591 'tfoot': tableWrap,
4592 'thead': tableWrap,
4593
4594 'td': trWrap,
4595 'th': trWrap
4596};
4597
4598// Initialize the SVG elements since we know they'll always need to be wrapped
4599// consistently. If they are created inside a <div> they will be initialized in
4600// the wrong namespace (and will not display).
4601var svgElements = ['circle', 'clipPath', 'defs', 'ellipse', 'g', 'image', 'line', 'linearGradient', 'mask', 'path', 'pattern', 'polygon', 'polyline', 'radialGradient', 'rect', 'stop', 'text', 'tspan'];
4602svgElements.forEach(function (nodeName) {
4603 markupWrap[nodeName] = svgWrap;
4604 shouldWrap[nodeName] = true;
4605});
4606
4607/**
4608 * Gets the markup wrap configuration for the supplied `nodeName`.
4609 *
4610 * NOTE: This lazily detects which wraps are necessary for the current browser.
4611 *
4612 * @param {string} nodeName Lowercase `nodeName`.
4613 * @return {?array} Markup wrap configuration, if applicable.
4614 */
4615function getMarkupWrap(nodeName) {
4616 !!!dummyNode ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Markup wrapping node not initialized') : invariant(false) : void 0;
4617 if (!markupWrap.hasOwnProperty(nodeName)) {
4618 nodeName = '*';
4619 }
4620 if (!shouldWrap.hasOwnProperty(nodeName)) {
4621 if (nodeName === '*') {
4622 dummyNode.innerHTML = '<link />';
4623 } else {
4624 dummyNode.innerHTML = '<' + nodeName + '></' + nodeName + '>';
4625 }
4626 shouldWrap[nodeName] = !dummyNode.firstChild;
4627 }
4628 return shouldWrap[nodeName] ? markupWrap[nodeName] : null;
4629}
4630
4631module.exports = getMarkupWrap;
4632}).call(this,require(91))
4633},{"31":31,"45":45,"91":91}],42:[function(require,module,exports){
4634/**
4635 * Copyright (c) 2013-present, Facebook, Inc.
4636 * All rights reserved.
4637 *
4638 * This source code is licensed under the BSD-style license found in the
4639 * LICENSE file in the root directory of this source tree. An additional grant
4640 * of patent rights can be found in the PATENTS file in the same directory.
4641 *
4642 * @typechecks
4643 */
4644
4645'use strict';
4646
4647/**
4648 * Gets the scroll position of the supplied element or window.
4649 *
4650 * The return values are unbounded, unlike `getScrollPosition`. This means they
4651 * may be negative or exceed the element boundaries (which is possible using
4652 * inertial scrolling).
4653 *
4654 * @param {DOMWindow|DOMElement} scrollable
4655 * @return {object} Map with `x` and `y` keys.
4656 */
4657
4658function getUnboundedScrollPosition(scrollable) {
4659 if (scrollable === window) {
4660 return {
4661 x: window.pageXOffset || document.documentElement.scrollLeft,
4662 y: window.pageYOffset || document.documentElement.scrollTop
4663 };
4664 }
4665 return {
4666 x: scrollable.scrollLeft,
4667 y: scrollable.scrollTop
4668 };
4669}
4670
4671module.exports = getUnboundedScrollPosition;
4672},{}],43:[function(require,module,exports){
4673'use strict';
4674
4675/**
4676 * Copyright (c) 2013-present, Facebook, Inc.
4677 * All rights reserved.
4678 *
4679 * This source code is licensed under the BSD-style license found in the
4680 * LICENSE file in the root directory of this source tree. An additional grant
4681 * of patent rights can be found in the PATENTS file in the same directory.
4682 *
4683 * @typechecks
4684 */
4685
4686var _uppercasePattern = /([A-Z])/g;
4687
4688/**
4689 * Hyphenates a camelcased string, for example:
4690 *
4691 * > hyphenate('backgroundColor')
4692 * < "background-color"
4693 *
4694 * For CSS style names, use `hyphenateStyleName` instead which works properly
4695 * with all vendor prefixes, including `ms`.
4696 *
4697 * @param {string} string
4698 * @return {string}
4699 */
4700function hyphenate(string) {
4701 return string.replace(_uppercasePattern, '-$1').toLowerCase();
4702}
4703
4704module.exports = hyphenate;
4705},{}],44:[function(require,module,exports){
4706/**
4707 * Copyright (c) 2013-present, Facebook, Inc.
4708 * All rights reserved.
4709 *
4710 * This source code is licensed under the BSD-style license found in the
4711 * LICENSE file in the root directory of this source tree. An additional grant
4712 * of patent rights can be found in the PATENTS file in the same directory.
4713 *
4714 * @typechecks
4715 */
4716
4717'use strict';
4718
4719var hyphenate = require(43);
4720
4721var msPattern = /^ms-/;
4722
4723/**
4724 * Hyphenates a camelcased CSS property name, for example:
4725 *
4726 * > hyphenateStyleName('backgroundColor')
4727 * < "background-color"
4728 * > hyphenateStyleName('MozTransition')
4729 * < "-moz-transition"
4730 * > hyphenateStyleName('msTransition')
4731 * < "-ms-transition"
4732 *
4733 * As Modernizr suggests (http://modernizr.com/docs/#prefixed), an `ms` prefix
4734 * is converted to `-ms-`.
4735 *
4736 * @param {string} string
4737 * @return {string}
4738 */
4739function hyphenateStyleName(string) {
4740 return hyphenate(string).replace(msPattern, '-ms-');
4741}
4742
4743module.exports = hyphenateStyleName;
4744},{"43":43}],45:[function(require,module,exports){
4745(function (process){
4746/**
4747 * Copyright (c) 2013-present, Facebook, Inc.
4748 * All rights reserved.
4749 *
4750 * This source code is licensed under the BSD-style license found in the
4751 * LICENSE file in the root directory of this source tree. An additional grant
4752 * of patent rights can be found in the PATENTS file in the same directory.
4753 *
4754 */
4755
4756'use strict';
4757
4758/**
4759 * Use invariant() to assert state which your program assumes to be true.
4760 *
4761 * Provide sprintf-style format (only %s is supported) and arguments
4762 * to provide information about what broke and what you were
4763 * expecting.
4764 *
4765 * The invariant message will be stripped in production, but the invariant
4766 * will remain to ensure logic does not differ in production.
4767 */
4768
4769function invariant(condition, format, a, b, c, d, e, f) {
4770 if (process.env.NODE_ENV !== 'production') {
4771 if (format === undefined) {
4772 throw new Error('invariant requires an error message argument');
4773 }
4774 }
4775
4776 if (!condition) {
4777 var error;
4778 if (format === undefined) {
4779 error = new Error('Minified exception occurred; use the non-minified dev environment ' + 'for the full error message and additional helpful warnings.');
4780 } else {
4781 var args = [a, b, c, d, e, f];
4782 var argIndex = 0;
4783 error = new Error(format.replace(/%s/g, function () {
4784 return args[argIndex++];
4785 }));
4786 error.name = 'Invariant Violation';
4787 }
4788
4789 error.framesToPop = 1; // we don't care about invariant's own frame
4790 throw error;
4791 }
4792}
4793
4794module.exports = invariant;
4795}).call(this,require(91))
4796},{"91":91}],46:[function(require,module,exports){
4797'use strict';
4798
4799/**
4800 * Copyright (c) 2013-present, Facebook, Inc.
4801 * All rights reserved.
4802 *
4803 * This source code is licensed under the BSD-style license found in the
4804 * LICENSE file in the root directory of this source tree. An additional grant
4805 * of patent rights can be found in the PATENTS file in the same directory.
4806 *
4807 * @typechecks
4808 */
4809
4810/**
4811 * @param {*} object The object to check.
4812 * @return {boolean} Whether or not the object is a DOM node.
4813 */
4814function isNode(object) {
4815 return !!(object && (typeof Node === 'function' ? object instanceof Node : typeof object === 'object' && typeof object.nodeType === 'number' && typeof object.nodeName === 'string'));
4816}
4817
4818module.exports = isNode;
4819},{}],47:[function(require,module,exports){
4820'use strict';
4821
4822/**
4823 * Copyright (c) 2013-present, Facebook, Inc.
4824 * All rights reserved.
4825 *
4826 * This source code is licensed under the BSD-style license found in the
4827 * LICENSE file in the root directory of this source tree. An additional grant
4828 * of patent rights can be found in the PATENTS file in the same directory.
4829 *
4830 * @typechecks
4831 */
4832
4833var isNode = require(46);
4834
4835/**
4836 * @param {*} object The object to check.
4837 * @return {boolean} Whether or not the object is a DOM text node.
4838 */
4839function isTextNode(object) {
4840 return isNode(object) && object.nodeType == 3;
4841}
4842
4843module.exports = isTextNode;
4844},{"46":46}],48:[function(require,module,exports){
4845(function (process){
4846/**
4847 * Copyright (c) 2013-present, Facebook, Inc.
4848 * All rights reserved.
4849 *
4850 * This source code is licensed under the BSD-style license found in the
4851 * LICENSE file in the root directory of this source tree. An additional grant
4852 * of patent rights can be found in the PATENTS file in the same directory.
4853 *
4854 * @typechecks static-only
4855 */
4856
4857'use strict';
4858
4859var invariant = require(45);
4860
4861/**
4862 * Constructs an enumeration with keys equal to their value.
4863 *
4864 * For example:
4865 *
4866 * var COLORS = keyMirror({blue: null, red: null});
4867 * var myColor = COLORS.blue;
4868 * var isColorValid = !!COLORS[myColor];
4869 *
4870 * The last line could not be performed if the values of the generated enum were
4871 * not equal to their keys.
4872 *
4873 * Input: {key1: val1, key2: val2}
4874 * Output: {key1: key1, key2: key2}
4875 *
4876 * @param {object} obj
4877 * @return {object}
4878 */
4879var keyMirror = function (obj) {
4880 var ret = {};
4881 var key;
4882 !(obj instanceof Object && !Array.isArray(obj)) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'keyMirror(...): Argument must be an object.') : invariant(false) : void 0;
4883 for (key in obj) {
4884 if (!obj.hasOwnProperty(key)) {
4885 continue;
4886 }
4887 ret[key] = key;
4888 }
4889 return ret;
4890};
4891
4892module.exports = keyMirror;
4893}).call(this,require(91))
4894},{"45":45,"91":91}],49:[function(require,module,exports){
4895"use strict";
4896
4897/**
4898 * Copyright (c) 2013-present, Facebook, Inc.
4899 * All rights reserved.
4900 *
4901 * This source code is licensed under the BSD-style license found in the
4902 * LICENSE file in the root directory of this source tree. An additional grant
4903 * of patent rights can be found in the PATENTS file in the same directory.
4904 *
4905 */
4906
4907/**
4908 * Allows extraction of a minified key. Let's the build system minify keys
4909 * without losing the ability to dynamically use key strings as values
4910 * themselves. Pass in an object with a single key/val pair and it will return
4911 * you the string key of that single record. Suppose you want to grab the
4912 * value for a key 'className' inside of an object. Key/val minification may
4913 * have aliased that key to be 'xa12'. keyOf({className: null}) will return
4914 * 'xa12' in that case. Resolve keys you want to use once at startup time, then
4915 * reuse those resolutions.
4916 */
4917var keyOf = function (oneKeyObj) {
4918 var key;
4919 for (key in oneKeyObj) {
4920 if (!oneKeyObj.hasOwnProperty(key)) {
4921 continue;
4922 }
4923 return key;
4924 }
4925 return null;
4926};
4927
4928module.exports = keyOf;
4929},{}],50:[function(require,module,exports){
4930/**
4931 * Copyright (c) 2013-present, Facebook, Inc.
4932 * All rights reserved.
4933 *
4934 * This source code is licensed under the BSD-style license found in the
4935 * LICENSE file in the root directory of this source tree. An additional grant
4936 * of patent rights can be found in the PATENTS file in the same directory.
4937 *
4938 */
4939
4940'use strict';
4941
4942var hasOwnProperty = Object.prototype.hasOwnProperty;
4943
4944/**
4945 * Executes the provided `callback` once for each enumerable own property in the
4946 * object and constructs a new object from the results. The `callback` is
4947 * invoked with three arguments:
4948 *
4949 * - the property value
4950 * - the property name
4951 * - the object being traversed
4952 *
4953 * Properties that are added after the call to `mapObject` will not be visited
4954 * by `callback`. If the values of existing properties are changed, the value
4955 * passed to `callback` will be the value at the time `mapObject` visits them.
4956 * Properties that are deleted before being visited are not visited.
4957 *
4958 * @grep function objectMap()
4959 * @grep function objMap()
4960 *
4961 * @param {?object} object
4962 * @param {function} callback
4963 * @param {*} context
4964 * @return {?object}
4965 */
4966function mapObject(object, callback, context) {
4967 if (!object) {
4968 return null;
4969 }
4970 var result = {};
4971 for (var name in object) {
4972 if (hasOwnProperty.call(object, name)) {
4973 result[name] = callback.call(context, object[name], name, object);
4974 }
4975 }
4976 return result;
4977}
4978
4979module.exports = mapObject;
4980},{}],51:[function(require,module,exports){
4981/**
4982 * Copyright (c) 2013-present, Facebook, Inc.
4983 * All rights reserved.
4984 *
4985 * This source code is licensed under the BSD-style license found in the
4986 * LICENSE file in the root directory of this source tree. An additional grant
4987 * of patent rights can be found in the PATENTS file in the same directory.
4988 *
4989 * @typechecks static-only
4990 */
4991
4992'use strict';
4993
4994/**
4995 * Memoizes the return value of a function that accepts one string argument.
4996 *
4997 * @param {function} callback
4998 * @return {function}
4999 */
5000
5001function memoizeStringOnly(callback) {
5002 var cache = {};
5003 return function (string) {
5004 if (!cache.hasOwnProperty(string)) {
5005 cache[string] = callback.call(this, string);
5006 }
5007 return cache[string];
5008 };
5009}
5010
5011module.exports = memoizeStringOnly;
5012},{}],52:[function(require,module,exports){
5013/**
5014 * Copyright (c) 2013-present, Facebook, Inc.
5015 * All rights reserved.
5016 *
5017 * This source code is licensed under the BSD-style license found in the
5018 * LICENSE file in the root directory of this source tree. An additional grant
5019 * of patent rights can be found in the PATENTS file in the same directory.
5020 *
5021 * @typechecks
5022 */
5023
5024'use strict';
5025
5026var ExecutionEnvironment = require(31);
5027
5028var performance;
5029
5030if (ExecutionEnvironment.canUseDOM) {
5031 performance = window.performance || window.msPerformance || window.webkitPerformance;
5032}
5033
5034module.exports = performance || {};
5035},{"31":31}],53:[function(require,module,exports){
5036'use strict';
5037
5038/**
5039 * Copyright (c) 2013-present, Facebook, Inc.
5040 * All rights reserved.
5041 *
5042 * This source code is licensed under the BSD-style license found in the
5043 * LICENSE file in the root directory of this source tree. An additional grant
5044 * of patent rights can be found in the PATENTS file in the same directory.
5045 *
5046 * @typechecks
5047 */
5048
5049var performance = require(52);
5050
5051var performanceNow;
5052
5053/**
5054 * Detect if we can use `window.performance.now()` and gracefully fallback to
5055 * `Date.now()` if it doesn't exist. We need to support Firefox < 15 for now
5056 * because of Facebook's testing infrastructure.
5057 */
5058if (performance.now) {
5059 performanceNow = function () {
5060 return performance.now();
5061 };
5062} else {
5063 performanceNow = function () {
5064 return Date.now();
5065 };
5066}
5067
5068module.exports = performanceNow;
5069},{"52":52}],54:[function(require,module,exports){
5070/**
5071 * Copyright (c) 2013-present, Facebook, Inc.
5072 * All rights reserved.
5073 *
5074 * This source code is licensed under the BSD-style license found in the
5075 * LICENSE file in the root directory of this source tree. An additional grant
5076 * of patent rights can be found in the PATENTS file in the same directory.
5077 *
5078 * @typechecks
5079 *
5080 */
5081
5082/*eslint-disable no-self-compare */
5083
5084'use strict';
5085
5086var hasOwnProperty = Object.prototype.hasOwnProperty;
5087
5088/**
5089 * inlined Object.is polyfill to avoid requiring consumers ship their own
5090 * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is
5091 */
5092function is(x, y) {
5093 // SameValue algorithm
5094 if (x === y) {
5095 // Steps 1-5, 7-10
5096 // Steps 6.b-6.e: +0 != -0
5097 return x !== 0 || 1 / x === 1 / y;
5098 } else {
5099 // Step 6.a: NaN == NaN
5100 return x !== x && y !== y;
5101 }
5102}
5103
5104/**
5105 * Performs equality by iterating through keys on an object and returning false
5106 * when any key has values which are not strictly equal between the arguments.
5107 * Returns true when the values of all keys are strictly equal.
5108 */
5109function shallowEqual(objA, objB) {
5110 if (is(objA, objB)) {
5111 return true;
5112 }
5113
5114 if (typeof objA !== 'object' || objA === null || typeof objB !== 'object' || objB === null) {
5115 return false;
5116 }
5117
5118 var keysA = Object.keys(objA);
5119 var keysB = Object.keys(objB);
5120
5121 if (keysA.length !== keysB.length) {
5122 return false;
5123 }
5124
5125 // Test for A's keys different from B.
5126 for (var i = 0; i < keysA.length; i++) {
5127 if (!hasOwnProperty.call(objB, keysA[i]) || !is(objA[keysA[i]], objB[keysA[i]])) {
5128 return false;
5129 }
5130 }
5131
5132 return true;
5133}
5134
5135module.exports = shallowEqual;
5136},{}],55:[function(require,module,exports){
5137(function (process){
5138/**
5139 * Copyright 2014-2015, Facebook, Inc.
5140 * All rights reserved.
5141 *
5142 * This source code is licensed under the BSD-style license found in the
5143 * LICENSE file in the root directory of this source tree. An additional grant
5144 * of patent rights can be found in the PATENTS file in the same directory.
5145 *
5146 */
5147
5148'use strict';
5149
5150var emptyFunction = require(37);
5151
5152/**
5153 * Similar to invariant but only logs a warning if the condition is not met.
5154 * This can be used to log issues in development environments in critical
5155 * paths. Removing the logging code for production environments will keep the
5156 * same logic and follow the same code paths.
5157 */
5158
5159var warning = emptyFunction;
5160
5161if (process.env.NODE_ENV !== 'production') {
5162 warning = function (condition, format) {
5163 for (var _len = arguments.length, args = Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
5164 args[_key - 2] = arguments[_key];
5165 }
5166
5167 if (format === undefined) {
5168 throw new Error('`warning(condition, format, ...args)` requires a warning ' + 'message argument');
5169 }
5170
5171 if (format.indexOf('Failed Composite propType: ') === 0) {
5172 return; // Ignore CompositeComponent proptype check.
5173 }
5174
5175 if (!condition) {
5176 var argIndex = 0;
5177 var message = 'Warning: ' + format.replace(/%s/g, function () {
5178 return args[argIndex++];
5179 });
5180 if (typeof console !== 'undefined') {
5181 console.error(message);
5182 }
5183 try {
5184 // --- Welcome to debugging React ---
5185 // This error was thrown as a convenience so that you can use this stack
5186 // to find the callsite that caused this warning to fire.
5187 throw new Error(message);
5188 } catch (x) {}
5189 }
5190 };
5191}
5192
5193module.exports = warning;
5194}).call(this,require(91))
5195},{"37":37,"91":91}],56:[function(require,module,exports){
5196(function (global){
5197
5198/*
5199 * Module requirements.
5200 */
5201
5202var isArray = require(82);
5203
5204/**
5205 * Module exports.
5206 */
5207
5208module.exports = hasBinary;
5209
5210/**
5211 * Checks for binary data.
5212 *
5213 * Right now only Buffer and ArrayBuffer are supported..
5214 *
5215 * @param {Object} anything
5216 * @api public
5217 */
5218
5219function hasBinary(data) {
5220
5221 function _hasBinary(obj) {
5222 if (!obj) return false;
5223
5224 if ( (global.Buffer && global.Buffer.isBuffer && global.Buffer.isBuffer(obj)) ||
5225 (global.ArrayBuffer && obj instanceof ArrayBuffer) ||
5226 (global.Blob && obj instanceof Blob) ||
5227 (global.File && obj instanceof File)
5228 ) {
5229 return true;
5230 }
5231
5232 if (isArray(obj)) {
5233 for (var i = 0; i < obj.length; i++) {
5234 if (_hasBinary(obj[i])) {
5235 return true;
5236 }
5237 }
5238 } else if (obj && 'object' == typeof obj) {
5239 // see: https://github.com/Automattic/has-binary/pull/4
5240 if (obj.toJSON && 'function' == typeof obj.toJSON) {
5241 obj = obj.toJSON();
5242 }
5243
5244 for (var key in obj) {
5245 if (Object.prototype.hasOwnProperty.call(obj, key) && _hasBinary(obj[key])) {
5246 return true;
5247 }
5248 }
5249 }
5250
5251 return false;
5252 }
5253
5254 return _hasBinary(data);
5255}
5256
5257}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
5258},{"82":82}],57:[function(require,module,exports){
5259
5260/**
5261 * Module exports.
5262 *
5263 * Logic borrowed from Modernizr:
5264 *
5265 * - https://github.com/Modernizr/Modernizr/blob/master/feature-detects/cors.js
5266 */
5267
5268try {
5269 module.exports = typeof XMLHttpRequest !== 'undefined' &&
5270 'withCredentials' in new XMLHttpRequest();
5271} catch (err) {
5272 // if XMLHttp support is disabled in IE then it will throw
5273 // when trying to create
5274 module.exports = false;
5275}
5276
5277},{}],58:[function(require,module,exports){
5278'use strict';
5279
5280Object.defineProperty(exports, "__esModule", {
5281 value: true
5282});
5283/**
5284 * Indicates that navigation was caused by a call to history.push.
5285 */
5286var PUSH = exports.PUSH = 'PUSH';
5287
5288/**
5289 * Indicates that navigation was caused by a call to history.replace.
5290 */
5291var REPLACE = exports.REPLACE = 'REPLACE';
5292
5293/**
5294 * Indicates that navigation was caused by some other action such
5295 * as using a browser's back/forward buttons and/or manually manipulating
5296 * the URL in a browser's location bar. This is the default.
5297 *
5298 * See https://developer.mozilla.org/en-US/docs/Web/API/WindowEventHandlers/onpopstate
5299 * for more information.
5300 */
5301var POP = exports.POP = 'POP';
5302},{}],59:[function(require,module,exports){
5303"use strict";
5304
5305Object.defineProperty(exports, "__esModule", {
5306 value: true
5307});
5308
5309function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }
5310
5311var loopAsync = exports.loopAsync = function loopAsync(turns, work, callback) {
5312 var currentTurn = 0,
5313 isDone = false;
5314 var isSync = false,
5315 hasNext = false,
5316 doneArgs = void 0;
5317
5318 var done = function done() {
5319 for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
5320 args[_key] = arguments[_key];
5321 }
5322
5323 isDone = true;
5324
5325 if (isSync) {
5326 // Iterate instead of recursing if possible.
5327 doneArgs = args;
5328 return;
5329 }
5330
5331 callback.apply(undefined, args);
5332 };
5333
5334 var next = function next() {
5335 if (isDone) return;
5336
5337 hasNext = true;
5338
5339 if (isSync) return; // Iterate instead of recursing if possible.
5340
5341 isSync = true;
5342
5343 while (!isDone && currentTurn < turns && hasNext) {
5344 hasNext = false;
5345 work(currentTurn++, next, done);
5346 }
5347
5348 isSync = false;
5349
5350 if (isDone) {
5351 // This means the loop finished synchronously.
5352 callback.apply(undefined, _toConsumableArray(doneArgs));
5353 return;
5354 }
5355
5356 if (currentTurn >= turns && hasNext) {
5357 isDone = true;
5358 callback();
5359 }
5360 };
5361
5362 next();
5363};
5364},{}],60:[function(require,module,exports){
5365'use strict';
5366
5367Object.defineProperty(exports, "__esModule", {
5368 value: true
5369});
5370exports.go = exports.replaceLocation = exports.pushLocation = exports.startListener = exports.getUserConfirmation = exports.getCurrentLocation = undefined;
5371
5372var _LocationUtils = require(65);
5373
5374var _DOMUtils = require(62);
5375
5376var _DOMStateStorage = require(61);
5377
5378var _PathUtils = require(66);
5379
5380/* eslint-disable no-alert */
5381
5382
5383var PopStateEvent = 'popstate';
5384
5385var _createLocation = function _createLocation(historyState) {
5386 var key = historyState && historyState.key;
5387
5388 return (0, _LocationUtils.createLocation)({
5389 pathname: window.location.pathname,
5390 search: window.location.search,
5391 hash: window.location.hash,
5392 state: key ? (0, _DOMStateStorage.readState)(key) : undefined
5393 }, undefined, key);
5394};
5395
5396var getCurrentLocation = exports.getCurrentLocation = function getCurrentLocation() {
5397 var historyState = void 0;
5398 try {
5399 historyState = window.history.state || {};
5400 } catch (error) {
5401 // IE 11 sometimes throws when accessing window.history.state
5402 // See https://github.com/mjackson/history/pull/289
5403 historyState = {};
5404 }
5405
5406 return _createLocation(historyState);
5407};
5408
5409var getUserConfirmation = exports.getUserConfirmation = function getUserConfirmation(message, callback) {
5410 return callback(window.confirm(message));
5411};
5412
5413var startListener = exports.startListener = function startListener(listener) {
5414 var handlePopState = function handlePopState(event) {
5415 if (event.state !== undefined) // Ignore extraneous popstate events in WebKit
5416 listener(_createLocation(event.state));
5417 };
5418
5419 (0, _DOMUtils.addEventListener)(window, PopStateEvent, handlePopState);
5420
5421 return function () {
5422 return (0, _DOMUtils.removeEventListener)(window, PopStateEvent, handlePopState);
5423 };
5424};
5425
5426var updateLocation = function updateLocation(location, updateState) {
5427 var state = location.state;
5428 var key = location.key;
5429
5430
5431 if (state !== undefined) (0, _DOMStateStorage.saveState)(key, state);
5432
5433 updateState({ key: key }, (0, _PathUtils.createPath)(location));
5434};
5435
5436var pushLocation = exports.pushLocation = function pushLocation(location) {
5437 return updateLocation(location, function (state, path) {
5438 return window.history.pushState(state, null, path);
5439 });
5440};
5441
5442var replaceLocation = exports.replaceLocation = function replaceLocation(location) {
5443 return updateLocation(location, function (state, path) {
5444 return window.history.replaceState(state, null, path);
5445 });
5446};
5447
5448var go = exports.go = function go(n) {
5449 if (n) window.history.go(n);
5450};
5451},{"61":61,"62":62,"65":65,"66":66}],61:[function(require,module,exports){
5452(function (process){
5453'use strict';
5454
5455Object.defineProperty(exports, "__esModule", {
5456 value: true
5457});
5458exports.readState = exports.saveState = undefined;
5459
5460var _warning = require(337);
5461
5462var _warning2 = _interopRequireDefault(_warning);
5463
5464function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
5465
5466var QuotaExceededErrors = ['QuotaExceededError', 'QUOTA_EXCEEDED_ERR']; /* eslint-disable no-empty */
5467
5468
5469var SecurityError = 'SecurityError';
5470var KeyPrefix = '@@History/';
5471
5472var createKey = function createKey(key) {
5473 return KeyPrefix + key;
5474};
5475
5476var saveState = exports.saveState = function saveState(key, state) {
5477 if (!window.sessionStorage) {
5478 // Session storage is not available or hidden.
5479 // sessionStorage is undefined in Internet Explorer when served via file protocol.
5480 process.env.NODE_ENV !== 'production' ? (0, _warning2.default)(false, '[history] Unable to save state; sessionStorage is not available') : void 0;
5481 return;
5482 }
5483
5484 try {
5485 if (state == null) {
5486 window.sessionStorage.removeItem(createKey(key));
5487 } else {
5488 window.sessionStorage.setItem(createKey(key), JSON.stringify(state));
5489 }
5490 } catch (error) {
5491 if (error.name === SecurityError) {
5492 // Blocking cookies in Chrome/Firefox/Safari throws SecurityError on any
5493 // attempt to access window.sessionStorage.
5494 process.env.NODE_ENV !== 'production' ? (0, _warning2.default)(false, '[history] Unable to save state; sessionStorage is not available due to security settings') : void 0;
5495
5496 return;
5497 }
5498
5499 if (QuotaExceededErrors.indexOf(error.name) >= 0 && window.sessionStorage.length === 0) {
5500 // Safari "private mode" throws QuotaExceededError.
5501 process.env.NODE_ENV !== 'production' ? (0, _warning2.default)(false, '[history] Unable to save state; sessionStorage is not available in Safari private mode') : void 0;
5502
5503 return;
5504 }
5505
5506 throw error;
5507 }
5508};
5509
5510var readState = exports.readState = function readState(key) {
5511 var json = void 0;
5512 try {
5513 json = window.sessionStorage.getItem(createKey(key));
5514 } catch (error) {
5515 if (error.name === SecurityError) {
5516 // Blocking cookies in Chrome/Firefox/Safari throws SecurityError on any
5517 // attempt to access window.sessionStorage.
5518 process.env.NODE_ENV !== 'production' ? (0, _warning2.default)(false, '[history] Unable to read state; sessionStorage is not available due to security settings') : void 0;
5519
5520 return undefined;
5521 }
5522 }
5523
5524 if (json) {
5525 try {
5526 return JSON.parse(json);
5527 } catch (error) {
5528 // Ignore invalid JSON.
5529 }
5530 }
5531
5532 return undefined;
5533};
5534}).call(this,require(91))
5535},{"337":337,"91":91}],62:[function(require,module,exports){
5536'use strict';
5537
5538Object.defineProperty(exports, "__esModule", {
5539 value: true
5540});
5541var addEventListener = exports.addEventListener = function addEventListener(node, event, listener) {
5542 return node.addEventListener ? node.addEventListener(event, listener, false) : node.attachEvent('on' + event, listener);
5543};
5544
5545var removeEventListener = exports.removeEventListener = function removeEventListener(node, event, listener) {
5546 return node.removeEventListener ? node.removeEventListener(event, listener, false) : node.detachEvent('on' + event, listener);
5547};
5548
5549/**
5550 * Returns true if the HTML5 history API is supported. Taken from Modernizr.
5551 *
5552 * https://github.com/Modernizr/Modernizr/blob/master/LICENSE
5553 * https://github.com/Modernizr/Modernizr/blob/master/feature-detects/history.js
5554 * changed to avoid false negatives for Windows Phones: https://github.com/reactjs/react-router/issues/586
5555 */
5556var supportsHistory = exports.supportsHistory = function supportsHistory() {
5557 var ua = window.navigator.userAgent;
5558
5559 if ((ua.indexOf('Android 2.') !== -1 || ua.indexOf('Android 4.0') !== -1) && ua.indexOf('Mobile Safari') !== -1 && ua.indexOf('Chrome') === -1 && ua.indexOf('Windows Phone') === -1) return false;
5560
5561 return window.history && 'pushState' in window.history;
5562};
5563
5564/**
5565 * Returns false if using go(n) with hash history causes a full page reload.
5566 */
5567var supportsGoWithoutReloadUsingHash = exports.supportsGoWithoutReloadUsingHash = function supportsGoWithoutReloadUsingHash() {
5568 return window.navigator.userAgent.indexOf('Firefox') === -1;
5569};
5570},{}],63:[function(require,module,exports){
5571'use strict';
5572
5573Object.defineProperty(exports, "__esModule", {
5574 value: true
5575});
5576var canUseDOM = exports.canUseDOM = !!(typeof window !== 'undefined' && window.document && window.document.createElement);
5577},{}],64:[function(require,module,exports){
5578(function (process){
5579'use strict';
5580
5581Object.defineProperty(exports, "__esModule", {
5582 value: true
5583});
5584exports.replaceLocation = exports.pushLocation = exports.startListener = exports.getCurrentLocation = exports.go = exports.getUserConfirmation = undefined;
5585
5586var _BrowserProtocol = require(60);
5587
5588Object.defineProperty(exports, 'getUserConfirmation', {
5589 enumerable: true,
5590 get: function get() {
5591 return _BrowserProtocol.getUserConfirmation;
5592 }
5593});
5594Object.defineProperty(exports, 'go', {
5595 enumerable: true,
5596 get: function get() {
5597 return _BrowserProtocol.go;
5598 }
5599});
5600
5601var _warning = require(337);
5602
5603var _warning2 = _interopRequireDefault(_warning);
5604
5605var _LocationUtils = require(65);
5606
5607var _DOMUtils = require(62);
5608
5609var _DOMStateStorage = require(61);
5610
5611var _PathUtils = require(66);
5612
5613function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
5614
5615var HashChangeEvent = 'hashchange';
5616
5617var getHashPath = function getHashPath() {
5618 // We can't use window.location.hash here because it's not
5619 // consistent across browsers - Firefox will pre-decode it!
5620 var href = window.location.href;
5621 var index = href.indexOf('#');
5622 return index === -1 ? '' : href.substring(index + 1);
5623};
5624
5625var pushHashPath = function pushHashPath(path) {
5626 return window.location.hash = path;
5627};
5628
5629var replaceHashPath = function replaceHashPath(path) {
5630 var i = window.location.href.indexOf('#');
5631
5632 window.location.replace(window.location.href.slice(0, i >= 0 ? i : 0) + '#' + path);
5633};
5634
5635var ensureSlash = function ensureSlash() {
5636 var path = getHashPath();
5637
5638 if ((0, _PathUtils.isAbsolutePath)(path)) return true;
5639
5640 replaceHashPath('/' + path);
5641
5642 return false;
5643};
5644
5645var getCurrentLocation = exports.getCurrentLocation = function getCurrentLocation(queryKey) {
5646 var path = getHashPath();
5647 var key = (0, _PathUtils.getQueryStringValueFromPath)(path, queryKey);
5648
5649 var state = void 0;
5650 if (key) {
5651 path = (0, _PathUtils.stripQueryStringValueFromPath)(path, queryKey);
5652 state = (0, _DOMStateStorage.readState)(key);
5653 }
5654
5655 var init = (0, _PathUtils.parsePath)(path);
5656 init.state = state;
5657
5658 return (0, _LocationUtils.createLocation)(init, undefined, key);
5659};
5660
5661var prevLocation = void 0;
5662
5663var startListener = exports.startListener = function startListener(listener, queryKey) {
5664 var handleHashChange = function handleHashChange() {
5665 if (!ensureSlash()) return; // Hash path must always begin with a /
5666
5667 var currentLocation = getCurrentLocation(queryKey);
5668
5669 if (prevLocation && currentLocation.key && prevLocation.key === currentLocation.key) return; // Ignore extraneous hashchange events
5670
5671 prevLocation = currentLocation;
5672
5673 listener(currentLocation);
5674 };
5675
5676 ensureSlash();
5677 (0, _DOMUtils.addEventListener)(window, HashChangeEvent, handleHashChange);
5678
5679 return function () {
5680 return (0, _DOMUtils.removeEventListener)(window, HashChangeEvent, handleHashChange);
5681 };
5682};
5683
5684var updateLocation = function updateLocation(location, queryKey, updateHash) {
5685 var state = location.state;
5686 var key = location.key;
5687
5688 var path = (0, _PathUtils.createPath)(location);
5689
5690 if (state !== undefined) {
5691 path = (0, _PathUtils.addQueryStringValueToPath)(path, queryKey, key);
5692 (0, _DOMStateStorage.saveState)(key, state);
5693 }
5694
5695 prevLocation = location;
5696
5697 updateHash(path);
5698};
5699
5700var pushLocation = exports.pushLocation = function pushLocation(location, queryKey) {
5701 return updateLocation(location, queryKey, function (path) {
5702 if (getHashPath() !== path) {
5703 pushHashPath(path);
5704 } else {
5705 process.env.NODE_ENV !== 'production' ? (0, _warning2.default)(false, 'You cannot PUSH the same path using hash history') : void 0;
5706 }
5707 });
5708};
5709
5710var replaceLocation = exports.replaceLocation = function replaceLocation(location, queryKey) {
5711 return updateLocation(location, queryKey, function (path) {
5712 if (getHashPath() !== path) replaceHashPath(path);
5713 });
5714};
5715}).call(this,require(91))
5716},{"337":337,"60":60,"61":61,"62":62,"65":65,"66":66,"91":91}],65:[function(require,module,exports){
5717(function (process){
5718'use strict';
5719
5720Object.defineProperty(exports, "__esModule", {
5721 value: true
5722});
5723exports.locationsAreEqual = exports.statesAreEqual = exports.createLocation = exports.createQuery = undefined;
5724
5725var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol ? "symbol" : typeof obj; };
5726
5727var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
5728
5729var _invariant = require(81);
5730
5731var _invariant2 = _interopRequireDefault(_invariant);
5732
5733var _PathUtils = require(66);
5734
5735var _Actions = require(58);
5736
5737function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
5738
5739var createQuery = exports.createQuery = function createQuery(props) {
5740 return _extends(Object.create(null), props);
5741};
5742
5743var createLocation = exports.createLocation = function createLocation() {
5744 var input = arguments.length <= 0 || arguments[0] === undefined ? '/' : arguments[0];
5745 var action = arguments.length <= 1 || arguments[1] === undefined ? _Actions.POP : arguments[1];
5746 var key = arguments.length <= 2 || arguments[2] === undefined ? null : arguments[2];
5747
5748 var object = typeof input === 'string' ? (0, _PathUtils.parsePath)(input) : input;
5749
5750 var pathname = object.pathname || '/';
5751 var search = object.search || '';
5752 var hash = object.hash || '';
5753 var state = object.state;
5754
5755 return {
5756 pathname: pathname,
5757 search: search,
5758 hash: hash,
5759 state: state,
5760 action: action,
5761 key: key
5762 };
5763};
5764
5765var isDate = function isDate(object) {
5766 return Object.prototype.toString.call(object) === '[object Date]';
5767};
5768
5769var statesAreEqual = exports.statesAreEqual = function statesAreEqual(a, b) {
5770 if (a === b) return true;
5771
5772 var typeofA = typeof a === 'undefined' ? 'undefined' : _typeof(a);
5773 var typeofB = typeof b === 'undefined' ? 'undefined' : _typeof(b);
5774
5775 if (typeofA !== typeofB) return false;
5776
5777 !(typeofA !== 'function') ? process.env.NODE_ENV !== 'production' ? (0, _invariant2.default)(false, 'You must not store functions in location state') : (0, _invariant2.default)(false) : void 0;
5778
5779 // Not the same object, but same type.
5780 if (typeofA === 'object') {
5781 !!(isDate(a) && isDate(b)) ? process.env.NODE_ENV !== 'production' ? (0, _invariant2.default)(false, 'You must not store Date objects in location state') : (0, _invariant2.default)(false) : void 0;
5782
5783 if (!Array.isArray(a)) return Object.keys(a).every(function (key) {
5784 return statesAreEqual(a[key], b[key]);
5785 });
5786
5787 return Array.isArray(b) && a.length === b.length && a.every(function (item, index) {
5788 return statesAreEqual(item, b[index]);
5789 });
5790 }
5791
5792 // All other serializable types (string, number, boolean)
5793 // should be strict equal.
5794 return false;
5795};
5796
5797var locationsAreEqual = exports.locationsAreEqual = function locationsAreEqual(a, b) {
5798 return a.key === b.key &&
5799 // a.action === b.action && // Different action !== location change.
5800 a.pathname === b.pathname && a.search === b.search && a.hash === b.hash && statesAreEqual(a.state, b.state);
5801};
5802}).call(this,require(91))
5803},{"58":58,"66":66,"81":81,"91":91}],66:[function(require,module,exports){
5804(function (process){
5805'use strict';
5806
5807Object.defineProperty(exports, "__esModule", {
5808 value: true
5809});
5810exports.createPath = exports.parsePath = exports.getQueryStringValueFromPath = exports.stripQueryStringValueFromPath = exports.addQueryStringValueToPath = exports.isAbsolutePath = undefined;
5811
5812var _warning = require(337);
5813
5814var _warning2 = _interopRequireDefault(_warning);
5815
5816function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
5817
5818var isAbsolutePath = exports.isAbsolutePath = function isAbsolutePath(path) {
5819 return typeof path === 'string' && path.charAt(0) === '/';
5820};
5821
5822var addQueryStringValueToPath = exports.addQueryStringValueToPath = function addQueryStringValueToPath(path, key, value) {
5823 var _parsePath = parsePath(path);
5824
5825 var pathname = _parsePath.pathname;
5826 var search = _parsePath.search;
5827 var hash = _parsePath.hash;
5828
5829
5830 return createPath({
5831 pathname: pathname,
5832 search: search + (search.indexOf('?') === -1 ? '?' : '&') + key + '=' + value,
5833 hash: hash
5834 });
5835};
5836
5837var stripQueryStringValueFromPath = exports.stripQueryStringValueFromPath = function stripQueryStringValueFromPath(path, key) {
5838 var _parsePath2 = parsePath(path);
5839
5840 var pathname = _parsePath2.pathname;
5841 var search = _parsePath2.search;
5842 var hash = _parsePath2.hash;
5843
5844
5845 return createPath({
5846 pathname: pathname,
5847 search: search.replace(new RegExp('([?&])' + key + '=[a-zA-Z0-9]+(&?)'), function (match, prefix, suffix) {
5848 return prefix === '?' ? prefix : suffix;
5849 }),
5850 hash: hash
5851 });
5852};
5853
5854var getQueryStringValueFromPath = exports.getQueryStringValueFromPath = function getQueryStringValueFromPath(path, key) {
5855 var _parsePath3 = parsePath(path);
5856
5857 var search = _parsePath3.search;
5858
5859 var match = search.match(new RegExp('[?&]' + key + '=([a-zA-Z0-9]+)'));
5860 return match && match[1];
5861};
5862
5863var extractPath = function extractPath(string) {
5864 var match = string.match(/^(https?:)?\/\/[^\/]*/);
5865 return match == null ? string : string.substring(match[0].length);
5866};
5867
5868var parsePath = exports.parsePath = function parsePath(path) {
5869 var pathname = extractPath(path);
5870 var search = '';
5871 var hash = '';
5872
5873 process.env.NODE_ENV !== 'production' ? (0, _warning2.default)(path === pathname, 'A path must be pathname + search + hash only, not a full URL like "%s"', path) : void 0;
5874
5875 var hashIndex = pathname.indexOf('#');
5876 if (hashIndex !== -1) {
5877 hash = pathname.substring(hashIndex);
5878 pathname = pathname.substring(0, hashIndex);
5879 }
5880
5881 var searchIndex = pathname.indexOf('?');
5882 if (searchIndex !== -1) {
5883 search = pathname.substring(searchIndex);
5884 pathname = pathname.substring(0, searchIndex);
5885 }
5886
5887 if (pathname === '') pathname = '/';
5888
5889 return {
5890 pathname: pathname,
5891 search: search,
5892 hash: hash
5893 };
5894};
5895
5896var createPath = exports.createPath = function createPath(location) {
5897 if (location == null || typeof location === 'string') return location;
5898
5899 var basename = location.basename;
5900 var pathname = location.pathname;
5901 var search = location.search;
5902 var hash = location.hash;
5903
5904 var path = (basename || '') + pathname;
5905
5906 if (search && search !== '?') path += search;
5907
5908 if (hash) path += hash;
5909
5910 return path;
5911};
5912}).call(this,require(91))
5913},{"337":337,"91":91}],67:[function(require,module,exports){
5914'use strict';
5915
5916Object.defineProperty(exports, "__esModule", {
5917 value: true
5918});
5919exports.replaceLocation = exports.pushLocation = exports.getCurrentLocation = exports.go = exports.getUserConfirmation = undefined;
5920
5921var _BrowserProtocol = require(60);
5922
5923Object.defineProperty(exports, 'getUserConfirmation', {
5924 enumerable: true,
5925 get: function get() {
5926 return _BrowserProtocol.getUserConfirmation;
5927 }
5928});
5929Object.defineProperty(exports, 'go', {
5930 enumerable: true,
5931 get: function get() {
5932 return _BrowserProtocol.go;
5933 }
5934});
5935
5936var _LocationUtils = require(65);
5937
5938var _PathUtils = require(66);
5939
5940var getCurrentLocation = exports.getCurrentLocation = function getCurrentLocation() {
5941 return (0, _LocationUtils.createLocation)(window.location);
5942};
5943
5944var pushLocation = exports.pushLocation = function pushLocation(location) {
5945 window.location.href = (0, _PathUtils.createPath)(location);
5946 return false; // Don't update location
5947};
5948
5949var replaceLocation = exports.replaceLocation = function replaceLocation(location) {
5950 window.location.replace((0, _PathUtils.createPath)(location));
5951 return false; // Don't update location
5952};
5953},{"60":60,"65":65,"66":66}],68:[function(require,module,exports){
5954(function (process){
5955'use strict';
5956
5957Object.defineProperty(exports, "__esModule", {
5958 value: true
5959});
5960
5961var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
5962
5963var _invariant = require(81);
5964
5965var _invariant2 = _interopRequireDefault(_invariant);
5966
5967var _ExecutionEnvironment = require(63);
5968
5969var _BrowserProtocol = require(60);
5970
5971var BrowserProtocol = _interopRequireWildcard(_BrowserProtocol);
5972
5973var _RefreshProtocol = require(67);
5974
5975var RefreshProtocol = _interopRequireWildcard(_RefreshProtocol);
5976
5977var _DOMUtils = require(62);
5978
5979var _createHistory = require(70);
5980
5981var _createHistory2 = _interopRequireDefault(_createHistory);
5982
5983function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
5984
5985function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
5986
5987/**
5988 * Creates and returns a history object that uses HTML5's history API
5989 * (pushState, replaceState, and the popstate event) to manage history.
5990 * This is the recommended method of managing history in browsers because
5991 * it provides the cleanest URLs.
5992 *
5993 * Note: In browsers that do not support the HTML5 history API full
5994 * page reloads will be used to preserve clean URLs. You can force this
5995 * behavior using { forceRefresh: true } in options.
5996 */
5997var createBrowserHistory = function createBrowserHistory() {
5998 var options = arguments.length <= 0 || arguments[0] === undefined ? {} : arguments[0];
5999
6000 !_ExecutionEnvironment.canUseDOM ? process.env.NODE_ENV !== 'production' ? (0, _invariant2.default)(false, 'Browser history needs a DOM') : (0, _invariant2.default)(false) : void 0;
6001
6002 var useRefresh = options.forceRefresh || !(0, _DOMUtils.supportsHistory)();
6003 var Protocol = useRefresh ? RefreshProtocol : BrowserProtocol;
6004
6005 var getUserConfirmation = Protocol.getUserConfirmation;
6006 var getCurrentLocation = Protocol.getCurrentLocation;
6007 var pushLocation = Protocol.pushLocation;
6008 var replaceLocation = Protocol.replaceLocation;
6009 var go = Protocol.go;
6010
6011
6012 var history = (0, _createHistory2.default)(_extends({
6013 getUserConfirmation: getUserConfirmation }, options, {
6014 getCurrentLocation: getCurrentLocation,
6015 pushLocation: pushLocation,
6016 replaceLocation: replaceLocation,
6017 go: go
6018 }));
6019
6020 var listenerCount = 0,
6021 stopListener = void 0;
6022
6023 var startListener = function startListener(listener, before) {
6024 if (++listenerCount === 1) stopListener = BrowserProtocol.startListener(history.transitionTo);
6025
6026 var unlisten = before ? history.listenBefore(listener) : history.listen(listener);
6027
6028 return function () {
6029 unlisten();
6030
6031 if (--listenerCount === 0) stopListener();
6032 };
6033 };
6034
6035 var listenBefore = function listenBefore(listener) {
6036 return startListener(listener, true);
6037 };
6038
6039 var listen = function listen(listener) {
6040 return startListener(listener, false);
6041 };
6042
6043 return _extends({}, history, {
6044 listenBefore: listenBefore,
6045 listen: listen
6046 });
6047};
6048
6049exports.default = createBrowserHistory;
6050}).call(this,require(91))
6051},{"60":60,"62":62,"63":63,"67":67,"70":70,"81":81,"91":91}],69:[function(require,module,exports){
6052(function (process){
6053'use strict';
6054
6055Object.defineProperty(exports, "__esModule", {
6056 value: true
6057});
6058
6059var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
6060
6061var _warning = require(337);
6062
6063var _warning2 = _interopRequireDefault(_warning);
6064
6065var _invariant = require(81);
6066
6067var _invariant2 = _interopRequireDefault(_invariant);
6068
6069var _ExecutionEnvironment = require(63);
6070
6071var _DOMUtils = require(62);
6072
6073var _HashProtocol = require(64);
6074
6075var HashProtocol = _interopRequireWildcard(_HashProtocol);
6076
6077var _createHistory = require(70);
6078
6079var _createHistory2 = _interopRequireDefault(_createHistory);
6080
6081function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
6082
6083function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
6084
6085var DefaultQueryKey = '_k';
6086
6087var createHashHistory = function createHashHistory() {
6088 var options = arguments.length <= 0 || arguments[0] === undefined ? {} : arguments[0];
6089
6090 !_ExecutionEnvironment.canUseDOM ? process.env.NODE_ENV !== 'production' ? (0, _invariant2.default)(false, 'Hash history needs a DOM') : (0, _invariant2.default)(false) : void 0;
6091
6092 var queryKey = options.queryKey;
6093
6094
6095 process.env.NODE_ENV !== 'production' ? (0, _warning2.default)(queryKey !== false, 'Using { queryKey: false } no longer works. Instead, just don\'t ' + 'use location state if you don\'t want a key in your URL query string') : void 0;
6096
6097 if (typeof queryKey !== 'string') queryKey = DefaultQueryKey;
6098
6099 var getUserConfirmation = HashProtocol.getUserConfirmation;
6100
6101
6102 var getCurrentLocation = function getCurrentLocation() {
6103 return HashProtocol.getCurrentLocation(queryKey);
6104 };
6105
6106 var pushLocation = function pushLocation(location) {
6107 return HashProtocol.pushLocation(location, queryKey);
6108 };
6109
6110 var replaceLocation = function replaceLocation(location) {
6111 return HashProtocol.replaceLocation(location, queryKey);
6112 };
6113
6114 var history = (0, _createHistory2.default)(_extends({
6115 getUserConfirmation: getUserConfirmation }, options, {
6116 getCurrentLocation: getCurrentLocation,
6117 pushLocation: pushLocation,
6118 replaceLocation: replaceLocation,
6119 go: HashProtocol.go
6120 }));
6121
6122 var listenerCount = 0,
6123 stopListener = void 0;
6124
6125 var startListener = function startListener(listener, before) {
6126 if (++listenerCount === 1) stopListener = HashProtocol.startListener(history.transitionTo, queryKey);
6127
6128 var unlisten = before ? history.listenBefore(listener) : history.listen(listener);
6129
6130 return function () {
6131 unlisten();
6132
6133 if (--listenerCount === 0) stopListener();
6134 };
6135 };
6136
6137 var listenBefore = function listenBefore(listener) {
6138 return startListener(listener, true);
6139 };
6140
6141 var listen = function listen(listener) {
6142 return startListener(listener, false);
6143 };
6144
6145 var goIsSupportedWithoutReload = (0, _DOMUtils.supportsGoWithoutReloadUsingHash)();
6146
6147 var go = function go(n) {
6148 process.env.NODE_ENV !== 'production' ? (0, _warning2.default)(goIsSupportedWithoutReload, 'Hash history go(n) causes a full page reload in this browser') : void 0;
6149
6150 history.go(n);
6151 };
6152
6153 var createHref = function createHref(path) {
6154 return '#' + history.createHref(path);
6155 };
6156
6157 return _extends({}, history, {
6158 listenBefore: listenBefore,
6159 listen: listen,
6160 go: go,
6161 createHref: createHref
6162 });
6163};
6164
6165exports.default = createHashHistory;
6166}).call(this,require(91))
6167},{"337":337,"62":62,"63":63,"64":64,"70":70,"81":81,"91":91}],70:[function(require,module,exports){
6168'use strict';
6169
6170Object.defineProperty(exports, "__esModule", {
6171 value: true
6172});
6173
6174var _AsyncUtils = require(59);
6175
6176var _PathUtils = require(66);
6177
6178var _runTransitionHook = require(73);
6179
6180var _runTransitionHook2 = _interopRequireDefault(_runTransitionHook);
6181
6182var _Actions = require(58);
6183
6184var _LocationUtils = require(65);
6185
6186function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
6187
6188function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }
6189
6190var createHistory = function createHistory() {
6191 var options = arguments.length <= 0 || arguments[0] === undefined ? {} : arguments[0];
6192 var getCurrentLocation = options.getCurrentLocation;
6193 var getUserConfirmation = options.getUserConfirmation;
6194 var pushLocation = options.pushLocation;
6195 var replaceLocation = options.replaceLocation;
6196 var go = options.go;
6197 var keyLength = options.keyLength;
6198
6199
6200 var currentLocation = void 0;
6201 var pendingLocation = void 0;
6202 var beforeListeners = [];
6203 var listeners = [];
6204 var allKeys = [];
6205
6206 var getCurrentIndex = function getCurrentIndex() {
6207 if (pendingLocation && pendingLocation.action === _Actions.POP) return allKeys.indexOf(pendingLocation.key);
6208
6209 if (currentLocation) return allKeys.indexOf(currentLocation.key);
6210
6211 return -1;
6212 };
6213
6214 var updateLocation = function updateLocation(nextLocation) {
6215 currentLocation = nextLocation;
6216
6217 var currentIndex = getCurrentIndex();
6218
6219 if (currentLocation.action === _Actions.PUSH) {
6220 allKeys = [].concat(_toConsumableArray(allKeys.slice(0, currentIndex + 1)), [currentLocation.key]);
6221 } else if (currentLocation.action === _Actions.REPLACE) {
6222 allKeys[currentIndex] = currentLocation.key;
6223 }
6224
6225 listeners.forEach(function (listener) {
6226 return listener(currentLocation);
6227 });
6228 };
6229
6230 var listenBefore = function listenBefore(listener) {
6231 beforeListeners.push(listener);
6232
6233 return function () {
6234 return beforeListeners = beforeListeners.filter(function (item) {
6235 return item !== listener;
6236 });
6237 };
6238 };
6239
6240 var listen = function listen(listener) {
6241 listeners.push(listener);
6242
6243 return function () {
6244 return listeners = listeners.filter(function (item) {
6245 return item !== listener;
6246 });
6247 };
6248 };
6249
6250 var confirmTransitionTo = function confirmTransitionTo(location, callback) {
6251 (0, _AsyncUtils.loopAsync)(beforeListeners.length, function (index, next, done) {
6252 (0, _runTransitionHook2.default)(beforeListeners[index], location, function (result) {
6253 return result != null ? done(result) : next();
6254 });
6255 }, function (message) {
6256 if (getUserConfirmation && typeof message === 'string') {
6257 getUserConfirmation(message, function (ok) {
6258 return callback(ok !== false);
6259 });
6260 } else {
6261 callback(message !== false);
6262 }
6263 });
6264 };
6265
6266 var transitionTo = function transitionTo(nextLocation) {
6267 if (currentLocation && (0, _LocationUtils.locationsAreEqual)(currentLocation, nextLocation) || pendingLocation && (0, _LocationUtils.locationsAreEqual)(pendingLocation, nextLocation)) return; // Nothing to do
6268
6269 pendingLocation = nextLocation;
6270
6271 confirmTransitionTo(nextLocation, function (ok) {
6272 if (pendingLocation !== nextLocation) return; // Transition was interrupted during confirmation
6273
6274 pendingLocation = null;
6275
6276 if (ok) {
6277 // Treat PUSH to same path like REPLACE to be consistent with browsers
6278 if (nextLocation.action === _Actions.PUSH) {
6279 var prevPath = (0, _PathUtils.createPath)(currentLocation);
6280 var nextPath = (0, _PathUtils.createPath)(nextLocation);
6281
6282 if (nextPath === prevPath && (0, _LocationUtils.statesAreEqual)(currentLocation.state, nextLocation.state)) nextLocation.action = _Actions.REPLACE;
6283 }
6284
6285 if (nextLocation.action === _Actions.POP) {
6286 updateLocation(nextLocation);
6287 } else if (nextLocation.action === _Actions.PUSH) {
6288 if (pushLocation(nextLocation) !== false) updateLocation(nextLocation);
6289 } else if (nextLocation.action === _Actions.REPLACE) {
6290 if (replaceLocation(nextLocation) !== false) updateLocation(nextLocation);
6291 }
6292 } else if (currentLocation && nextLocation.action === _Actions.POP) {
6293 var prevIndex = allKeys.indexOf(currentLocation.key);
6294 var nextIndex = allKeys.indexOf(nextLocation.key);
6295
6296 if (prevIndex !== -1 && nextIndex !== -1) go(prevIndex - nextIndex); // Restore the URL
6297 }
6298 });
6299 };
6300
6301 var push = function push(input) {
6302 return transitionTo(createLocation(input, _Actions.PUSH));
6303 };
6304
6305 var replace = function replace(input) {
6306 return transitionTo(createLocation(input, _Actions.REPLACE));
6307 };
6308
6309 var goBack = function goBack() {
6310 return go(-1);
6311 };
6312
6313 var goForward = function goForward() {
6314 return go(1);
6315 };
6316
6317 var createKey = function createKey() {
6318 return Math.random().toString(36).substr(2, keyLength || 6);
6319 };
6320
6321 var createHref = function createHref(location) {
6322 return (0, _PathUtils.createPath)(location);
6323 };
6324
6325 var createLocation = function createLocation(location, action) {
6326 var key = arguments.length <= 2 || arguments[2] === undefined ? createKey() : arguments[2];
6327 return (0, _LocationUtils.createLocation)(location, action, key);
6328 };
6329
6330 return {
6331 getCurrentLocation: getCurrentLocation,
6332 listenBefore: listenBefore,
6333 listen: listen,
6334 transitionTo: transitionTo,
6335 push: push,
6336 replace: replace,
6337 go: go,
6338 goBack: goBack,
6339 goForward: goForward,
6340 createKey: createKey,
6341 createPath: _PathUtils.createPath,
6342 createHref: createHref,
6343 createLocation: createLocation
6344 };
6345};
6346
6347exports.default = createHistory;
6348},{"58":58,"59":59,"65":65,"66":66,"73":73}],71:[function(require,module,exports){
6349(function (process){
6350'use strict';
6351
6352Object.defineProperty(exports, "__esModule", {
6353 value: true
6354});
6355
6356var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
6357
6358var _warning = require(337);
6359
6360var _warning2 = _interopRequireDefault(_warning);
6361
6362var _invariant = require(81);
6363
6364var _invariant2 = _interopRequireDefault(_invariant);
6365
6366var _LocationUtils = require(65);
6367
6368var _PathUtils = require(66);
6369
6370var _createHistory = require(70);
6371
6372var _createHistory2 = _interopRequireDefault(_createHistory);
6373
6374var _Actions = require(58);
6375
6376function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
6377
6378var createStateStorage = function createStateStorage(entries) {
6379 return entries.filter(function (entry) {
6380 return entry.state;
6381 }).reduce(function (memo, entry) {
6382 memo[entry.key] = entry.state;
6383 return memo;
6384 }, {});
6385};
6386
6387var createMemoryHistory = function createMemoryHistory() {
6388 var options = arguments.length <= 0 || arguments[0] === undefined ? {} : arguments[0];
6389
6390 if (Array.isArray(options)) {
6391 options = { entries: options };
6392 } else if (typeof options === 'string') {
6393 options = { entries: [options] };
6394 }
6395
6396 var getCurrentLocation = function getCurrentLocation() {
6397 var entry = entries[current];
6398 var path = (0, _PathUtils.createPath)(entry);
6399
6400 var key = void 0,
6401 state = void 0;
6402 if (entry.key) {
6403 key = entry.key;
6404 state = readState(key);
6405 }
6406
6407 var init = (0, _PathUtils.parsePath)(path);
6408
6409 return (0, _LocationUtils.createLocation)(_extends({}, init, { state: state }), undefined, key);
6410 };
6411
6412 var canGo = function canGo(n) {
6413 var index = current + n;
6414 return index >= 0 && index < entries.length;
6415 };
6416
6417 var go = function go(n) {
6418 if (!n) return;
6419
6420 if (!canGo(n)) {
6421 process.env.NODE_ENV !== 'production' ? (0, _warning2.default)(false, 'Cannot go(%s) there is not enough history', n) : void 0;
6422
6423 return;
6424 }
6425
6426 current += n;
6427 var currentLocation = getCurrentLocation();
6428
6429 // Change action to POP
6430 history.transitionTo(_extends({}, currentLocation, { action: _Actions.POP }));
6431 };
6432
6433 var pushLocation = function pushLocation(location) {
6434 current += 1;
6435
6436 if (current < entries.length) entries.splice(current);
6437
6438 entries.push(location);
6439
6440 saveState(location.key, location.state);
6441 };
6442
6443 var replaceLocation = function replaceLocation(location) {
6444 entries[current] = location;
6445 saveState(location.key, location.state);
6446 };
6447
6448 var history = (0, _createHistory2.default)(_extends({}, options, {
6449 getCurrentLocation: getCurrentLocation,
6450 pushLocation: pushLocation,
6451 replaceLocation: replaceLocation,
6452 go: go
6453 }));
6454
6455 var _options = options;
6456 var entries = _options.entries;
6457 var current = _options.current;
6458
6459
6460 if (typeof entries === 'string') {
6461 entries = [entries];
6462 } else if (!Array.isArray(entries)) {
6463 entries = ['/'];
6464 }
6465
6466 entries = entries.map(function (entry) {
6467 return (0, _LocationUtils.createLocation)(entry);
6468 });
6469
6470 if (current == null) {
6471 current = entries.length - 1;
6472 } else {
6473 !(current >= 0 && current < entries.length) ? process.env.NODE_ENV !== 'production' ? (0, _invariant2.default)(false, 'Current index must be >= 0 and < %s, was %s', entries.length, current) : (0, _invariant2.default)(false) : void 0;
6474 }
6475
6476 var storage = createStateStorage(entries);
6477
6478 var saveState = function saveState(key, state) {
6479 return storage[key] = state;
6480 };
6481
6482 var readState = function readState(key) {
6483 return storage[key];
6484 };
6485
6486 return history;
6487};
6488
6489exports.default = createMemoryHistory;
6490}).call(this,require(91))
6491},{"337":337,"58":58,"65":65,"66":66,"70":70,"81":81,"91":91}],72:[function(require,module,exports){
6492'use strict';
6493
6494Object.defineProperty(exports, "__esModule", {
6495 value: true
6496});
6497exports.locationsAreEqual = exports.Actions = exports.useQueries = exports.useBeforeUnload = exports.useBasename = exports.createMemoryHistory = exports.createHashHistory = exports.createHistory = undefined;
6498
6499var _LocationUtils = require(65);
6500
6501Object.defineProperty(exports, 'locationsAreEqual', {
6502 enumerable: true,
6503 get: function get() {
6504 return _LocationUtils.locationsAreEqual;
6505 }
6506});
6507
6508var _createBrowserHistory = require(68);
6509
6510var _createBrowserHistory2 = _interopRequireDefault(_createBrowserHistory);
6511
6512var _createHashHistory2 = require(69);
6513
6514var _createHashHistory3 = _interopRequireDefault(_createHashHistory2);
6515
6516var _createMemoryHistory2 = require(71);
6517
6518var _createMemoryHistory3 = _interopRequireDefault(_createMemoryHistory2);
6519
6520var _useBasename2 = require(74);
6521
6522var _useBasename3 = _interopRequireDefault(_useBasename2);
6523
6524var _useBeforeUnload2 = require(75);
6525
6526var _useBeforeUnload3 = _interopRequireDefault(_useBeforeUnload2);
6527
6528var _useQueries2 = require(76);
6529
6530var _useQueries3 = _interopRequireDefault(_useQueries2);
6531
6532var _Actions2 = require(58);
6533
6534var _Actions3 = _interopRequireDefault(_Actions2);
6535
6536function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
6537
6538exports.createHistory = _createBrowserHistory2.default;
6539exports.createHashHistory = _createHashHistory3.default;
6540exports.createMemoryHistory = _createMemoryHistory3.default;
6541exports.useBasename = _useBasename3.default;
6542exports.useBeforeUnload = _useBeforeUnload3.default;
6543exports.useQueries = _useQueries3.default;
6544exports.Actions = _Actions3.default;
6545},{"58":58,"65":65,"68":68,"69":69,"71":71,"74":74,"75":75,"76":76}],73:[function(require,module,exports){
6546(function (process){
6547'use strict';
6548
6549Object.defineProperty(exports, "__esModule", {
6550 value: true
6551});
6552
6553var _warning = require(337);
6554
6555var _warning2 = _interopRequireDefault(_warning);
6556
6557function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
6558
6559var runTransitionHook = function runTransitionHook(hook, location, callback) {
6560 var result = hook(location, callback);
6561
6562 if (hook.length < 2) {
6563 // Assume the hook runs synchronously and automatically
6564 // call the callback with the return value.
6565 callback(result);
6566 } else {
6567 process.env.NODE_ENV !== 'production' ? (0, _warning2.default)(result === undefined, 'You should not "return" in a transition hook with a callback argument; ' + 'call the callback instead') : void 0;
6568 }
6569};
6570
6571exports.default = runTransitionHook;
6572}).call(this,require(91))
6573},{"337":337,"91":91}],74:[function(require,module,exports){
6574'use strict';
6575
6576Object.defineProperty(exports, "__esModule", {
6577 value: true
6578});
6579
6580var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
6581
6582var _runTransitionHook = require(73);
6583
6584var _runTransitionHook2 = _interopRequireDefault(_runTransitionHook);
6585
6586var _PathUtils = require(66);
6587
6588function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
6589
6590var useBasename = function useBasename(createHistory) {
6591 return function () {
6592 var options = arguments.length <= 0 || arguments[0] === undefined ? {} : arguments[0];
6593
6594 var history = createHistory(options);
6595 var basename = options.basename;
6596
6597
6598 var addBasename = function addBasename(location) {
6599 if (!location) return location;
6600
6601 if (basename && location.basename == null) {
6602 if (location.pathname.indexOf(basename) === 0) {
6603 location.pathname = location.pathname.substring(basename.length);
6604 location.basename = basename;
6605
6606 if (location.pathname === '') location.pathname = '/';
6607 } else {
6608 location.basename = '';
6609 }
6610 }
6611
6612 return location;
6613 };
6614
6615 var prependBasename = function prependBasename(location) {
6616 if (!basename) return location;
6617
6618 var object = typeof location === 'string' ? (0, _PathUtils.parsePath)(location) : location;
6619 var pname = object.pathname;
6620 var normalizedBasename = basename.slice(-1) === '/' ? basename : basename + '/';
6621 var normalizedPathname = pname.charAt(0) === '/' ? pname.slice(1) : pname;
6622 var pathname = normalizedBasename + normalizedPathname;
6623
6624 return _extends({}, location, {
6625 pathname: pathname
6626 });
6627 };
6628
6629 // Override all read methods with basename-aware versions.
6630 var getCurrentLocation = function getCurrentLocation() {
6631 return addBasename(history.getCurrentLocation());
6632 };
6633
6634 var listenBefore = function listenBefore(hook) {
6635 return history.listenBefore(function (location, callback) {
6636 return (0, _runTransitionHook2.default)(hook, addBasename(location), callback);
6637 });
6638 };
6639
6640 var listen = function listen(listener) {
6641 return history.listen(function (location) {
6642 return listener(addBasename(location));
6643 });
6644 };
6645
6646 // Override all write methods with basename-aware versions.
6647 var push = function push(location) {
6648 return history.push(prependBasename(location));
6649 };
6650
6651 var replace = function replace(location) {
6652 return history.replace(prependBasename(location));
6653 };
6654
6655 var createPath = function createPath(location) {
6656 return history.createPath(prependBasename(location));
6657 };
6658
6659 var createHref = function createHref(location) {
6660 return history.createHref(prependBasename(location));
6661 };
6662
6663 var createLocation = function createLocation(location) {
6664 for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
6665 args[_key - 1] = arguments[_key];
6666 }
6667
6668 return addBasename(history.createLocation.apply(history, [prependBasename(location)].concat(args)));
6669 };
6670
6671 return _extends({}, history, {
6672 getCurrentLocation: getCurrentLocation,
6673 listenBefore: listenBefore,
6674 listen: listen,
6675 push: push,
6676 replace: replace,
6677 createPath: createPath,
6678 createHref: createHref,
6679 createLocation: createLocation
6680 });
6681 };
6682};
6683
6684exports.default = useBasename;
6685},{"66":66,"73":73}],75:[function(require,module,exports){
6686(function (process){
6687'use strict';
6688
6689Object.defineProperty(exports, "__esModule", {
6690 value: true
6691});
6692
6693var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
6694
6695var _invariant = require(81);
6696
6697var _invariant2 = _interopRequireDefault(_invariant);
6698
6699var _DOMUtils = require(62);
6700
6701var _ExecutionEnvironment = require(63);
6702
6703function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
6704
6705var startListener = function startListener(getPromptMessage) {
6706 var handleBeforeUnload = function handleBeforeUnload(event) {
6707 var message = getPromptMessage();
6708
6709 if (typeof message === 'string') {
6710 (event || window.event).returnValue = message;
6711 return message;
6712 }
6713
6714 return undefined;
6715 };
6716
6717 (0, _DOMUtils.addEventListener)(window, 'beforeunload', handleBeforeUnload);
6718
6719 return function () {
6720 return (0, _DOMUtils.removeEventListener)(window, 'beforeunload', handleBeforeUnload);
6721 };
6722};
6723
6724/**
6725 * Returns a new createHistory function that can be used to create
6726 * history objects that know how to use the beforeunload event in web
6727 * browsers to cancel navigation.
6728 */
6729var useBeforeUnload = function useBeforeUnload(createHistory) {
6730 !_ExecutionEnvironment.canUseDOM ? process.env.NODE_ENV !== 'production' ? (0, _invariant2.default)(false, 'useBeforeUnload only works in DOM environments') : (0, _invariant2.default)(false) : void 0;
6731
6732 return function (options) {
6733 var history = createHistory(options);
6734
6735 var listeners = [];
6736 var stopListener = void 0;
6737
6738 var getPromptMessage = function getPromptMessage() {
6739 var message = void 0;
6740 for (var i = 0, len = listeners.length; message == null && i < len; ++i) {
6741 message = listeners[i].call();
6742 }return message;
6743 };
6744
6745 var listenBeforeUnload = function listenBeforeUnload(listener) {
6746 if (listeners.push(listener) === 1) stopListener = startListener(getPromptMessage);
6747
6748 return function () {
6749 listeners = listeners.filter(function (item) {
6750 return item !== listener;
6751 });
6752
6753 if (listeners.length === 0 && stopListener) {
6754 stopListener();
6755 stopListener = null;
6756 }
6757 };
6758 };
6759
6760 return _extends({}, history, {
6761 listenBeforeUnload: listenBeforeUnload
6762 });
6763 };
6764};
6765
6766exports.default = useBeforeUnload;
6767}).call(this,require(91))
6768},{"62":62,"63":63,"81":81,"91":91}],76:[function(require,module,exports){
6769'use strict';
6770
6771Object.defineProperty(exports, "__esModule", {
6772 value: true
6773});
6774
6775var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
6776
6777var _queryString = require(78);
6778
6779var _runTransitionHook = require(73);
6780
6781var _runTransitionHook2 = _interopRequireDefault(_runTransitionHook);
6782
6783var _LocationUtils = require(65);
6784
6785var _PathUtils = require(66);
6786
6787function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
6788
6789var defaultStringifyQuery = function defaultStringifyQuery(query) {
6790 return (0, _queryString.stringify)(query).replace(/%20/g, '+');
6791};
6792
6793var defaultParseQueryString = _queryString.parse;
6794
6795/**
6796 * Returns a new createHistory function that may be used to create
6797 * history objects that know how to handle URL queries.
6798 */
6799var useQueries = function useQueries(createHistory) {
6800 return function () {
6801 var options = arguments.length <= 0 || arguments[0] === undefined ? {} : arguments[0];
6802
6803 var history = createHistory(options);
6804 var stringifyQuery = options.stringifyQuery;
6805 var parseQueryString = options.parseQueryString;
6806
6807
6808 if (typeof stringifyQuery !== 'function') stringifyQuery = defaultStringifyQuery;
6809
6810 if (typeof parseQueryString !== 'function') parseQueryString = defaultParseQueryString;
6811
6812 var decodeQuery = function decodeQuery(location) {
6813 if (!location) return location;
6814
6815 if (location.query == null) location.query = parseQueryString(location.search.substring(1));
6816
6817 return location;
6818 };
6819
6820 var encodeQuery = function encodeQuery(location, query) {
6821 if (query == null) return location;
6822
6823 var object = typeof location === 'string' ? (0, _PathUtils.parsePath)(location) : location;
6824 var queryString = stringifyQuery(query);
6825 var search = queryString ? '?' + queryString : '';
6826
6827 return _extends({}, object, {
6828 search: search
6829 });
6830 };
6831
6832 // Override all read methods with query-aware versions.
6833 var getCurrentLocation = function getCurrentLocation() {
6834 return decodeQuery(history.getCurrentLocation());
6835 };
6836
6837 var listenBefore = function listenBefore(hook) {
6838 return history.listenBefore(function (location, callback) {
6839 return (0, _runTransitionHook2.default)(hook, decodeQuery(location), callback);
6840 });
6841 };
6842
6843 var listen = function listen(listener) {
6844 return history.listen(function (location) {
6845 return listener(decodeQuery(location));
6846 });
6847 };
6848
6849 // Override all write methods with query-aware versions.
6850 var push = function push(location) {
6851 return history.push(encodeQuery(location, location.query));
6852 };
6853
6854 var replace = function replace(location) {
6855 return history.replace(encodeQuery(location, location.query));
6856 };
6857
6858 var createPath = function createPath(location) {
6859 return history.createPath(encodeQuery(location, location.query));
6860 };
6861
6862 var createHref = function createHref(location) {
6863 return history.createHref(encodeQuery(location, location.query));
6864 };
6865
6866 var createLocation = function createLocation(location) {
6867 for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
6868 args[_key - 1] = arguments[_key];
6869 }
6870
6871 var newLocation = history.createLocation.apply(history, [encodeQuery(location, location.query)].concat(args));
6872
6873 if (location.query) newLocation.query = (0, _LocationUtils.createQuery)(location.query);
6874
6875 return decodeQuery(newLocation);
6876 };
6877
6878 return _extends({}, history, {
6879 getCurrentLocation: getCurrentLocation,
6880 listenBefore: listenBefore,
6881 listen: listen,
6882 push: push,
6883 replace: replace,
6884 createPath: createPath,
6885 createHref: createHref,
6886 createLocation: createLocation
6887 });
6888 };
6889};
6890
6891exports.default = useQueries;
6892},{"65":65,"66":66,"73":73,"78":78}],77:[function(require,module,exports){
6893'use strict';
6894/* eslint-disable no-unused-vars */
6895var hasOwnProperty = Object.prototype.hasOwnProperty;
6896var propIsEnumerable = Object.prototype.propertyIsEnumerable;
6897
6898function toObject(val) {
6899 if (val === null || val === undefined) {
6900 throw new TypeError('Object.assign cannot be called with null or undefined');
6901 }
6902
6903 return Object(val);
6904}
6905
6906function shouldUseNative() {
6907 try {
6908 if (!Object.assign) {
6909 return false;
6910 }
6911
6912 // Detect buggy property enumeration order in older V8 versions.
6913
6914 // https://bugs.chromium.org/p/v8/issues/detail?id=4118
6915 var test1 = new String('abc'); // eslint-disable-line
6916 test1[5] = 'de';
6917 if (Object.getOwnPropertyNames(test1)[0] === '5') {
6918 return false;
6919 }
6920
6921 // https://bugs.chromium.org/p/v8/issues/detail?id=3056
6922 var test2 = {};
6923 for (var i = 0; i < 10; i++) {
6924 test2['_' + String.fromCharCode(i)] = i;
6925 }
6926 var order2 = Object.getOwnPropertyNames(test2).map(function (n) {
6927 return test2[n];
6928 });
6929 if (order2.join('') !== '0123456789') {
6930 return false;
6931 }
6932
6933 // https://bugs.chromium.org/p/v8/issues/detail?id=3056
6934 var test3 = {};
6935 'abcdefghijklmnopqrst'.split('').forEach(function (letter) {
6936 test3[letter] = letter;
6937 });
6938 if (Object.keys(Object.assign({}, test3)).join('') !==
6939 'abcdefghijklmnopqrst') {
6940 return false;
6941 }
6942
6943 return true;
6944 } catch (e) {
6945 // We don't expect any of the above to throw, but better to be safe.
6946 return false;
6947 }
6948}
6949
6950module.exports = shouldUseNative() ? Object.assign : function (target, source) {
6951 var from;
6952 var to = toObject(target);
6953 var symbols;
6954
6955 for (var s = 1; s < arguments.length; s++) {
6956 from = Object(arguments[s]);
6957
6958 for (var key in from) {
6959 if (hasOwnProperty.call(from, key)) {
6960 to[key] = from[key];
6961 }
6962 }
6963
6964 if (Object.getOwnPropertySymbols) {
6965 symbols = Object.getOwnPropertySymbols(from);
6966 for (var i = 0; i < symbols.length; i++) {
6967 if (propIsEnumerable.call(from, symbols[i])) {
6968 to[symbols[i]] = from[symbols[i]];
6969 }
6970 }
6971 }
6972 }
6973
6974 return to;
6975};
6976
6977},{}],78:[function(require,module,exports){
6978'use strict';
6979var strictUriEncode = require(331);
6980var objectAssign = require(77);
6981
6982function encode(value, opts) {
6983 if (opts.encode) {
6984 return opts.strict ? strictUriEncode(value) : encodeURIComponent(value);
6985 }
6986
6987 return value;
6988}
6989
6990exports.extract = function (str) {
6991 return str.split('?')[1] || '';
6992};
6993
6994exports.parse = function (str) {
6995 // Create an object with no prototype
6996 // https://github.com/sindresorhus/query-string/issues/47
6997 var ret = Object.create(null);
6998
6999 if (typeof str !== 'string') {
7000 return ret;
7001 }
7002
7003 str = str.trim().replace(/^(\?|#|&)/, '');
7004
7005 if (!str) {
7006 return ret;
7007 }
7008
7009 str.split('&').forEach(function (param) {
7010 var parts = param.replace(/\+/g, ' ').split('=');
7011 // Firefox (pre 40) decodes `%3D` to `=`
7012 // https://github.com/sindresorhus/query-string/pull/37
7013 var key = parts.shift();
7014 var val = parts.length > 0 ? parts.join('=') : undefined;
7015
7016 key = decodeURIComponent(key);
7017
7018 // missing `=` should be `null`:
7019 // http://w3.org/TR/2012/WD-url-20120524/#collect-url-parameters
7020 val = val === undefined ? null : decodeURIComponent(val);
7021
7022 if (ret[key] === undefined) {
7023 ret[key] = val;
7024 } else if (Array.isArray(ret[key])) {
7025 ret[key].push(val);
7026 } else {
7027 ret[key] = [ret[key], val];
7028 }
7029 });
7030
7031 return ret;
7032};
7033
7034exports.stringify = function (obj, opts) {
7035 var defaults = {
7036 encode: true,
7037 strict: true
7038 };
7039
7040 opts = objectAssign(defaults, opts);
7041
7042 return obj ? Object.keys(obj).sort().map(function (key) {
7043 var val = obj[key];
7044
7045 if (val === undefined) {
7046 return '';
7047 }
7048
7049 if (val === null) {
7050 return key;
7051 }
7052
7053 if (Array.isArray(val)) {
7054 var result = [];
7055
7056 val.slice().sort().forEach(function (val2) {
7057 if (val2 === undefined) {
7058 return;
7059 }
7060
7061 if (val2 === null) {
7062 result.push(encode(key, opts));
7063 } else {
7064 result.push(encode(key, opts) + '=' + encode(val2, opts));
7065 }
7066 });
7067
7068 return result.join('&');
7069 }
7070
7071 return encode(key, opts) + '=' + encode(val, opts);
7072 }).filter(function (x) {
7073 return x.length > 0;
7074 }).join('&') : '';
7075};
7076
7077},{"331":331,"77":77}],79:[function(require,module,exports){
7078/**
7079 * Copyright 2015, Yahoo! Inc.
7080 * Copyrights licensed under the New BSD License. See the accompanying LICENSE file for terms.
7081 */
7082'use strict';
7083
7084var REACT_STATICS = {
7085 childContextTypes: true,
7086 contextTypes: true,
7087 defaultProps: true,
7088 displayName: true,
7089 getDefaultProps: true,
7090 mixins: true,
7091 propTypes: true,
7092 type: true
7093};
7094
7095var KNOWN_STATICS = {
7096 name: true,
7097 length: true,
7098 prototype: true,
7099 caller: true,
7100 arguments: true,
7101 arity: true
7102};
7103
7104module.exports = function hoistNonReactStatics(targetComponent, sourceComponent) {
7105 if (typeof sourceComponent !== 'string') { // don't hoist over string (html) components
7106 var keys = Object.getOwnPropertyNames(sourceComponent);
7107 for (var i=0; i<keys.length; ++i) {
7108 if (!REACT_STATICS[keys[i]] && !KNOWN_STATICS[keys[i]]) {
7109 try {
7110 targetComponent[keys[i]] = sourceComponent[keys[i]];
7111 } catch (error) {
7112
7113 }
7114 }
7115 }
7116 }
7117
7118 return targetComponent;
7119};
7120
7121},{}],80:[function(require,module,exports){
7122
7123var indexOf = [].indexOf;
7124
7125module.exports = function(arr, obj){
7126 if (indexOf) return arr.indexOf(obj);
7127 for (var i = 0; i < arr.length; ++i) {
7128 if (arr[i] === obj) return i;
7129 }
7130 return -1;
7131};
7132},{}],81:[function(require,module,exports){
7133(function (process){
7134/**
7135 * Copyright 2013-2015, Facebook, Inc.
7136 * All rights reserved.
7137 *
7138 * This source code is licensed under the BSD-style license found in the
7139 * LICENSE file in the root directory of this source tree. An additional grant
7140 * of patent rights can be found in the PATENTS file in the same directory.
7141 */
7142
7143'use strict';
7144
7145/**
7146 * Use invariant() to assert state which your program assumes to be true.
7147 *
7148 * Provide sprintf-style format (only %s is supported) and arguments
7149 * to provide information about what broke and what you were
7150 * expecting.
7151 *
7152 * The invariant message will be stripped in production, but the invariant
7153 * will remain to ensure logic does not differ in production.
7154 */
7155
7156var invariant = function(condition, format, a, b, c, d, e, f) {
7157 if (process.env.NODE_ENV !== 'production') {
7158 if (format === undefined) {
7159 throw new Error('invariant requires an error message argument');
7160 }
7161 }
7162
7163 if (!condition) {
7164 var error;
7165 if (format === undefined) {
7166 error = new Error(
7167 'Minified exception occurred; use the non-minified dev environment ' +
7168 'for the full error message and additional helpful warnings.'
7169 );
7170 } else {
7171 var args = [a, b, c, d, e, f];
7172 var argIndex = 0;
7173 error = new Error(
7174 format.replace(/%s/g, function() { return args[argIndex++]; })
7175 );
7176 error.name = 'Invariant Violation';
7177 }
7178
7179 error.framesToPop = 1; // we don't care about invariant's own frame
7180 throw error;
7181 }
7182};
7183
7184module.exports = invariant;
7185
7186}).call(this,require(91))
7187},{"91":91}],82:[function(require,module,exports){
7188module.exports = Array.isArray || function (arr) {
7189 return Object.prototype.toString.call(arr) == '[object Array]';
7190};
7191
7192},{}],83:[function(require,module,exports){
7193(function (global){
7194/**
7195 * lodash 4.1.1 (Custom Build) <https://lodash.com/>
7196 * Build: `lodash modularize exports="npm" -o ./`
7197 * Copyright 2012-2016 The Dojo Foundation <http://dojofoundation.org/>
7198 * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
7199 * Copyright 2009-2016 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
7200 * Available under MIT license <https://lodash.com/license>
7201 */
7202
7203/** Used as references for various `Number` constants. */
7204var INFINITY = 1 / 0;
7205
7206/** `Object#toString` result references. */
7207var symbolTag = '[object Symbol]';
7208
7209/** Used to determine if values are of the language type `Object`. */
7210var objectTypes = {
7211 'function': true,
7212 'object': true
7213};
7214
7215/** Detect free variable `exports`. */
7216var freeExports = (objectTypes[typeof exports] && exports && !exports.nodeType)
7217 ? exports
7218 : undefined;
7219
7220/** Detect free variable `module`. */
7221var freeModule = (objectTypes[typeof module] && module && !module.nodeType)
7222 ? module
7223 : undefined;
7224
7225/** Detect free variable `global` from Node.js. */
7226var freeGlobal = checkGlobal(freeExports && freeModule && typeof global == 'object' && global);
7227
7228/** Detect free variable `self`. */
7229var freeSelf = checkGlobal(objectTypes[typeof self] && self);
7230
7231/** Detect free variable `window`. */
7232var freeWindow = checkGlobal(objectTypes[typeof window] && window);
7233
7234/** Detect `this` as the global object. */
7235var thisGlobal = checkGlobal(objectTypes[typeof this] && this);
7236
7237/**
7238 * Used as a reference to the global object.
7239 *
7240 * The `this` value is used if it's the global object to avoid Greasemonkey's
7241 * restricted `window` object, otherwise the `window` object is used.
7242 */
7243var root = freeGlobal ||
7244 ((freeWindow !== (thisGlobal && thisGlobal.window)) && freeWindow) ||
7245 freeSelf || thisGlobal || Function('return this')();
7246
7247/**
7248 * Checks if `value` is a global object.
7249 *
7250 * @private
7251 * @param {*} value The value to check.
7252 * @returns {null|Object} Returns `value` if it's a global object, else `null`.
7253 */
7254function checkGlobal(value) {
7255 return (value && value.Object === Object) ? value : null;
7256}
7257
7258/** Used for built-in method references. */
7259var objectProto = Object.prototype;
7260
7261/**
7262 * Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring)
7263 * of values.
7264 */
7265var objectToString = objectProto.toString;
7266
7267/** Built-in value references. */
7268var Symbol = root.Symbol;
7269
7270/** Used to convert symbols to primitives and strings. */
7271var symbolProto = Symbol ? Symbol.prototype : undefined,
7272 symbolToString = Symbol ? symbolProto.toString : undefined;
7273
7274/**
7275 * Checks if `value` is object-like. A value is object-like if it's not `null`
7276 * and has a `typeof` result of "object".
7277 *
7278 * @static
7279 * @memberOf _
7280 * @category Lang
7281 * @param {*} value The value to check.
7282 * @returns {boolean} Returns `true` if `value` is object-like, else `false`.
7283 * @example
7284 *
7285 * _.isObjectLike({});
7286 * // => true
7287 *
7288 * _.isObjectLike([1, 2, 3]);
7289 * // => true
7290 *
7291 * _.isObjectLike(_.noop);
7292 * // => false
7293 *
7294 * _.isObjectLike(null);
7295 * // => false
7296 */
7297function isObjectLike(value) {
7298 return !!value && typeof value == 'object';
7299}
7300
7301/**
7302 * Checks if `value` is classified as a `Symbol` primitive or object.
7303 *
7304 * @static
7305 * @memberOf _
7306 * @category Lang
7307 * @param {*} value The value to check.
7308 * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.
7309 * @example
7310 *
7311 * _.isSymbol(Symbol.iterator);
7312 * // => true
7313 *
7314 * _.isSymbol('abc');
7315 * // => false
7316 */
7317function isSymbol(value) {
7318 return typeof value == 'symbol' ||
7319 (isObjectLike(value) && objectToString.call(value) == symbolTag);
7320}
7321
7322/**
7323 * Converts `value` to a string if it's not one. An empty string is returned
7324 * for `null` and `undefined` values. The sign of `-0` is preserved.
7325 *
7326 * @static
7327 * @memberOf _
7328 * @category Lang
7329 * @param {*} value The value to process.
7330 * @returns {string} Returns the string.
7331 * @example
7332 *
7333 * _.toString(null);
7334 * // => ''
7335 *
7336 * _.toString(-0);
7337 * // => '-0'
7338 *
7339 * _.toString([1, 2, 3]);
7340 * // => '1,2,3'
7341 */
7342function toString(value) {
7343 // Exit early for strings to avoid a performance hit in some environments.
7344 if (typeof value == 'string') {
7345 return value;
7346 }
7347 if (value == null) {
7348 return '';
7349 }
7350 if (isSymbol(value)) {
7351 return Symbol ? symbolToString.call(value) : '';
7352 }
7353 var result = (value + '');
7354 return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result;
7355}
7356
7357module.exports = toString;
7358
7359}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
7360},{}],84:[function(require,module,exports){
7361/**
7362 * lodash 4.0.0 (Custom Build) <https://lodash.com/>
7363 * Build: `lodash modularize exports="npm" -o ./`
7364 * Copyright 2012-2016 The Dojo Foundation <http://dojofoundation.org/>
7365 * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
7366 * Copyright 2009-2016 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
7367 * Available under MIT license <https://lodash.com/license>
7368 */
7369var toString = require(83);
7370
7371/** Used to match HTML entities and HTML characters. */
7372var reEscapedHtml = /&(?:amp|lt|gt|quot|#39|#96);/g,
7373 reHasEscapedHtml = RegExp(reEscapedHtml.source);
7374
7375/** Used to map HTML entities to characters. */
7376var htmlUnescapes = {
7377 '&amp;': '&',
7378 '&lt;': '<',
7379 '&gt;': '>',
7380 '&quot;': '"',
7381 '&#39;': "'",
7382 '&#96;': '`'
7383};
7384
7385/**
7386 * Used by `_.unescape` to convert HTML entities to characters.
7387 *
7388 * @private
7389 * @param {string} chr The matched character to unescape.
7390 * @returns {string} Returns the unescaped character.
7391 */
7392function unescapeHtmlChar(chr) {
7393 return htmlUnescapes[chr];
7394}
7395
7396/**
7397 * The inverse of `_.escape`; this method converts the HTML entities
7398 * `&amp;`, `&lt;`, `&gt;`, `&quot;`, `&#39;`, and `&#96;` in `string` to their
7399 * corresponding characters.
7400 *
7401 * **Note:** No other HTML entities are unescaped. To unescape additional HTML
7402 * entities use a third-party library like [_he_](https://mths.be/he).
7403 *
7404 * @static
7405 * @memberOf _
7406 * @category String
7407 * @param {string} [string=''] The string to unescape.
7408 * @returns {string} Returns the unescaped string.
7409 * @example
7410 *
7411 * _.unescape('fred, barney, &amp; pebbles');
7412 * // => 'fred, barney, & pebbles'
7413 */
7414function unescape(string) {
7415 string = toString(string);
7416 return (string && reHasEscapedHtml.test(string))
7417 ? string.replace(reEscapedHtml, unescapeHtmlChar)
7418 : string;
7419}
7420
7421module.exports = unescape;
7422
7423},{"83":83}],85:[function(require,module,exports){
7424module.exports = function (args, opts) {
7425 if (!opts) opts = {};
7426
7427 var flags = { bools : {}, strings : {}, unknownFn: null };
7428
7429 if (typeof opts['unknown'] === 'function') {
7430 flags.unknownFn = opts['unknown'];
7431 }
7432
7433 if (typeof opts['boolean'] === 'boolean' && opts['boolean']) {
7434 flags.allBools = true;
7435 } else {
7436 [].concat(opts['boolean']).filter(Boolean).forEach(function (key) {
7437 flags.bools[key] = true;
7438 });
7439 }
7440
7441 var aliases = {};
7442 Object.keys(opts.alias || {}).forEach(function (key) {
7443 aliases[key] = [].concat(opts.alias[key]);
7444 aliases[key].forEach(function (x) {
7445 aliases[x] = [key].concat(aliases[key].filter(function (y) {
7446 return x !== y;
7447 }));
7448 });
7449 });
7450
7451 [].concat(opts.string).filter(Boolean).forEach(function (key) {
7452 flags.strings[key] = true;
7453 if (aliases[key]) {
7454 flags.strings[aliases[key]] = true;
7455 }
7456 });
7457
7458 var defaults = opts['default'] || {};
7459
7460 var argv = { _ : [] };
7461 Object.keys(flags.bools).forEach(function (key) {
7462 setArg(key, defaults[key] === undefined ? false : defaults[key]);
7463 });
7464
7465 var notFlags = [];
7466
7467 if (args.indexOf('--') !== -1) {
7468 notFlags = args.slice(args.indexOf('--')+1);
7469 args = args.slice(0, args.indexOf('--'));
7470 }
7471
7472 function argDefined(key, arg) {
7473 return (flags.allBools && /^--[^=]+$/.test(arg)) ||
7474 flags.strings[key] || flags.bools[key] || aliases[key];
7475 }
7476
7477 function setArg (key, val, arg) {
7478 if (arg && flags.unknownFn && !argDefined(key, arg)) {
7479 if (flags.unknownFn(arg) === false) return;
7480 }
7481
7482 var value = !flags.strings[key] && isNumber(val)
7483 ? Number(val) : val
7484 ;
7485 setKey(argv, key.split('.'), value);
7486
7487 (aliases[key] || []).forEach(function (x) {
7488 setKey(argv, x.split('.'), value);
7489 });
7490 }
7491
7492 function setKey (obj, keys, value) {
7493 var o = obj;
7494 keys.slice(0,-1).forEach(function (key) {
7495 if (o[key] === undefined) o[key] = {};
7496 o = o[key];
7497 });
7498
7499 var key = keys[keys.length - 1];
7500 if (o[key] === undefined || flags.bools[key] || typeof o[key] === 'boolean') {
7501 o[key] = value;
7502 }
7503 else if (Array.isArray(o[key])) {
7504 o[key].push(value);
7505 }
7506 else {
7507 o[key] = [ o[key], value ];
7508 }
7509 }
7510
7511 function aliasIsBoolean(key) {
7512 return aliases[key].some(function (x) {
7513 return flags.bools[x];
7514 });
7515 }
7516
7517 for (var i = 0; i < args.length; i++) {
7518 var arg = args[i];
7519
7520 if (/^--.+=/.test(arg)) {
7521 // Using [\s\S] instead of . because js doesn't support the
7522 // 'dotall' regex modifier. See:
7523 // http://stackoverflow.com/a/1068308/13216
7524 var m = arg.match(/^--([^=]+)=([\s\S]*)$/);
7525 var key = m[1];
7526 var value = m[2];
7527 if (flags.bools[key]) {
7528 value = value !== 'false';
7529 }
7530 setArg(key, value, arg);
7531 }
7532 else if (/^--no-.+/.test(arg)) {
7533 var key = arg.match(/^--no-(.+)/)[1];
7534 setArg(key, false, arg);
7535 }
7536 else if (/^--.+/.test(arg)) {
7537 var key = arg.match(/^--(.+)/)[1];
7538 var next = args[i + 1];
7539 if (next !== undefined && !/^-/.test(next)
7540 && !flags.bools[key]
7541 && !flags.allBools
7542 && (aliases[key] ? !aliasIsBoolean(key) : true)) {
7543 setArg(key, next, arg);
7544 i++;
7545 }
7546 else if (/^(true|false)$/.test(next)) {
7547 setArg(key, next === 'true', arg);
7548 i++;
7549 }
7550 else {
7551 setArg(key, flags.strings[key] ? '' : true, arg);
7552 }
7553 }
7554 else if (/^-[^-]+/.test(arg)) {
7555 var letters = arg.slice(1,-1).split('');
7556
7557 var broken = false;
7558 for (var j = 0; j < letters.length; j++) {
7559 var next = arg.slice(j+2);
7560
7561 if (next === '-') {
7562 setArg(letters[j], next, arg)
7563 continue;
7564 }
7565
7566 if (/[A-Za-z]/.test(letters[j]) && /=/.test(next)) {
7567 setArg(letters[j], next.split('=')[1], arg);
7568 broken = true;
7569 break;
7570 }
7571
7572 if (/[A-Za-z]/.test(letters[j])
7573 && /-?\d+(\.\d*)?(e-?\d+)?$/.test(next)) {
7574 setArg(letters[j], next, arg);
7575 broken = true;
7576 break;
7577 }
7578
7579 if (letters[j+1] && letters[j+1].match(/\W/)) {
7580 setArg(letters[j], arg.slice(j+2), arg);
7581 broken = true;
7582 break;
7583 }
7584 else {
7585 setArg(letters[j], flags.strings[letters[j]] ? '' : true, arg);
7586 }
7587 }
7588
7589 var key = arg.slice(-1)[0];
7590 if (!broken && key !== '-') {
7591 if (args[i+1] && !/^(-|--)[^-]/.test(args[i+1])
7592 && !flags.bools[key]
7593 && (aliases[key] ? !aliasIsBoolean(key) : true)) {
7594 setArg(key, args[i+1], arg);
7595 i++;
7596 }
7597 else if (args[i+1] && /true|false/.test(args[i+1])) {
7598 setArg(key, args[i+1] === 'true', arg);
7599 i++;
7600 }
7601 else {
7602 setArg(key, flags.strings[key] ? '' : true, arg);
7603 }
7604 }
7605 }
7606 else {
7607 if (!flags.unknownFn || flags.unknownFn(arg) !== false) {
7608 argv._.push(
7609 flags.strings['_'] || !isNumber(arg) ? arg : Number(arg)
7610 );
7611 }
7612 if (opts.stopEarly) {
7613 argv._.push.apply(argv._, args.slice(i + 1));
7614 break;
7615 }
7616 }
7617 }
7618
7619 Object.keys(defaults).forEach(function (key) {
7620 if (!hasKey(argv, key.split('.'))) {
7621 setKey(argv, key.split('.'), defaults[key]);
7622
7623 (aliases[key] || []).forEach(function (x) {
7624 setKey(argv, x.split('.'), defaults[key]);
7625 });
7626 }
7627 });
7628
7629 if (opts['--']) {
7630 argv['--'] = new Array();
7631 notFlags.forEach(function(key) {
7632 argv['--'].push(key);
7633 });
7634 }
7635 else {
7636 notFlags.forEach(function(key) {
7637 argv._.push(key);
7638 });
7639 }
7640
7641 return argv;
7642};
7643
7644function hasKey (obj, keys) {
7645 var o = obj;
7646 keys.slice(0,-1).forEach(function (key) {
7647 o = (o[key] || {});
7648 });
7649
7650 var key = keys[keys.length - 1];
7651 return key in o;
7652}
7653
7654function isNumber (x) {
7655 if (typeof x === 'number') return true;
7656 if (/^0x[0-9a-f]+$/i.test(x)) return true;
7657 return /^[-+]?(?:\d+(?:\.\d*)?|\.\d+)(e[-+]?\d+)?$/.test(x);
7658}
7659
7660
7661},{}],86:[function(require,module,exports){
7662/**
7663 * Helpers.
7664 */
7665
7666var s = 1000;
7667var m = s * 60;
7668var h = m * 60;
7669var d = h * 24;
7670var y = d * 365.25;
7671
7672/**
7673 * Parse or format the given `val`.
7674 *
7675 * Options:
7676 *
7677 * - `long` verbose formatting [false]
7678 *
7679 * @param {String|Number} val
7680 * @param {Object} options
7681 * @return {String|Number}
7682 * @api public
7683 */
7684
7685module.exports = function(val, options){
7686 options = options || {};
7687 if ('string' == typeof val) return parse(val);
7688 return options.long
7689 ? long(val)
7690 : short(val);
7691};
7692
7693/**
7694 * Parse the given `str` and return milliseconds.
7695 *
7696 * @param {String} str
7697 * @return {Number}
7698 * @api private
7699 */
7700
7701function parse(str) {
7702 str = '' + str;
7703 if (str.length > 10000) return;
7704 var match = /^((?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|years?|yrs?|y)?$/i.exec(str);
7705 if (!match) return;
7706 var n = parseFloat(match[1]);
7707 var type = (match[2] || 'ms').toLowerCase();
7708 switch (type) {
7709 case 'years':
7710 case 'year':
7711 case 'yrs':
7712 case 'yr':
7713 case 'y':
7714 return n * y;
7715 case 'days':
7716 case 'day':
7717 case 'd':
7718 return n * d;
7719 case 'hours':
7720 case 'hour':
7721 case 'hrs':
7722 case 'hr':
7723 case 'h':
7724 return n * h;
7725 case 'minutes':
7726 case 'minute':
7727 case 'mins':
7728 case 'min':
7729 case 'm':
7730 return n * m;
7731 case 'seconds':
7732 case 'second':
7733 case 'secs':
7734 case 'sec':
7735 case 's':
7736 return n * s;
7737 case 'milliseconds':
7738 case 'millisecond':
7739 case 'msecs':
7740 case 'msec':
7741 case 'ms':
7742 return n;
7743 }
7744}
7745
7746/**
7747 * Short format for `ms`.
7748 *
7749 * @param {Number} ms
7750 * @return {String}
7751 * @api private
7752 */
7753
7754function short(ms) {
7755 if (ms >= d) return Math.round(ms / d) + 'd';
7756 if (ms >= h) return Math.round(ms / h) + 'h';
7757 if (ms >= m) return Math.round(ms / m) + 'm';
7758 if (ms >= s) return Math.round(ms / s) + 's';
7759 return ms + 'ms';
7760}
7761
7762/**
7763 * Long format for `ms`.
7764 *
7765 * @param {Number} ms
7766 * @return {String}
7767 * @api private
7768 */
7769
7770function long(ms) {
7771 return plural(ms, d, 'day')
7772 || plural(ms, h, 'hour')
7773 || plural(ms, m, 'minute')
7774 || plural(ms, s, 'second')
7775 || ms + ' ms';
7776}
7777
7778/**
7779 * Pluralization helper.
7780 */
7781
7782function plural(ms, n, name) {
7783 if (ms < n) return;
7784 if (ms < n * 1.5) return Math.floor(ms / n) + ' ' + name;
7785 return Math.ceil(ms / n) + ' ' + name + 's';
7786}
7787
7788},{}],87:[function(require,module,exports){
7789(function (global){
7790/**
7791 * JSON parse.
7792 *
7793 * @see Based on jQuery#parseJSON (MIT) and JSON2
7794 * @api private
7795 */
7796
7797var rvalidchars = /^[\],:{}\s]*$/;
7798var rvalidescape = /\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g;
7799var rvalidtokens = /"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g;
7800var rvalidbraces = /(?:^|:|,)(?:\s*\[)+/g;
7801var rtrimLeft = /^\s+/;
7802var rtrimRight = /\s+$/;
7803
7804module.exports = function parsejson(data) {
7805 if ('string' != typeof data || !data) {
7806 return null;
7807 }
7808
7809 data = data.replace(rtrimLeft, '').replace(rtrimRight, '');
7810
7811 // Attempt to parse using the native JSON parser first
7812 if (global.JSON && JSON.parse) {
7813 return JSON.parse(data);
7814 }
7815
7816 if (rvalidchars.test(data.replace(rvalidescape, '@')
7817 .replace(rvalidtokens, ']')
7818 .replace(rvalidbraces, ''))) {
7819 return (new Function('return ' + data))();
7820 }
7821};
7822}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
7823},{}],88:[function(require,module,exports){
7824/**
7825 * Compiles a querystring
7826 * Returns string representation of the object
7827 *
7828 * @param {Object}
7829 * @api private
7830 */
7831
7832exports.encode = function (obj) {
7833 var str = '';
7834
7835 for (var i in obj) {
7836 if (obj.hasOwnProperty(i)) {
7837 if (str.length) str += '&';
7838 str += encodeURIComponent(i) + '=' + encodeURIComponent(obj[i]);
7839 }
7840 }
7841
7842 return str;
7843};
7844
7845/**
7846 * Parses a simple querystring into an object
7847 *
7848 * @param {String} qs
7849 * @api private
7850 */
7851
7852exports.decode = function(qs){
7853 var qry = {};
7854 var pairs = qs.split('&');
7855 for (var i = 0, l = pairs.length; i < l; i++) {
7856 var pair = pairs[i].split('=');
7857 qry[decodeURIComponent(pair[0])] = decodeURIComponent(pair[1]);
7858 }
7859 return qry;
7860};
7861
7862},{}],89:[function(require,module,exports){
7863/**
7864 * Parses an URI
7865 *
7866 * @author Steven Levithan <stevenlevithan.com> (MIT license)
7867 * @api private
7868 */
7869
7870var re = /^(?:(?![^:@]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@]*)(?::([^:@]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/;
7871
7872var parts = [
7873 'source', 'protocol', 'authority', 'userInfo', 'user', 'password', 'host', 'port', 'relative', 'path', 'directory', 'file', 'query', 'anchor'
7874];
7875
7876module.exports = function parseuri(str) {
7877 var src = str,
7878 b = str.indexOf('['),
7879 e = str.indexOf(']');
7880
7881 if (b != -1 && e != -1) {
7882 str = str.substring(0, b) + str.substring(b, e).replace(/:/g, ';') + str.substring(e, str.length);
7883 }
7884
7885 var m = re.exec(str || ''),
7886 uri = {},
7887 i = 14;
7888
7889 while (i--) {
7890 uri[parts[i]] = m[i] || '';
7891 }
7892
7893 if (b != -1 && e != -1) {
7894 uri.source = src;
7895 uri.host = uri.host.substring(1, uri.host.length - 1).replace(/;/g, ':');
7896 uri.authority = uri.authority.replace('[', '').replace(']', '').replace(/;/g, ':');
7897 uri.ipv6uri = true;
7898 }
7899
7900 return uri;
7901};
7902
7903},{}],90:[function(require,module,exports){
7904(function (process){
7905// Copyright Joyent, Inc. and other Node contributors.
7906//
7907// Permission is hereby granted, free of charge, to any person obtaining a
7908// copy of this software and associated documentation files (the
7909// "Software"), to deal in the Software without restriction, including
7910// without limitation the rights to use, copy, modify, merge, publish,
7911// distribute, sublicense, and/or sell copies of the Software, and to permit
7912// persons to whom the Software is furnished to do so, subject to the
7913// following conditions:
7914//
7915// The above copyright notice and this permission notice shall be included
7916// in all copies or substantial portions of the Software.
7917//
7918// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
7919// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
7920// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
7921// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
7922// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
7923// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
7924// USE OR OTHER DEALINGS IN THE SOFTWARE.
7925
7926// resolves . and .. elements in a path array with directory names there
7927// must be no slashes, empty elements, or device names (c:\) in the array
7928// (so also no leading and trailing slashes - it does not distinguish
7929// relative and absolute paths)
7930function normalizeArray(parts, allowAboveRoot) {
7931 // if the path tries to go above the root, `up` ends up > 0
7932 var up = 0;
7933 for (var i = parts.length - 1; i >= 0; i--) {
7934 var last = parts[i];
7935 if (last === '.') {
7936 parts.splice(i, 1);
7937 } else if (last === '..') {
7938 parts.splice(i, 1);
7939 up++;
7940 } else if (up) {
7941 parts.splice(i, 1);
7942 up--;
7943 }
7944 }
7945
7946 // if the path is allowed to go above the root, restore leading ..s
7947 if (allowAboveRoot) {
7948 for (; up--; up) {
7949 parts.unshift('..');
7950 }
7951 }
7952
7953 return parts;
7954}
7955
7956// Split a filename into [root, dir, basename, ext], unix version
7957// 'root' is just a slash, or nothing.
7958var splitPathRe =
7959 /^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/;
7960var splitPath = function(filename) {
7961 return splitPathRe.exec(filename).slice(1);
7962};
7963
7964// path.resolve([from ...], to)
7965// posix version
7966exports.resolve = function() {
7967 var resolvedPath = '',
7968 resolvedAbsolute = false;
7969
7970 for (var i = arguments.length - 1; i >= -1 && !resolvedAbsolute; i--) {
7971 var path = (i >= 0) ? arguments[i] : process.cwd();
7972
7973 // Skip empty and invalid entries
7974 if (typeof path !== 'string') {
7975 throw new TypeError('Arguments to path.resolve must be strings');
7976 } else if (!path) {
7977 continue;
7978 }
7979
7980 resolvedPath = path + '/' + resolvedPath;
7981 resolvedAbsolute = path.charAt(0) === '/';
7982 }
7983
7984 // At this point the path should be resolved to a full absolute path, but
7985 // handle relative paths to be safe (might happen when process.cwd() fails)
7986
7987 // Normalize the path
7988 resolvedPath = normalizeArray(filter(resolvedPath.split('/'), function(p) {
7989 return !!p;
7990 }), !resolvedAbsolute).join('/');
7991
7992 return ((resolvedAbsolute ? '/' : '') + resolvedPath) || '.';
7993};
7994
7995// path.normalize(path)
7996// posix version
7997exports.normalize = function(path) {
7998 var isAbsolute = exports.isAbsolute(path),
7999 trailingSlash = substr(path, -1) === '/';
8000
8001 // Normalize the path
8002 path = normalizeArray(filter(path.split('/'), function(p) {
8003 return !!p;
8004 }), !isAbsolute).join('/');
8005
8006 if (!path && !isAbsolute) {
8007 path = '.';
8008 }
8009 if (path && trailingSlash) {
8010 path += '/';
8011 }
8012
8013 return (isAbsolute ? '/' : '') + path;
8014};
8015
8016// posix version
8017exports.isAbsolute = function(path) {
8018 return path.charAt(0) === '/';
8019};
8020
8021// posix version
8022exports.join = function() {
8023 var paths = Array.prototype.slice.call(arguments, 0);
8024 return exports.normalize(filter(paths, function(p, index) {
8025 if (typeof p !== 'string') {
8026 throw new TypeError('Arguments to path.join must be strings');
8027 }
8028 return p;
8029 }).join('/'));
8030};
8031
8032
8033// path.relative(from, to)
8034// posix version
8035exports.relative = function(from, to) {
8036 from = exports.resolve(from).substr(1);
8037 to = exports.resolve(to).substr(1);
8038
8039 function trim(arr) {
8040 var start = 0;
8041 for (; start < arr.length; start++) {
8042 if (arr[start] !== '') break;
8043 }
8044
8045 var end = arr.length - 1;
8046 for (; end >= 0; end--) {
8047 if (arr[end] !== '') break;
8048 }
8049
8050 if (start > end) return [];
8051 return arr.slice(start, end - start + 1);
8052 }
8053
8054 var fromParts = trim(from.split('/'));
8055 var toParts = trim(to.split('/'));
8056
8057 var length = Math.min(fromParts.length, toParts.length);
8058 var samePartsLength = length;
8059 for (var i = 0; i < length; i++) {
8060 if (fromParts[i] !== toParts[i]) {
8061 samePartsLength = i;
8062 break;
8063 }
8064 }
8065
8066 var outputParts = [];
8067 for (var i = samePartsLength; i < fromParts.length; i++) {
8068 outputParts.push('..');
8069 }
8070
8071 outputParts = outputParts.concat(toParts.slice(samePartsLength));
8072
8073 return outputParts.join('/');
8074};
8075
8076exports.sep = '/';
8077exports.delimiter = ':';
8078
8079exports.dirname = function(path) {
8080 var result = splitPath(path),
8081 root = result[0],
8082 dir = result[1];
8083
8084 if (!root && !dir) {
8085 // No dirname whatsoever
8086 return '.';
8087 }
8088
8089 if (dir) {
8090 // It has a dirname, strip trailing slash
8091 dir = dir.substr(0, dir.length - 1);
8092 }
8093
8094 return root + dir;
8095};
8096
8097
8098exports.basename = function(path, ext) {
8099 var f = splitPath(path)[2];
8100 // TODO: make this comparison case-insensitive on windows?
8101 if (ext && f.substr(-1 * ext.length) === ext) {
8102 f = f.substr(0, f.length - ext.length);
8103 }
8104 return f;
8105};
8106
8107
8108exports.extname = function(path) {
8109 return splitPath(path)[3];
8110};
8111
8112function filter (xs, f) {
8113 if (xs.filter) return xs.filter(f);
8114 var res = [];
8115 for (var i = 0; i < xs.length; i++) {
8116 if (f(xs[i], i, xs)) res.push(xs[i]);
8117 }
8118 return res;
8119}
8120
8121// String.prototype.substr - negative index don't work in IE8
8122var substr = 'ab'.substr(-1) === 'b'
8123 ? function (str, start, len) { return str.substr(start, len) }
8124 : function (str, start, len) {
8125 if (start < 0) start = str.length + start;
8126 return str.substr(start, len);
8127 }
8128;
8129
8130}).call(this,require(91))
8131},{"91":91}],91:[function(require,module,exports){
8132// shim for using process in browser
8133
8134var process = module.exports = {};
8135var queue = [];
8136var draining = false;
8137var currentQueue;
8138var queueIndex = -1;
8139
8140function cleanUpNextTick() {
8141 draining = false;
8142 if (currentQueue.length) {
8143 queue = currentQueue.concat(queue);
8144 } else {
8145 queueIndex = -1;
8146 }
8147 if (queue.length) {
8148 drainQueue();
8149 }
8150}
8151
8152function drainQueue() {
8153 if (draining) {
8154 return;
8155 }
8156 var timeout = setTimeout(cleanUpNextTick);
8157 draining = true;
8158
8159 var len = queue.length;
8160 while(len) {
8161 currentQueue = queue;
8162 queue = [];
8163 while (++queueIndex < len) {
8164 if (currentQueue) {
8165 currentQueue[queueIndex].run();
8166 }
8167 }
8168 queueIndex = -1;
8169 len = queue.length;
8170 }
8171 currentQueue = null;
8172 draining = false;
8173 clearTimeout(timeout);
8174}
8175
8176process.nextTick = function (fun) {
8177 var args = new Array(arguments.length - 1);
8178 if (arguments.length > 1) {
8179 for (var i = 1; i < arguments.length; i++) {
8180 args[i - 1] = arguments[i];
8181 }
8182 }
8183 queue.push(new Item(fun, args));
8184 if (queue.length === 1 && !draining) {
8185 setTimeout(drainQueue, 0);
8186 }
8187};
8188
8189// v8 likes predictible objects
8190function Item(fun, array) {
8191 this.fun = fun;
8192 this.array = array;
8193}
8194Item.prototype.run = function () {
8195 this.fun.apply(null, this.array);
8196};
8197process.title = 'browser';
8198process.browser = true;
8199process.env = {};
8200process.argv = [];
8201process.version = ''; // empty string to avoid regexp issues
8202process.versions = {};
8203
8204function noop() {}
8205
8206process.on = noop;
8207process.addListener = noop;
8208process.once = noop;
8209process.off = noop;
8210process.removeListener = noop;
8211process.removeAllListeners = noop;
8212process.emit = noop;
8213
8214process.binding = function (name) {
8215 throw new Error('process.binding is not supported');
8216};
8217
8218process.cwd = function () { return '/' };
8219process.chdir = function (dir) {
8220 throw new Error('process.chdir is not supported');
8221};
8222process.umask = function() { return 0; };
8223
8224},{}],92:[function(require,module,exports){
8225(function (global){
8226/*! https://mths.be/punycode v1.4.0 by @mathias */
8227;(function(root) {
8228
8229 /** Detect free variables */
8230 var freeExports = typeof exports == 'object' && exports &&
8231 !exports.nodeType && exports;
8232 var freeModule = typeof module == 'object' && module &&
8233 !module.nodeType && module;
8234 var freeGlobal = typeof global == 'object' && global;
8235 if (
8236 freeGlobal.global === freeGlobal ||
8237 freeGlobal.window === freeGlobal ||
8238 freeGlobal.self === freeGlobal
8239 ) {
8240 root = freeGlobal;
8241 }
8242
8243 /**
8244 * The `punycode` object.
8245 * @name punycode
8246 * @type Object
8247 */
8248 var punycode,
8249
8250 /** Highest positive signed 32-bit float value */
8251 maxInt = 2147483647, // aka. 0x7FFFFFFF or 2^31-1
8252
8253 /** Bootstring parameters */
8254 base = 36,
8255 tMin = 1,
8256 tMax = 26,
8257 skew = 38,
8258 damp = 700,
8259 initialBias = 72,
8260 initialN = 128, // 0x80
8261 delimiter = '-', // '\x2D'
8262
8263 /** Regular expressions */
8264 regexPunycode = /^xn--/,
8265 regexNonASCII = /[^\x20-\x7E]/, // unprintable ASCII chars + non-ASCII chars
8266 regexSeparators = /[\x2E\u3002\uFF0E\uFF61]/g, // RFC 3490 separators
8267
8268 /** Error messages */
8269 errors = {
8270 'overflow': 'Overflow: input needs wider integers to process',
8271 'not-basic': 'Illegal input >= 0x80 (not a basic code point)',
8272 'invalid-input': 'Invalid input'
8273 },
8274
8275 /** Convenience shortcuts */
8276 baseMinusTMin = base - tMin,
8277 floor = Math.floor,
8278 stringFromCharCode = String.fromCharCode,
8279
8280 /** Temporary variable */
8281 key;
8282
8283 /*--------------------------------------------------------------------------*/
8284
8285 /**
8286 * A generic error utility function.
8287 * @private
8288 * @param {String} type The error type.
8289 * @returns {Error} Throws a `RangeError` with the applicable error message.
8290 */
8291 function error(type) {
8292 throw new RangeError(errors[type]);
8293 }
8294
8295 /**
8296 * A generic `Array#map` utility function.
8297 * @private
8298 * @param {Array} array The array to iterate over.
8299 * @param {Function} callback The function that gets called for every array
8300 * item.
8301 * @returns {Array} A new array of values returned by the callback function.
8302 */
8303 function map(array, fn) {
8304 var length = array.length;
8305 var result = [];
8306 while (length--) {
8307 result[length] = fn(array[length]);
8308 }
8309 return result;
8310 }
8311
8312 /**
8313 * A simple `Array#map`-like wrapper to work with domain name strings or email
8314 * addresses.
8315 * @private
8316 * @param {String} domain The domain name or email address.
8317 * @param {Function} callback The function that gets called for every
8318 * character.
8319 * @returns {Array} A new string of characters returned by the callback
8320 * function.
8321 */
8322 function mapDomain(string, fn) {
8323 var parts = string.split('@');
8324 var result = '';
8325 if (parts.length > 1) {
8326 // In email addresses, only the domain name should be punycoded. Leave
8327 // the local part (i.e. everything up to `@`) intact.
8328 result = parts[0] + '@';
8329 string = parts[1];
8330 }
8331 // Avoid `split(regex)` for IE8 compatibility. See #17.
8332 string = string.replace(regexSeparators, '\x2E');
8333 var labels = string.split('.');
8334 var encoded = map(labels, fn).join('.');
8335 return result + encoded;
8336 }
8337
8338 /**
8339 * Creates an array containing the numeric code points of each Unicode
8340 * character in the string. While JavaScript uses UCS-2 internally,
8341 * this function will convert a pair of surrogate halves (each of which
8342 * UCS-2 exposes as separate characters) into a single code point,
8343 * matching UTF-16.
8344 * @see `punycode.ucs2.encode`
8345 * @see <https://mathiasbynens.be/notes/javascript-encoding>
8346 * @memberOf punycode.ucs2
8347 * @name decode
8348 * @param {String} string The Unicode input string (UCS-2).
8349 * @returns {Array} The new array of code points.
8350 */
8351 function ucs2decode(string) {
8352 var output = [],
8353 counter = 0,
8354 length = string.length,
8355 value,
8356 extra;
8357 while (counter < length) {
8358 value = string.charCodeAt(counter++);
8359 if (value >= 0xD800 && value <= 0xDBFF && counter < length) {
8360 // high surrogate, and there is a next character
8361 extra = string.charCodeAt(counter++);
8362 if ((extra & 0xFC00) == 0xDC00) { // low surrogate
8363 output.push(((value & 0x3FF) << 10) + (extra & 0x3FF) + 0x10000);
8364 } else {
8365 // unmatched surrogate; only append this code unit, in case the next
8366 // code unit is the high surrogate of a surrogate pair
8367 output.push(value);
8368 counter--;
8369 }
8370 } else {
8371 output.push(value);
8372 }
8373 }
8374 return output;
8375 }
8376
8377 /**
8378 * Creates a string based on an array of numeric code points.
8379 * @see `punycode.ucs2.decode`
8380 * @memberOf punycode.ucs2
8381 * @name encode
8382 * @param {Array} codePoints The array of numeric code points.
8383 * @returns {String} The new Unicode string (UCS-2).
8384 */
8385 function ucs2encode(array) {
8386 return map(array, function(value) {
8387 var output = '';
8388 if (value > 0xFFFF) {
8389 value -= 0x10000;
8390 output += stringFromCharCode(value >>> 10 & 0x3FF | 0xD800);
8391 value = 0xDC00 | value & 0x3FF;
8392 }
8393 output += stringFromCharCode(value);
8394 return output;
8395 }).join('');
8396 }
8397
8398 /**
8399 * Converts a basic code point into a digit/integer.
8400 * @see `digitToBasic()`
8401 * @private
8402 * @param {Number} codePoint The basic numeric code point value.
8403 * @returns {Number} The numeric value of a basic code point (for use in
8404 * representing integers) in the range `0` to `base - 1`, or `base` if
8405 * the code point does not represent a value.
8406 */
8407 function basicToDigit(codePoint) {
8408 if (codePoint - 48 < 10) {
8409 return codePoint - 22;
8410 }
8411 if (codePoint - 65 < 26) {
8412 return codePoint - 65;
8413 }
8414 if (codePoint - 97 < 26) {
8415 return codePoint - 97;
8416 }
8417 return base;
8418 }
8419
8420 /**
8421 * Converts a digit/integer into a basic code point.
8422 * @see `basicToDigit()`
8423 * @private
8424 * @param {Number} digit The numeric value of a basic code point.
8425 * @returns {Number} The basic code point whose value (when used for
8426 * representing integers) is `digit`, which needs to be in the range
8427 * `0` to `base - 1`. If `flag` is non-zero, the uppercase form is
8428 * used; else, the lowercase form is used. The behavior is undefined
8429 * if `flag` is non-zero and `digit` has no uppercase form.
8430 */
8431 function digitToBasic(digit, flag) {
8432 // 0..25 map to ASCII a..z or A..Z
8433 // 26..35 map to ASCII 0..9
8434 return digit + 22 + 75 * (digit < 26) - ((flag != 0) << 5);
8435 }
8436
8437 /**
8438 * Bias adaptation function as per section 3.4 of RFC 3492.
8439 * https://tools.ietf.org/html/rfc3492#section-3.4
8440 * @private
8441 */
8442 function adapt(delta, numPoints, firstTime) {
8443 var k = 0;
8444 delta = firstTime ? floor(delta / damp) : delta >> 1;
8445 delta += floor(delta / numPoints);
8446 for (/* no initialization */; delta > baseMinusTMin * tMax >> 1; k += base) {
8447 delta = floor(delta / baseMinusTMin);
8448 }
8449 return floor(k + (baseMinusTMin + 1) * delta / (delta + skew));
8450 }
8451
8452 /**
8453 * Converts a Punycode string of ASCII-only symbols to a string of Unicode
8454 * symbols.
8455 * @memberOf punycode
8456 * @param {String} input The Punycode string of ASCII-only symbols.
8457 * @returns {String} The resulting string of Unicode symbols.
8458 */
8459 function decode(input) {
8460 // Don't use UCS-2
8461 var output = [],
8462 inputLength = input.length,
8463 out,
8464 i = 0,
8465 n = initialN,
8466 bias = initialBias,
8467 basic,
8468 j,
8469 index,
8470 oldi,
8471 w,
8472 k,
8473 digit,
8474 t,
8475 /** Cached calculation results */
8476 baseMinusT;
8477
8478 // Handle the basic code points: let `basic` be the number of input code
8479 // points before the last delimiter, or `0` if there is none, then copy
8480 // the first basic code points to the output.
8481
8482 basic = input.lastIndexOf(delimiter);
8483 if (basic < 0) {
8484 basic = 0;
8485 }
8486
8487 for (j = 0; j < basic; ++j) {
8488 // if it's not a basic code point
8489 if (input.charCodeAt(j) >= 0x80) {
8490 error('not-basic');
8491 }
8492 output.push(input.charCodeAt(j));
8493 }
8494
8495 // Main decoding loop: start just after the last delimiter if any basic code
8496 // points were copied; start at the beginning otherwise.
8497
8498 for (index = basic > 0 ? basic + 1 : 0; index < inputLength; /* no final expression */) {
8499
8500 // `index` is the index of the next character to be consumed.
8501 // Decode a generalized variable-length integer into `delta`,
8502 // which gets added to `i`. The overflow checking is easier
8503 // if we increase `i` as we go, then subtract off its starting
8504 // value at the end to obtain `delta`.
8505 for (oldi = i, w = 1, k = base; /* no condition */; k += base) {
8506
8507 if (index >= inputLength) {
8508 error('invalid-input');
8509 }
8510
8511 digit = basicToDigit(input.charCodeAt(index++));
8512
8513 if (digit >= base || digit > floor((maxInt - i) / w)) {
8514 error('overflow');
8515 }
8516
8517 i += digit * w;
8518 t = k <= bias ? tMin : (k >= bias + tMax ? tMax : k - bias);
8519
8520 if (digit < t) {
8521 break;
8522 }
8523
8524 baseMinusT = base - t;
8525 if (w > floor(maxInt / baseMinusT)) {
8526 error('overflow');
8527 }
8528
8529 w *= baseMinusT;
8530
8531 }
8532
8533 out = output.length + 1;
8534 bias = adapt(i - oldi, out, oldi == 0);
8535
8536 // `i` was supposed to wrap around from `out` to `0`,
8537 // incrementing `n` each time, so we'll fix that now:
8538 if (floor(i / out) > maxInt - n) {
8539 error('overflow');
8540 }
8541
8542 n += floor(i / out);
8543 i %= out;
8544
8545 // Insert `n` at position `i` of the output
8546 output.splice(i++, 0, n);
8547
8548 }
8549
8550 return ucs2encode(output);
8551 }
8552
8553 /**
8554 * Converts a string of Unicode symbols (e.g. a domain name label) to a
8555 * Punycode string of ASCII-only symbols.
8556 * @memberOf punycode
8557 * @param {String} input The string of Unicode symbols.
8558 * @returns {String} The resulting Punycode string of ASCII-only symbols.
8559 */
8560 function encode(input) {
8561 var n,
8562 delta,
8563 handledCPCount,
8564 basicLength,
8565 bias,
8566 j,
8567 m,
8568 q,
8569 k,
8570 t,
8571 currentValue,
8572 output = [],
8573 /** `inputLength` will hold the number of code points in `input`. */
8574 inputLength,
8575 /** Cached calculation results */
8576 handledCPCountPlusOne,
8577 baseMinusT,
8578 qMinusT;
8579
8580 // Convert the input in UCS-2 to Unicode
8581 input = ucs2decode(input);
8582
8583 // Cache the length
8584 inputLength = input.length;
8585
8586 // Initialize the state
8587 n = initialN;
8588 delta = 0;
8589 bias = initialBias;
8590
8591 // Handle the basic code points
8592 for (j = 0; j < inputLength; ++j) {
8593 currentValue = input[j];
8594 if (currentValue < 0x80) {
8595 output.push(stringFromCharCode(currentValue));
8596 }
8597 }
8598
8599 handledCPCount = basicLength = output.length;
8600
8601 // `handledCPCount` is the number of code points that have been handled;
8602 // `basicLength` is the number of basic code points.
8603
8604 // Finish the basic string - if it is not empty - with a delimiter
8605 if (basicLength) {
8606 output.push(delimiter);
8607 }
8608
8609 // Main encoding loop:
8610 while (handledCPCount < inputLength) {
8611
8612 // All non-basic code points < n have been handled already. Find the next
8613 // larger one:
8614 for (m = maxInt, j = 0; j < inputLength; ++j) {
8615 currentValue = input[j];
8616 if (currentValue >= n && currentValue < m) {
8617 m = currentValue;
8618 }
8619 }
8620
8621 // Increase `delta` enough to advance the decoder's <n,i> state to <m,0>,
8622 // but guard against overflow
8623 handledCPCountPlusOne = handledCPCount + 1;
8624 if (m - n > floor((maxInt - delta) / handledCPCountPlusOne)) {
8625 error('overflow');
8626 }
8627
8628 delta += (m - n) * handledCPCountPlusOne;
8629 n = m;
8630
8631 for (j = 0; j < inputLength; ++j) {
8632 currentValue = input[j];
8633
8634 if (currentValue < n && ++delta > maxInt) {
8635 error('overflow');
8636 }
8637
8638 if (currentValue == n) {
8639 // Represent delta as a generalized variable-length integer
8640 for (q = delta, k = base; /* no condition */; k += base) {
8641 t = k <= bias ? tMin : (k >= bias + tMax ? tMax : k - bias);
8642 if (q < t) {
8643 break;
8644 }
8645 qMinusT = q - t;
8646 baseMinusT = base - t;
8647 output.push(
8648 stringFromCharCode(digitToBasic(t + qMinusT % baseMinusT, 0))
8649 );
8650 q = floor(qMinusT / baseMinusT);
8651 }
8652
8653 output.push(stringFromCharCode(digitToBasic(q, 0)));
8654 bias = adapt(delta, handledCPCountPlusOne, handledCPCount == basicLength);
8655 delta = 0;
8656 ++handledCPCount;
8657 }
8658 }
8659
8660 ++delta;
8661 ++n;
8662
8663 }
8664 return output.join('');
8665 }
8666
8667 /**
8668 * Converts a Punycode string representing a domain name or an email address
8669 * to Unicode. Only the Punycoded parts of the input will be converted, i.e.
8670 * it doesn't matter if you call it on a string that has already been
8671 * converted to Unicode.
8672 * @memberOf punycode
8673 * @param {String} input The Punycoded domain name or email address to
8674 * convert to Unicode.
8675 * @returns {String} The Unicode representation of the given Punycode
8676 * string.
8677 */
8678 function toUnicode(input) {
8679 return mapDomain(input, function(string) {
8680 return regexPunycode.test(string)
8681 ? decode(string.slice(4).toLowerCase())
8682 : string;
8683 });
8684 }
8685
8686 /**
8687 * Converts a Unicode string representing a domain name or an email address to
8688 * Punycode. Only the non-ASCII parts of the domain name will be converted,
8689 * i.e. it doesn't matter if you call it with a domain that's already in
8690 * ASCII.
8691 * @memberOf punycode
8692 * @param {String} input The domain name or email address to convert, as a
8693 * Unicode string.
8694 * @returns {String} The Punycode representation of the given domain name or
8695 * email address.
8696 */
8697 function toASCII(input) {
8698 return mapDomain(input, function(string) {
8699 return regexNonASCII.test(string)
8700 ? 'xn--' + encode(string)
8701 : string;
8702 });
8703 }
8704
8705 /*--------------------------------------------------------------------------*/
8706
8707 /** Define the public API */
8708 punycode = {
8709 /**
8710 * A string representing the current Punycode.js version number.
8711 * @memberOf punycode
8712 * @type String
8713 */
8714 'version': '1.3.2',
8715 /**
8716 * An object of methods to convert from JavaScript's internal character
8717 * representation (UCS-2) to Unicode code points, and back.
8718 * @see <https://mathiasbynens.be/notes/javascript-encoding>
8719 * @memberOf punycode
8720 * @type Object
8721 */
8722 'ucs2': {
8723 'decode': ucs2decode,
8724 'encode': ucs2encode
8725 },
8726 'decode': decode,
8727 'encode': encode,
8728 'toASCII': toASCII,
8729 'toUnicode': toUnicode
8730 };
8731
8732 /** Expose `punycode` */
8733 // Some AMD build optimizers, like r.js, check for specific condition patterns
8734 // like the following:
8735 if (
8736 typeof define == 'function' &&
8737 typeof define.amd == 'object' &&
8738 define.amd
8739 ) {
8740 define('punycode', function() {
8741 return punycode;
8742 });
8743 } else if (freeExports && freeModule) {
8744 if (module.exports == freeExports) {
8745 // in Node.js, io.js, or RingoJS v0.8.0+
8746 freeModule.exports = punycode;
8747 } else {
8748 // in Narwhal or RingoJS v0.7.0-
8749 for (key in punycode) {
8750 punycode.hasOwnProperty(key) && (freeExports[key] = punycode[key]);
8751 }
8752 }
8753 } else {
8754 // in Rhino or a web browser
8755 root.punycode = punycode;
8756 }
8757
8758}(this));
8759
8760}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
8761},{}],93:[function(require,module,exports){
8762'use strict';
8763var strictUriEncode = require(331);
8764
8765exports.extract = function (str) {
8766 return str.split('?')[1] || '';
8767};
8768
8769exports.parse = function (str) {
8770 if (typeof str !== 'string') {
8771 return {};
8772 }
8773
8774 str = str.trim().replace(/^(\?|#|&)/, '');
8775
8776 if (!str) {
8777 return {};
8778 }
8779
8780 return str.split('&').reduce(function (ret, param) {
8781 var parts = param.replace(/\+/g, ' ').split('=');
8782 // Firefox (pre 40) decodes `%3D` to `=`
8783 // https://github.com/sindresorhus/query-string/pull/37
8784 var key = parts.shift();
8785 var val = parts.length > 0 ? parts.join('=') : undefined;
8786
8787 key = decodeURIComponent(key);
8788
8789 // missing `=` should be `null`:
8790 // http://w3.org/TR/2012/WD-url-20120524/#collect-url-parameters
8791 val = val === undefined ? null : decodeURIComponent(val);
8792
8793 if (!ret.hasOwnProperty(key)) {
8794 ret[key] = val;
8795 } else if (Array.isArray(ret[key])) {
8796 ret[key].push(val);
8797 } else {
8798 ret[key] = [ret[key], val];
8799 }
8800
8801 return ret;
8802 }, {});
8803};
8804
8805exports.stringify = function (obj) {
8806 return obj ? Object.keys(obj).sort().map(function (key) {
8807 var val = obj[key];
8808
8809 if (val === undefined) {
8810 return '';
8811 }
8812
8813 if (val === null) {
8814 return key;
8815 }
8816
8817 if (Array.isArray(val)) {
8818 return val.sort().map(function (val2) {
8819 return strictUriEncode(key) + '=' + strictUriEncode(val2);
8820 }).join('&');
8821 }
8822
8823 return strictUriEncode(key) + '=' + strictUriEncode(val);
8824 }).filter(function (x) {
8825 return x.length > 0;
8826 }).join('&') : '';
8827};
8828
8829},{"331":331}],94:[function(require,module,exports){
8830// Copyright Joyent, Inc. and other Node contributors.
8831//
8832// Permission is hereby granted, free of charge, to any person obtaining a
8833// copy of this software and associated documentation files (the
8834// "Software"), to deal in the Software without restriction, including
8835// without limitation the rights to use, copy, modify, merge, publish,
8836// distribute, sublicense, and/or sell copies of the Software, and to permit
8837// persons to whom the Software is furnished to do so, subject to the
8838// following conditions:
8839//
8840// The above copyright notice and this permission notice shall be included
8841// in all copies or substantial portions of the Software.
8842//
8843// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
8844// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
8845// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
8846// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
8847// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
8848// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
8849// USE OR OTHER DEALINGS IN THE SOFTWARE.
8850
8851'use strict';
8852
8853// If obj.hasOwnProperty has been overridden, then calling
8854// obj.hasOwnProperty(prop) will break.
8855// See: https://github.com/joyent/node/issues/1707
8856function hasOwnProperty(obj, prop) {
8857 return Object.prototype.hasOwnProperty.call(obj, prop);
8858}
8859
8860module.exports = function(qs, sep, eq, options) {
8861 sep = sep || '&';
8862 eq = eq || '=';
8863 var obj = {};
8864
8865 if (typeof qs !== 'string' || qs.length === 0) {
8866 return obj;
8867 }
8868
8869 var regexp = /\+/g;
8870 qs = qs.split(sep);
8871
8872 var maxKeys = 1000;
8873 if (options && typeof options.maxKeys === 'number') {
8874 maxKeys = options.maxKeys;
8875 }
8876
8877 var len = qs.length;
8878 // maxKeys <= 0 means that we should not limit keys count
8879 if (maxKeys > 0 && len > maxKeys) {
8880 len = maxKeys;
8881 }
8882
8883 for (var i = 0; i < len; ++i) {
8884 var x = qs[i].replace(regexp, '%20'),
8885 idx = x.indexOf(eq),
8886 kstr, vstr, k, v;
8887
8888 if (idx >= 0) {
8889 kstr = x.substr(0, idx);
8890 vstr = x.substr(idx + 1);
8891 } else {
8892 kstr = x;
8893 vstr = '';
8894 }
8895
8896 k = decodeURIComponent(kstr);
8897 v = decodeURIComponent(vstr);
8898
8899 if (!hasOwnProperty(obj, k)) {
8900 obj[k] = v;
8901 } else if (isArray(obj[k])) {
8902 obj[k].push(v);
8903 } else {
8904 obj[k] = [obj[k], v];
8905 }
8906 }
8907
8908 return obj;
8909};
8910
8911var isArray = Array.isArray || function (xs) {
8912 return Object.prototype.toString.call(xs) === '[object Array]';
8913};
8914
8915},{}],95:[function(require,module,exports){
8916// Copyright Joyent, Inc. and other Node contributors.
8917//
8918// Permission is hereby granted, free of charge, to any person obtaining a
8919// copy of this software and associated documentation files (the
8920// "Software"), to deal in the Software without restriction, including
8921// without limitation the rights to use, copy, modify, merge, publish,
8922// distribute, sublicense, and/or sell copies of the Software, and to permit
8923// persons to whom the Software is furnished to do so, subject to the
8924// following conditions:
8925//
8926// The above copyright notice and this permission notice shall be included
8927// in all copies or substantial portions of the Software.
8928//
8929// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
8930// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
8931// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
8932// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
8933// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
8934// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
8935// USE OR OTHER DEALINGS IN THE SOFTWARE.
8936
8937'use strict';
8938
8939var stringifyPrimitive = function(v) {
8940 switch (typeof v) {
8941 case 'string':
8942 return v;
8943
8944 case 'boolean':
8945 return v ? 'true' : 'false';
8946
8947 case 'number':
8948 return isFinite(v) ? v : '';
8949
8950 default:
8951 return '';
8952 }
8953};
8954
8955module.exports = function(obj, sep, eq, name) {
8956 sep = sep || '&';
8957 eq = eq || '=';
8958 if (obj === null) {
8959 obj = undefined;
8960 }
8961
8962 if (typeof obj === 'object') {
8963 return map(objectKeys(obj), function(k) {
8964 var ks = encodeURIComponent(stringifyPrimitive(k)) + eq;
8965 if (isArray(obj[k])) {
8966 return map(obj[k], function(v) {
8967 return ks + encodeURIComponent(stringifyPrimitive(v));
8968 }).join(sep);
8969 } else {
8970 return ks + encodeURIComponent(stringifyPrimitive(obj[k]));
8971 }
8972 }).join(sep);
8973
8974 }
8975
8976 if (!name) return '';
8977 return encodeURIComponent(stringifyPrimitive(name)) + eq +
8978 encodeURIComponent(stringifyPrimitive(obj));
8979};
8980
8981var isArray = Array.isArray || function (xs) {
8982 return Object.prototype.toString.call(xs) === '[object Array]';
8983};
8984
8985function map (xs, f) {
8986 if (xs.map) return xs.map(f);
8987 var res = [];
8988 for (var i = 0; i < xs.length; i++) {
8989 res.push(f(xs[i], i));
8990 }
8991 return res;
8992}
8993
8994var objectKeys = Object.keys || function (obj) {
8995 var res = [];
8996 for (var key in obj) {
8997 if (Object.prototype.hasOwnProperty.call(obj, key)) res.push(key);
8998 }
8999 return res;
9000};
9001
9002},{}],96:[function(require,module,exports){
9003'use strict';
9004
9005exports.decode = exports.parse = require(94);
9006exports.encode = exports.stringify = require(95);
9007
9008},{"94":94,"95":95}],97:[function(require,module,exports){
9009'use strict';
9010
9011module.exports = require(195);
9012
9013},{"195":195}],98:[function(require,module,exports){
9014(function (process){
9015'use strict';
9016
9017exports.__esModule = true;
9018exports["default"] = undefined;
9019
9020var _react = require(297);
9021
9022var _storeShape = require(102);
9023
9024var _storeShape2 = _interopRequireDefault(_storeShape);
9025
9026var _warning = require(103);
9027
9028var _warning2 = _interopRequireDefault(_warning);
9029
9030function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
9031
9032function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
9033
9034function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
9035
9036function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
9037
9038var didWarnAboutReceivingStore = false;
9039function warnAboutReceivingStore() {
9040 if (didWarnAboutReceivingStore) {
9041 return;
9042 }
9043 didWarnAboutReceivingStore = true;
9044
9045 (0, _warning2["default"])('<Provider> does not support changing `store` on the fly. ' + 'It is most likely that you see this error because you updated to ' + 'Redux 2.x and React Redux 2.x which no longer hot reload reducers ' + 'automatically. See https://github.com/reactjs/react-redux/releases/' + 'tag/v2.0.0 for the migration instructions.');
9046}
9047
9048var Provider = function (_Component) {
9049 _inherits(Provider, _Component);
9050
9051 Provider.prototype.getChildContext = function getChildContext() {
9052 return { store: this.store };
9053 };
9054
9055 function Provider(props, context) {
9056 _classCallCheck(this, Provider);
9057
9058 var _this = _possibleConstructorReturn(this, _Component.call(this, props, context));
9059
9060 _this.store = props.store;
9061 return _this;
9062 }
9063
9064 Provider.prototype.render = function render() {
9065 var children = this.props.children;
9066
9067 return _react.Children.only(children);
9068 };
9069
9070 return Provider;
9071}(_react.Component);
9072
9073exports["default"] = Provider;
9074
9075if (process.env.NODE_ENV !== 'production') {
9076 Provider.prototype.componentWillReceiveProps = function (nextProps) {
9077 var store = this.store;
9078 var nextStore = nextProps.store;
9079
9080 if (store !== nextStore) {
9081 warnAboutReceivingStore();
9082 }
9083 };
9084}
9085
9086Provider.propTypes = {
9087 store: _storeShape2["default"].isRequired,
9088 children: _react.PropTypes.element.isRequired
9089};
9090Provider.childContextTypes = {
9091 store: _storeShape2["default"].isRequired
9092};
9093}).call(this,require(91))
9094},{"102":102,"103":103,"297":297,"91":91}],99:[function(require,module,exports){
9095(function (process){
9096'use strict';
9097
9098var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
9099
9100exports.__esModule = true;
9101exports["default"] = connect;
9102
9103var _react = require(297);
9104
9105var _storeShape = require(102);
9106
9107var _storeShape2 = _interopRequireDefault(_storeShape);
9108
9109var _shallowEqual = require(101);
9110
9111var _shallowEqual2 = _interopRequireDefault(_shallowEqual);
9112
9113var _wrapActionCreators = require(104);
9114
9115var _wrapActionCreators2 = _interopRequireDefault(_wrapActionCreators);
9116
9117var _warning = require(103);
9118
9119var _warning2 = _interopRequireDefault(_warning);
9120
9121var _isPlainObject = require(108);
9122
9123var _isPlainObject2 = _interopRequireDefault(_isPlainObject);
9124
9125var _hoistNonReactStatics = require(79);
9126
9127var _hoistNonReactStatics2 = _interopRequireDefault(_hoistNonReactStatics);
9128
9129var _invariant = require(81);
9130
9131var _invariant2 = _interopRequireDefault(_invariant);
9132
9133function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
9134
9135function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
9136
9137function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
9138
9139function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
9140
9141var defaultMapStateToProps = function defaultMapStateToProps(state) {
9142 return {};
9143}; // eslint-disable-line no-unused-vars
9144var defaultMapDispatchToProps = function defaultMapDispatchToProps(dispatch) {
9145 return { dispatch: dispatch };
9146};
9147var defaultMergeProps = function defaultMergeProps(stateProps, dispatchProps, parentProps) {
9148 return _extends({}, parentProps, stateProps, dispatchProps);
9149};
9150
9151function getDisplayName(WrappedComponent) {
9152 return WrappedComponent.displayName || WrappedComponent.name || 'Component';
9153}
9154
9155var errorObject = { value: null };
9156function tryCatch(fn, ctx) {
9157 try {
9158 return fn.apply(ctx);
9159 } catch (e) {
9160 errorObject.value = e;
9161 return errorObject;
9162 }
9163}
9164
9165// Helps track hot reloading.
9166var nextVersion = 0;
9167
9168function connect(mapStateToProps, mapDispatchToProps, mergeProps) {
9169 var options = arguments.length <= 3 || arguments[3] === undefined ? {} : arguments[3];
9170
9171 var shouldSubscribe = Boolean(mapStateToProps);
9172 var mapState = mapStateToProps || defaultMapStateToProps;
9173
9174 var mapDispatch = undefined;
9175 if (typeof mapDispatchToProps === 'function') {
9176 mapDispatch = mapDispatchToProps;
9177 } else if (!mapDispatchToProps) {
9178 mapDispatch = defaultMapDispatchToProps;
9179 } else {
9180 mapDispatch = (0, _wrapActionCreators2["default"])(mapDispatchToProps);
9181 }
9182
9183 var finalMergeProps = mergeProps || defaultMergeProps;
9184 var _options$pure = options.pure;
9185 var pure = _options$pure === undefined ? true : _options$pure;
9186 var _options$withRef = options.withRef;
9187 var withRef = _options$withRef === undefined ? false : _options$withRef;
9188
9189 var checkMergedEquals = pure && finalMergeProps !== defaultMergeProps;
9190
9191 // Helps track hot reloading.
9192 var version = nextVersion++;
9193
9194 return function wrapWithConnect(WrappedComponent) {
9195 var connectDisplayName = 'Connect(' + getDisplayName(WrappedComponent) + ')';
9196
9197 function checkStateShape(props, methodName) {
9198 if (!(0, _isPlainObject2["default"])(props)) {
9199 (0, _warning2["default"])(methodName + '() in ' + connectDisplayName + ' must return a plain object. ' + ('Instead received ' + props + '.'));
9200 }
9201 }
9202
9203 function computeMergedProps(stateProps, dispatchProps, parentProps) {
9204 var mergedProps = finalMergeProps(stateProps, dispatchProps, parentProps);
9205 if (process.env.NODE_ENV !== 'production') {
9206 checkStateShape(mergedProps, 'mergeProps');
9207 }
9208 return mergedProps;
9209 }
9210
9211 var Connect = function (_Component) {
9212 _inherits(Connect, _Component);
9213
9214 Connect.prototype.shouldComponentUpdate = function shouldComponentUpdate() {
9215 return !pure || this.haveOwnPropsChanged || this.hasStoreStateChanged;
9216 };
9217
9218 function Connect(props, context) {
9219 _classCallCheck(this, Connect);
9220
9221 var _this = _possibleConstructorReturn(this, _Component.call(this, props, context));
9222
9223 _this.version = version;
9224 _this.store = props.store || context.store;
9225
9226 (0, _invariant2["default"])(_this.store, 'Could not find "store" in either the context or ' + ('props of "' + connectDisplayName + '". ') + 'Either wrap the root component in a <Provider>, ' + ('or explicitly pass "store" as a prop to "' + connectDisplayName + '".'));
9227
9228 var storeState = _this.store.getState();
9229 _this.state = { storeState: storeState };
9230 _this.clearCache();
9231 return _this;
9232 }
9233
9234 Connect.prototype.computeStateProps = function computeStateProps(store, props) {
9235 if (!this.finalMapStateToProps) {
9236 return this.configureFinalMapState(store, props);
9237 }
9238
9239 var state = store.getState();
9240 var stateProps = this.doStatePropsDependOnOwnProps ? this.finalMapStateToProps(state, props) : this.finalMapStateToProps(state);
9241
9242 if (process.env.NODE_ENV !== 'production') {
9243 checkStateShape(stateProps, 'mapStateToProps');
9244 }
9245 return stateProps;
9246 };
9247
9248 Connect.prototype.configureFinalMapState = function configureFinalMapState(store, props) {
9249 var mappedState = mapState(store.getState(), props);
9250 var isFactory = typeof mappedState === 'function';
9251
9252 this.finalMapStateToProps = isFactory ? mappedState : mapState;
9253 this.doStatePropsDependOnOwnProps = this.finalMapStateToProps.length !== 1;
9254
9255 if (isFactory) {
9256 return this.computeStateProps(store, props);
9257 }
9258
9259 if (process.env.NODE_ENV !== 'production') {
9260 checkStateShape(mappedState, 'mapStateToProps');
9261 }
9262 return mappedState;
9263 };
9264
9265 Connect.prototype.computeDispatchProps = function computeDispatchProps(store, props) {
9266 if (!this.finalMapDispatchToProps) {
9267 return this.configureFinalMapDispatch(store, props);
9268 }
9269
9270 var dispatch = store.dispatch;
9271
9272 var dispatchProps = this.doDispatchPropsDependOnOwnProps ? this.finalMapDispatchToProps(dispatch, props) : this.finalMapDispatchToProps(dispatch);
9273
9274 if (process.env.NODE_ENV !== 'production') {
9275 checkStateShape(dispatchProps, 'mapDispatchToProps');
9276 }
9277 return dispatchProps;
9278 };
9279
9280 Connect.prototype.configureFinalMapDispatch = function configureFinalMapDispatch(store, props) {
9281 var mappedDispatch = mapDispatch(store.dispatch, props);
9282 var isFactory = typeof mappedDispatch === 'function';
9283
9284 this.finalMapDispatchToProps = isFactory ? mappedDispatch : mapDispatch;
9285 this.doDispatchPropsDependOnOwnProps = this.finalMapDispatchToProps.length !== 1;
9286
9287 if (isFactory) {
9288 return this.computeDispatchProps(store, props);
9289 }
9290
9291 if (process.env.NODE_ENV !== 'production') {
9292 checkStateShape(mappedDispatch, 'mapDispatchToProps');
9293 }
9294 return mappedDispatch;
9295 };
9296
9297 Connect.prototype.updateStatePropsIfNeeded = function updateStatePropsIfNeeded() {
9298 var nextStateProps = this.computeStateProps(this.store, this.props);
9299 if (this.stateProps && (0, _shallowEqual2["default"])(nextStateProps, this.stateProps)) {
9300 return false;
9301 }
9302
9303 this.stateProps = nextStateProps;
9304 return true;
9305 };
9306
9307 Connect.prototype.updateDispatchPropsIfNeeded = function updateDispatchPropsIfNeeded() {
9308 var nextDispatchProps = this.computeDispatchProps(this.store, this.props);
9309 if (this.dispatchProps && (0, _shallowEqual2["default"])(nextDispatchProps, this.dispatchProps)) {
9310 return false;
9311 }
9312
9313 this.dispatchProps = nextDispatchProps;
9314 return true;
9315 };
9316
9317 Connect.prototype.updateMergedPropsIfNeeded = function updateMergedPropsIfNeeded() {
9318 var nextMergedProps = computeMergedProps(this.stateProps, this.dispatchProps, this.props);
9319 if (this.mergedProps && checkMergedEquals && (0, _shallowEqual2["default"])(nextMergedProps, this.mergedProps)) {
9320 return false;
9321 }
9322
9323 this.mergedProps = nextMergedProps;
9324 return true;
9325 };
9326
9327 Connect.prototype.isSubscribed = function isSubscribed() {
9328 return typeof this.unsubscribe === 'function';
9329 };
9330
9331 Connect.prototype.trySubscribe = function trySubscribe() {
9332 if (shouldSubscribe && !this.unsubscribe) {
9333 this.unsubscribe = this.store.subscribe(this.handleChange.bind(this));
9334 this.handleChange();
9335 }
9336 };
9337
9338 Connect.prototype.tryUnsubscribe = function tryUnsubscribe() {
9339 if (this.unsubscribe) {
9340 this.unsubscribe();
9341 this.unsubscribe = null;
9342 }
9343 };
9344
9345 Connect.prototype.componentDidMount = function componentDidMount() {
9346 this.trySubscribe();
9347 };
9348
9349 Connect.prototype.componentWillReceiveProps = function componentWillReceiveProps(nextProps) {
9350 if (!pure || !(0, _shallowEqual2["default"])(nextProps, this.props)) {
9351 this.haveOwnPropsChanged = true;
9352 }
9353 };
9354
9355 Connect.prototype.componentWillUnmount = function componentWillUnmount() {
9356 this.tryUnsubscribe();
9357 this.clearCache();
9358 };
9359
9360 Connect.prototype.clearCache = function clearCache() {
9361 this.dispatchProps = null;
9362 this.stateProps = null;
9363 this.mergedProps = null;
9364 this.haveOwnPropsChanged = true;
9365 this.hasStoreStateChanged = true;
9366 this.haveStatePropsBeenPrecalculated = false;
9367 this.statePropsPrecalculationError = null;
9368 this.renderedElement = null;
9369 this.finalMapDispatchToProps = null;
9370 this.finalMapStateToProps = null;
9371 };
9372
9373 Connect.prototype.handleChange = function handleChange() {
9374 if (!this.unsubscribe) {
9375 return;
9376 }
9377
9378 var storeState = this.store.getState();
9379 var prevStoreState = this.state.storeState;
9380 if (pure && prevStoreState === storeState) {
9381 return;
9382 }
9383
9384 if (pure && !this.doStatePropsDependOnOwnProps) {
9385 var haveStatePropsChanged = tryCatch(this.updateStatePropsIfNeeded, this);
9386 if (!haveStatePropsChanged) {
9387 return;
9388 }
9389 if (haveStatePropsChanged === errorObject) {
9390 this.statePropsPrecalculationError = errorObject.value;
9391 }
9392 this.haveStatePropsBeenPrecalculated = true;
9393 }
9394
9395 this.hasStoreStateChanged = true;
9396 this.setState({ storeState: storeState });
9397 };
9398
9399 Connect.prototype.getWrappedInstance = function getWrappedInstance() {
9400 (0, _invariant2["default"])(withRef, 'To access the wrapped instance, you need to specify ' + '{ withRef: true } as the fourth argument of the connect() call.');
9401
9402 return this.refs.wrappedInstance;
9403 };
9404
9405 Connect.prototype.render = function render() {
9406 var haveOwnPropsChanged = this.haveOwnPropsChanged;
9407 var hasStoreStateChanged = this.hasStoreStateChanged;
9408 var haveStatePropsBeenPrecalculated = this.haveStatePropsBeenPrecalculated;
9409 var statePropsPrecalculationError = this.statePropsPrecalculationError;
9410 var renderedElement = this.renderedElement;
9411
9412 this.haveOwnPropsChanged = false;
9413 this.hasStoreStateChanged = false;
9414 this.haveStatePropsBeenPrecalculated = false;
9415 this.statePropsPrecalculationError = null;
9416
9417 if (statePropsPrecalculationError) {
9418 throw statePropsPrecalculationError;
9419 }
9420
9421 var shouldUpdateStateProps = true;
9422 var shouldUpdateDispatchProps = true;
9423 if (pure && renderedElement) {
9424 shouldUpdateStateProps = hasStoreStateChanged || haveOwnPropsChanged && this.doStatePropsDependOnOwnProps;
9425 shouldUpdateDispatchProps = haveOwnPropsChanged && this.doDispatchPropsDependOnOwnProps;
9426 }
9427
9428 var haveStatePropsChanged = false;
9429 var haveDispatchPropsChanged = false;
9430 if (haveStatePropsBeenPrecalculated) {
9431 haveStatePropsChanged = true;
9432 } else if (shouldUpdateStateProps) {
9433 haveStatePropsChanged = this.updateStatePropsIfNeeded();
9434 }
9435 if (shouldUpdateDispatchProps) {
9436 haveDispatchPropsChanged = this.updateDispatchPropsIfNeeded();
9437 }
9438
9439 var haveMergedPropsChanged = true;
9440 if (haveStatePropsChanged || haveDispatchPropsChanged || haveOwnPropsChanged) {
9441 haveMergedPropsChanged = this.updateMergedPropsIfNeeded();
9442 } else {
9443 haveMergedPropsChanged = false;
9444 }
9445
9446 if (!haveMergedPropsChanged && renderedElement) {
9447 return renderedElement;
9448 }
9449
9450 if (withRef) {
9451 this.renderedElement = (0, _react.createElement)(WrappedComponent, _extends({}, this.mergedProps, {
9452 ref: 'wrappedInstance'
9453 }));
9454 } else {
9455 this.renderedElement = (0, _react.createElement)(WrappedComponent, this.mergedProps);
9456 }
9457
9458 return this.renderedElement;
9459 };
9460
9461 return Connect;
9462 }(_react.Component);
9463
9464 Connect.displayName = connectDisplayName;
9465 Connect.WrappedComponent = WrappedComponent;
9466 Connect.contextTypes = {
9467 store: _storeShape2["default"]
9468 };
9469 Connect.propTypes = {
9470 store: _storeShape2["default"]
9471 };
9472
9473 if (process.env.NODE_ENV !== 'production') {
9474 Connect.prototype.componentWillUpdate = function componentWillUpdate() {
9475 if (this.version === version) {
9476 return;
9477 }
9478
9479 // We are hot reloading!
9480 this.version = version;
9481 this.trySubscribe();
9482 this.clearCache();
9483 };
9484 }
9485
9486 return (0, _hoistNonReactStatics2["default"])(Connect, WrappedComponent);
9487 };
9488}
9489}).call(this,require(91))
9490},{"101":101,"102":102,"103":103,"104":104,"108":108,"297":297,"79":79,"81":81,"91":91}],100:[function(require,module,exports){
9491'use strict';
9492
9493exports.__esModule = true;
9494exports.connect = exports.Provider = undefined;
9495
9496var _Provider = require(98);
9497
9498var _Provider2 = _interopRequireDefault(_Provider);
9499
9500var _connect = require(99);
9501
9502var _connect2 = _interopRequireDefault(_connect);
9503
9504function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
9505
9506exports.Provider = _Provider2["default"];
9507exports.connect = _connect2["default"];
9508},{"98":98,"99":99}],101:[function(require,module,exports){
9509"use strict";
9510
9511exports.__esModule = true;
9512exports["default"] = shallowEqual;
9513function shallowEqual(objA, objB) {
9514 if (objA === objB) {
9515 return true;
9516 }
9517
9518 var keysA = Object.keys(objA);
9519 var keysB = Object.keys(objB);
9520
9521 if (keysA.length !== keysB.length) {
9522 return false;
9523 }
9524
9525 // Test for A's keys different from B.
9526 var hasOwn = Object.prototype.hasOwnProperty;
9527 for (var i = 0; i < keysA.length; i++) {
9528 if (!hasOwn.call(objB, keysA[i]) || objA[keysA[i]] !== objB[keysA[i]]) {
9529 return false;
9530 }
9531 }
9532
9533 return true;
9534}
9535},{}],102:[function(require,module,exports){
9536'use strict';
9537
9538exports.__esModule = true;
9539
9540var _react = require(297);
9541
9542exports["default"] = _react.PropTypes.shape({
9543 subscribe: _react.PropTypes.func.isRequired,
9544 dispatch: _react.PropTypes.func.isRequired,
9545 getState: _react.PropTypes.func.isRequired
9546});
9547},{"297":297}],103:[function(require,module,exports){
9548'use strict';
9549
9550exports.__esModule = true;
9551exports["default"] = warning;
9552/**
9553 * Prints a warning in the console if it exists.
9554 *
9555 * @param {String} message The warning message.
9556 * @returns {void}
9557 */
9558function warning(message) {
9559 /* eslint-disable no-console */
9560 if (typeof console !== 'undefined' && typeof console.error === 'function') {
9561 console.error(message);
9562 }
9563 /* eslint-enable no-console */
9564 try {
9565 // This error was thrown as a convenience so that you can use this stack
9566 // to find the callsite that caused this warning to fire.
9567 throw new Error(message);
9568 /* eslint-disable no-empty */
9569 } catch (e) {}
9570 /* eslint-enable no-empty */
9571}
9572},{}],104:[function(require,module,exports){
9573'use strict';
9574
9575exports.__esModule = true;
9576exports["default"] = wrapActionCreators;
9577
9578var _redux = require(316);
9579
9580function wrapActionCreators(actionCreators) {
9581 return function (dispatch) {
9582 return (0, _redux.bindActionCreators)(actionCreators, dispatch);
9583 };
9584}
9585},{"316":316}],105:[function(require,module,exports){
9586/* Built-in method references for those with the same name as other `lodash` methods. */
9587var nativeGetPrototype = Object.getPrototypeOf;
9588
9589/**
9590 * Gets the `[[Prototype]]` of `value`.
9591 *
9592 * @private
9593 * @param {*} value The value to query.
9594 * @returns {null|Object} Returns the `[[Prototype]]`.
9595 */
9596function getPrototype(value) {
9597 return nativeGetPrototype(Object(value));
9598}
9599
9600module.exports = getPrototype;
9601
9602},{}],106:[function(require,module,exports){
9603/**
9604 * Checks if `value` is a host object in IE < 9.
9605 *
9606 * @private
9607 * @param {*} value The value to check.
9608 * @returns {boolean} Returns `true` if `value` is a host object, else `false`.
9609 */
9610function isHostObject(value) {
9611 // Many host objects are `Object` objects that can coerce to strings
9612 // despite having improperly defined `toString` methods.
9613 var result = false;
9614 if (value != null && typeof value.toString != 'function') {
9615 try {
9616 result = !!(value + '');
9617 } catch (e) {}
9618 }
9619 return result;
9620}
9621
9622module.exports = isHostObject;
9623
9624},{}],107:[function(require,module,exports){
9625/**
9626 * Checks if `value` is object-like. A value is object-like if it's not `null`
9627 * and has a `typeof` result of "object".
9628 *
9629 * @static
9630 * @memberOf _
9631 * @since 4.0.0
9632 * @category Lang
9633 * @param {*} value The value to check.
9634 * @returns {boolean} Returns `true` if `value` is object-like, else `false`.
9635 * @example
9636 *
9637 * _.isObjectLike({});
9638 * // => true
9639 *
9640 * _.isObjectLike([1, 2, 3]);
9641 * // => true
9642 *
9643 * _.isObjectLike(_.noop);
9644 * // => false
9645 *
9646 * _.isObjectLike(null);
9647 * // => false
9648 */
9649function isObjectLike(value) {
9650 return !!value && typeof value == 'object';
9651}
9652
9653module.exports = isObjectLike;
9654
9655},{}],108:[function(require,module,exports){
9656var getPrototype = require(105),
9657 isHostObject = require(106),
9658 isObjectLike = require(107);
9659
9660/** `Object#toString` result references. */
9661var objectTag = '[object Object]';
9662
9663/** Used for built-in method references. */
9664var objectProto = Object.prototype;
9665
9666/** Used to resolve the decompiled source of functions. */
9667var funcToString = Function.prototype.toString;
9668
9669/** Used to check objects for own properties. */
9670var hasOwnProperty = objectProto.hasOwnProperty;
9671
9672/** Used to infer the `Object` constructor. */
9673var objectCtorString = funcToString.call(Object);
9674
9675/**
9676 * Used to resolve the
9677 * [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring)
9678 * of values.
9679 */
9680var objectToString = objectProto.toString;
9681
9682/**
9683 * Checks if `value` is a plain object, that is, an object created by the
9684 * `Object` constructor or one with a `[[Prototype]]` of `null`.
9685 *
9686 * @static
9687 * @memberOf _
9688 * @since 0.8.0
9689 * @category Lang
9690 * @param {*} value The value to check.
9691 * @returns {boolean} Returns `true` if `value` is a plain object,
9692 * else `false`.
9693 * @example
9694 *
9695 * function Foo() {
9696 * this.a = 1;
9697 * }
9698 *
9699 * _.isPlainObject(new Foo);
9700 * // => false
9701 *
9702 * _.isPlainObject([1, 2, 3]);
9703 * // => false
9704 *
9705 * _.isPlainObject({ 'x': 0, 'y': 0 });
9706 * // => true
9707 *
9708 * _.isPlainObject(Object.create(null));
9709 * // => true
9710 */
9711function isPlainObject(value) {
9712 if (!isObjectLike(value) ||
9713 objectToString.call(value) != objectTag || isHostObject(value)) {
9714 return false;
9715 }
9716 var proto = getPrototype(value);
9717 if (proto === null) {
9718 return true;
9719 }
9720 var Ctor = hasOwnProperty.call(proto, 'constructor') && proto.constructor;
9721 return (typeof Ctor == 'function' &&
9722 Ctor instanceof Ctor && funcToString.call(Ctor) == objectCtorString);
9723}
9724
9725module.exports = isPlainObject;
9726
9727},{"105":105,"106":106,"107":107}],109:[function(require,module,exports){
9728"use strict";
9729
9730exports.__esModule = true;
9731var _slice = Array.prototype.slice;
9732exports.loopAsync = loopAsync;
9733exports.mapAsync = mapAsync;
9734
9735function loopAsync(turns, work, callback) {
9736 var currentTurn = 0,
9737 isDone = false;
9738 var sync = false,
9739 hasNext = false,
9740 doneArgs = undefined;
9741
9742 function done() {
9743 isDone = true;
9744 if (sync) {
9745 // Iterate instead of recursing if possible.
9746 doneArgs = [].concat(_slice.call(arguments));
9747 return;
9748 }
9749
9750 callback.apply(this, arguments);
9751 }
9752
9753 function next() {
9754 if (isDone) {
9755 return;
9756 }
9757
9758 hasNext = true;
9759 if (sync) {
9760 // Iterate instead of recursing if possible.
9761 return;
9762 }
9763
9764 sync = true;
9765
9766 while (!isDone && currentTurn < turns && hasNext) {
9767 hasNext = false;
9768 work.call(this, currentTurn++, next, done);
9769 }
9770
9771 sync = false;
9772
9773 if (isDone) {
9774 // This means the loop finished synchronously.
9775 callback.apply(this, doneArgs);
9776 return;
9777 }
9778
9779 if (currentTurn >= turns && hasNext) {
9780 isDone = true;
9781 callback();
9782 }
9783 }
9784
9785 next();
9786}
9787
9788function mapAsync(array, work, callback) {
9789 var length = array.length;
9790 var values = [];
9791
9792 if (length === 0) return callback(null, values);
9793
9794 var isDone = false,
9795 doneCount = 0;
9796
9797 function done(index, error, value) {
9798 if (isDone) return;
9799
9800 if (error) {
9801 isDone = true;
9802 callback(error);
9803 } else {
9804 values[index] = value;
9805
9806 isDone = ++doneCount === length;
9807
9808 if (isDone) callback(null, values);
9809 }
9810 }
9811
9812 array.forEach(function (item, index) {
9813 work(item, index, function (error, value) {
9814 done(index, error, value);
9815 });
9816 });
9817}
9818},{}],110:[function(require,module,exports){
9819(function (process){
9820'use strict';
9821
9822exports.__esModule = true;
9823
9824function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
9825
9826var _routerWarning = require(140);
9827
9828var _routerWarning2 = _interopRequireDefault(_routerWarning);
9829
9830var _PropTypes = require(117);
9831
9832/**
9833 * A mixin that adds the "history" instance variable to components.
9834 */
9835var History = {
9836
9837 contextTypes: {
9838 history: _PropTypes.history
9839 },
9840
9841 componentWillMount: function componentWillMount() {
9842 process.env.NODE_ENV !== 'production' ? _routerWarning2['default'](false, 'the `History` mixin is deprecated, please access `context.router` with your own `contextTypes`. http://tiny.cc/router-historymixin') : undefined;
9843 this.history = this.context.history;
9844 }
9845
9846};
9847
9848exports['default'] = History;
9849module.exports = exports['default'];
9850}).call(this,require(91))
9851},{"117":117,"140":140,"91":91}],111:[function(require,module,exports){
9852'use strict';
9853
9854exports.__esModule = true;
9855
9856var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
9857
9858function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
9859
9860var _react = require(297);
9861
9862var _react2 = _interopRequireDefault(_react);
9863
9864var _Link = require(115);
9865
9866var _Link2 = _interopRequireDefault(_Link);
9867
9868/**
9869 * An <IndexLink> is used to link to an <IndexRoute>.
9870 */
9871var IndexLink = _react2['default'].createClass({
9872 displayName: 'IndexLink',
9873
9874 render: function render() {
9875 return _react2['default'].createElement(_Link2['default'], _extends({}, this.props, { onlyActiveOnIndex: true }));
9876 }
9877
9878});
9879
9880exports['default'] = IndexLink;
9881module.exports = exports['default'];
9882},{"115":115,"297":297}],112:[function(require,module,exports){
9883(function (process){
9884'use strict';
9885
9886exports.__esModule = true;
9887
9888function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
9889
9890var _react = require(297);
9891
9892var _react2 = _interopRequireDefault(_react);
9893
9894var _routerWarning = require(140);
9895
9896var _routerWarning2 = _interopRequireDefault(_routerWarning);
9897
9898var _invariant = require(81);
9899
9900var _invariant2 = _interopRequireDefault(_invariant);
9901
9902var _Redirect = require(118);
9903
9904var _Redirect2 = _interopRequireDefault(_Redirect);
9905
9906var _PropTypes = require(117);
9907
9908var _React$PropTypes = _react2['default'].PropTypes;
9909var string = _React$PropTypes.string;
9910var object = _React$PropTypes.object;
9911
9912/**
9913 * An <IndexRedirect> is used to redirect from an indexRoute.
9914 */
9915var IndexRedirect = _react2['default'].createClass({
9916 displayName: 'IndexRedirect',
9917
9918 statics: {
9919
9920 createRouteFromReactElement: function createRouteFromReactElement(element, parentRoute) {
9921 /* istanbul ignore else: sanity check */
9922 if (parentRoute) {
9923 parentRoute.indexRoute = _Redirect2['default'].createRouteFromReactElement(element);
9924 } else {
9925 process.env.NODE_ENV !== 'production' ? _routerWarning2['default'](false, 'An <IndexRedirect> does not make sense at the root of your route config') : undefined;
9926 }
9927 }
9928
9929 },
9930
9931 propTypes: {
9932 to: string.isRequired,
9933 query: object,
9934 state: object,
9935 onEnter: _PropTypes.falsy,
9936 children: _PropTypes.falsy
9937 },
9938
9939 /* istanbul ignore next: sanity check */
9940 render: function render() {
9941 !false ? process.env.NODE_ENV !== 'production' ? _invariant2['default'](false, '<IndexRedirect> elements are for router configuration only and should not be rendered') : _invariant2['default'](false) : undefined;
9942 }
9943
9944});
9945
9946exports['default'] = IndexRedirect;
9947module.exports = exports['default'];
9948}).call(this,require(91))
9949},{"117":117,"118":118,"140":140,"297":297,"81":81,"91":91}],113:[function(require,module,exports){
9950(function (process){
9951'use strict';
9952
9953exports.__esModule = true;
9954
9955function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
9956
9957var _react = require(297);
9958
9959var _react2 = _interopRequireDefault(_react);
9960
9961var _routerWarning = require(140);
9962
9963var _routerWarning2 = _interopRequireDefault(_routerWarning);
9964
9965var _invariant = require(81);
9966
9967var _invariant2 = _interopRequireDefault(_invariant);
9968
9969var _RouteUtils = require(121);
9970
9971var _PropTypes = require(117);
9972
9973var func = _react2['default'].PropTypes.func;
9974
9975/**
9976 * An <IndexRoute> is used to specify its parent's <Route indexRoute> in
9977 * a JSX route config.
9978 */
9979var IndexRoute = _react2['default'].createClass({
9980 displayName: 'IndexRoute',
9981
9982 statics: {
9983
9984 createRouteFromReactElement: function createRouteFromReactElement(element, parentRoute) {
9985 /* istanbul ignore else: sanity check */
9986 if (parentRoute) {
9987 parentRoute.indexRoute = _RouteUtils.createRouteFromReactElement(element);
9988 } else {
9989 process.env.NODE_ENV !== 'production' ? _routerWarning2['default'](false, 'An <IndexRoute> does not make sense at the root of your route config') : undefined;
9990 }
9991 }
9992
9993 },
9994
9995 propTypes: {
9996 path: _PropTypes.falsy,
9997 component: _PropTypes.component,
9998 components: _PropTypes.components,
9999 getComponent: func,
10000 getComponents: func
10001 },
10002
10003 /* istanbul ignore next: sanity check */
10004 render: function render() {
10005 !false ? process.env.NODE_ENV !== 'production' ? _invariant2['default'](false, '<IndexRoute> elements are for router configuration only and should not be rendered') : _invariant2['default'](false) : undefined;
10006 }
10007
10008});
10009
10010exports['default'] = IndexRoute;
10011module.exports = exports['default'];
10012}).call(this,require(91))
10013},{"117":117,"121":121,"140":140,"297":297,"81":81,"91":91}],114:[function(require,module,exports){
10014(function (process){
10015'use strict';
10016
10017exports.__esModule = true;
10018
10019function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
10020
10021var _routerWarning = require(140);
10022
10023var _routerWarning2 = _interopRequireDefault(_routerWarning);
10024
10025var _react = require(297);
10026
10027var _react2 = _interopRequireDefault(_react);
10028
10029var _invariant = require(81);
10030
10031var _invariant2 = _interopRequireDefault(_invariant);
10032
10033var object = _react2['default'].PropTypes.object;
10034
10035/**
10036 * The Lifecycle mixin adds the routerWillLeave lifecycle method to a
10037 * component that may be used to cancel a transition or prompt the user
10038 * for confirmation.
10039 *
10040 * On standard transitions, routerWillLeave receives a single argument: the
10041 * location we're transitioning to. To cancel the transition, return false.
10042 * To prompt the user for confirmation, return a prompt message (string).
10043 *
10044 * During the beforeunload event (assuming you're using the useBeforeUnload
10045 * history enhancer), routerWillLeave does not receive a location object
10046 * because it isn't possible for us to know the location we're transitioning
10047 * to. In this case routerWillLeave must return a prompt message to prevent
10048 * the user from closing the window/tab.
10049 */
10050var Lifecycle = {
10051
10052 contextTypes: {
10053 history: object.isRequired,
10054 // Nested children receive the route as context, either
10055 // set by the route component using the RouteContext mixin
10056 // or by some other ancestor.
10057 route: object
10058 },
10059
10060 propTypes: {
10061 // Route components receive the route object as a prop.
10062 route: object
10063 },
10064
10065 componentDidMount: function componentDidMount() {
10066 process.env.NODE_ENV !== 'production' ? _routerWarning2['default'](false, 'the `Lifecycle` mixin is deprecated, please use `context.router.setRouteLeaveHook(route, hook)`. http://tiny.cc/router-lifecyclemixin') : undefined;
10067 !this.routerWillLeave ? process.env.NODE_ENV !== 'production' ? _invariant2['default'](false, 'The Lifecycle mixin requires you to define a routerWillLeave method') : _invariant2['default'](false) : undefined;
10068
10069 var route = this.props.route || this.context.route;
10070
10071 !route ? process.env.NODE_ENV !== 'production' ? _invariant2['default'](false, 'The Lifecycle mixin must be used on either a) a <Route component> or ' + 'b) a descendant of a <Route component> that uses the RouteContext mixin') : _invariant2['default'](false) : undefined;
10072
10073 this._unlistenBeforeLeavingRoute = this.context.history.listenBeforeLeavingRoute(route, this.routerWillLeave);
10074 },
10075
10076 componentWillUnmount: function componentWillUnmount() {
10077 if (this._unlistenBeforeLeavingRoute) this._unlistenBeforeLeavingRoute();
10078 }
10079
10080};
10081
10082exports['default'] = Lifecycle;
10083module.exports = exports['default'];
10084}).call(this,require(91))
10085},{"140":140,"297":297,"81":81,"91":91}],115:[function(require,module,exports){
10086(function (process){
10087'use strict';
10088
10089exports.__esModule = true;
10090
10091var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
10092
10093function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
10094
10095function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; }
10096
10097var _react = require(297);
10098
10099var _react2 = _interopRequireDefault(_react);
10100
10101var _routerWarning = require(140);
10102
10103var _routerWarning2 = _interopRequireDefault(_routerWarning);
10104
10105var _React$PropTypes = _react2['default'].PropTypes;
10106var bool = _React$PropTypes.bool;
10107var object = _React$PropTypes.object;
10108var string = _React$PropTypes.string;
10109var func = _React$PropTypes.func;
10110var oneOfType = _React$PropTypes.oneOfType;
10111
10112function isLeftClickEvent(event) {
10113 return event.button === 0;
10114}
10115
10116function isModifiedEvent(event) {
10117 return !!(event.metaKey || event.altKey || event.ctrlKey || event.shiftKey);
10118}
10119
10120function isEmptyObject(object) {
10121 for (var p in object) {
10122 if (object.hasOwnProperty(p)) return false;
10123 }return true;
10124}
10125
10126function createLocationDescriptor(to, _ref) {
10127 var query = _ref.query;
10128 var hash = _ref.hash;
10129 var state = _ref.state;
10130
10131 if (query || hash || state) {
10132 return { pathname: to, query: query, hash: hash, state: state };
10133 }
10134
10135 return to;
10136}
10137
10138/**
10139 * A <Link> is used to create an <a> element that links to a route.
10140 * When that route is active, the link gets the value of its
10141 * activeClassName prop.
10142 *
10143 * For example, assuming you have the following route:
10144 *
10145 * <Route path="/posts/:postID" component={Post} />
10146 *
10147 * You could use the following component to link to that route:
10148 *
10149 * <Link to={`/posts/${post.id}`} />
10150 *
10151 * Links may pass along location state and/or query string parameters
10152 * in the state/query props, respectively.
10153 *
10154 * <Link ... query={{ show: true }} state={{ the: 'state' }} />
10155 */
10156var Link = _react2['default'].createClass({
10157 displayName: 'Link',
10158
10159 contextTypes: {
10160 router: object
10161 },
10162
10163 propTypes: {
10164 to: oneOfType([string, object]).isRequired,
10165 query: object,
10166 hash: string,
10167 state: object,
10168 activeStyle: object,
10169 activeClassName: string,
10170 onlyActiveOnIndex: bool.isRequired,
10171 onClick: func
10172 },
10173
10174 getDefaultProps: function getDefaultProps() {
10175 return {
10176 onlyActiveOnIndex: false,
10177 className: '',
10178 style: {}
10179 };
10180 },
10181
10182 handleClick: function handleClick(event) {
10183 var allowTransition = true;
10184
10185 if (this.props.onClick) this.props.onClick(event);
10186
10187 if (isModifiedEvent(event) || !isLeftClickEvent(event)) return;
10188
10189 if (event.defaultPrevented === true) allowTransition = false;
10190
10191 // If target prop is set (e.g. to "_blank") let browser handle link.
10192 /* istanbul ignore if: untestable with Karma */
10193 if (this.props.target) {
10194 if (!allowTransition) event.preventDefault();
10195
10196 return;
10197 }
10198
10199 event.preventDefault();
10200
10201 if (allowTransition) {
10202 var _props = this.props;
10203 var to = _props.to;
10204 var query = _props.query;
10205 var hash = _props.hash;
10206 var state = _props.state;
10207
10208 var _location = createLocationDescriptor(to, { query: query, hash: hash, state: state });
10209
10210 this.context.router.push(_location);
10211 }
10212 },
10213
10214 render: function render() {
10215 var _props2 = this.props;
10216 var to = _props2.to;
10217 var query = _props2.query;
10218 var hash = _props2.hash;
10219 var state = _props2.state;
10220 var activeClassName = _props2.activeClassName;
10221 var activeStyle = _props2.activeStyle;
10222 var onlyActiveOnIndex = _props2.onlyActiveOnIndex;
10223
10224 var props = _objectWithoutProperties(_props2, ['to', 'query', 'hash', 'state', 'activeClassName', 'activeStyle', 'onlyActiveOnIndex']);
10225
10226 process.env.NODE_ENV !== 'production' ? _routerWarning2['default'](!(query || hash || state), 'the `query`, `hash`, and `state` props on `<Link>` are deprecated, use `<Link to={{ pathname, query, hash, state }}/>. http://tiny.cc/router-isActivedeprecated') : undefined;
10227
10228 // Ignore if rendered outside the context of router, simplifies unit testing.
10229 var router = this.context.router;
10230
10231 if (router) {
10232 var _location2 = createLocationDescriptor(to, { query: query, hash: hash, state: state });
10233 props.href = router.createHref(_location2);
10234
10235 if (activeClassName || activeStyle != null && !isEmptyObject(activeStyle)) {
10236 if (router.isActive(_location2, onlyActiveOnIndex)) {
10237 if (activeClassName) props.className += props.className === '' ? activeClassName : ' ' + activeClassName;
10238
10239 if (activeStyle) props.style = _extends({}, props.style, activeStyle);
10240 }
10241 }
10242 }
10243
10244 return _react2['default'].createElement('a', _extends({}, props, { onClick: this.handleClick }));
10245 }
10246
10247});
10248
10249exports['default'] = Link;
10250module.exports = exports['default'];
10251}).call(this,require(91))
10252},{"140":140,"297":297,"91":91}],116:[function(require,module,exports){
10253(function (process){
10254'use strict';
10255
10256exports.__esModule = true;
10257exports.compilePattern = compilePattern;
10258exports.matchPattern = matchPattern;
10259exports.getParamNames = getParamNames;
10260exports.getParams = getParams;
10261exports.formatPattern = formatPattern;
10262
10263function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
10264
10265var _invariant = require(81);
10266
10267var _invariant2 = _interopRequireDefault(_invariant);
10268
10269function escapeRegExp(string) {
10270 return string.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
10271}
10272
10273function escapeSource(string) {
10274 return escapeRegExp(string).replace(/\/+/g, '/+');
10275}
10276
10277function _compilePattern(pattern) {
10278 var regexpSource = '';
10279 var paramNames = [];
10280 var tokens = [];
10281
10282 var match = undefined,
10283 lastIndex = 0,
10284 matcher = /:([a-zA-Z_$][a-zA-Z0-9_$]*)|\*\*|\*|\(|\)/g;
10285 while (match = matcher.exec(pattern)) {
10286 if (match.index !== lastIndex) {
10287 tokens.push(pattern.slice(lastIndex, match.index));
10288 regexpSource += escapeSource(pattern.slice(lastIndex, match.index));
10289 }
10290
10291 if (match[1]) {
10292 regexpSource += '([^/?#]+)';
10293 paramNames.push(match[1]);
10294 } else if (match[0] === '**') {
10295 regexpSource += '([\\s\\S]*)';
10296 paramNames.push('splat');
10297 } else if (match[0] === '*') {
10298 regexpSource += '([\\s\\S]*?)';
10299 paramNames.push('splat');
10300 } else if (match[0] === '(') {
10301 regexpSource += '(?:';
10302 } else if (match[0] === ')') {
10303 regexpSource += ')?';
10304 }
10305
10306 tokens.push(match[0]);
10307
10308 lastIndex = matcher.lastIndex;
10309 }
10310
10311 if (lastIndex !== pattern.length) {
10312 tokens.push(pattern.slice(lastIndex, pattern.length));
10313 regexpSource += escapeSource(pattern.slice(lastIndex, pattern.length));
10314 }
10315
10316 return {
10317 pattern: pattern,
10318 regexpSource: regexpSource,
10319 paramNames: paramNames,
10320 tokens: tokens
10321 };
10322}
10323
10324var CompiledPatternsCache = {};
10325
10326function compilePattern(pattern) {
10327 if (!(pattern in CompiledPatternsCache)) CompiledPatternsCache[pattern] = _compilePattern(pattern);
10328
10329 return CompiledPatternsCache[pattern];
10330}
10331
10332/**
10333 * Attempts to match a pattern on the given pathname. Patterns may use
10334 * the following special characters:
10335 *
10336 * - :paramName Matches a URL segment up to the next /, ?, or #. The
10337 * captured string is considered a "param"
10338 * - () Wraps a segment of the URL that is optional
10339 * - * Consumes (non-greedy) all characters up to the next
10340 * character in the pattern, or to the end of the URL if
10341 * there is none
10342 * - ** Consumes (greedy) all characters up to the next character
10343 * in the pattern, or to the end of the URL if there is none
10344 *
10345 * The return value is an object with the following properties:
10346 *
10347 * - remainingPathname
10348 * - paramNames
10349 * - paramValues
10350 */
10351
10352function matchPattern(pattern, pathname) {
10353 // Make leading slashes consistent between pattern and pathname.
10354 if (pattern.charAt(0) !== '/') {
10355 pattern = '/' + pattern;
10356 }
10357 if (pathname.charAt(0) !== '/') {
10358 pathname = '/' + pathname;
10359 }
10360
10361 var _compilePattern2 = compilePattern(pattern);
10362
10363 var regexpSource = _compilePattern2.regexpSource;
10364 var paramNames = _compilePattern2.paramNames;
10365 var tokens = _compilePattern2.tokens;
10366
10367 regexpSource += '/*'; // Capture path separators
10368
10369 // Special-case patterns like '*' for catch-all routes.
10370 var captureRemaining = tokens[tokens.length - 1] !== '*';
10371
10372 if (captureRemaining) {
10373 // This will match newlines in the remaining path.
10374 regexpSource += '([\\s\\S]*?)';
10375 }
10376
10377 var match = pathname.match(new RegExp('^' + regexpSource + '$', 'i'));
10378
10379 var remainingPathname = undefined,
10380 paramValues = undefined;
10381 if (match != null) {
10382 if (captureRemaining) {
10383 remainingPathname = match.pop();
10384 var matchedPath = match[0].substr(0, match[0].length - remainingPathname.length);
10385
10386 // If we didn't match the entire pathname, then make sure that the match
10387 // we did get ends at a path separator (potentially the one we added
10388 // above at the beginning of the path, if the actual match was empty).
10389 if (remainingPathname && matchedPath.charAt(matchedPath.length - 1) !== '/') {
10390 return {
10391 remainingPathname: null,
10392 paramNames: paramNames,
10393 paramValues: null
10394 };
10395 }
10396 } else {
10397 // If this matched at all, then the match was the entire pathname.
10398 remainingPathname = '';
10399 }
10400
10401 paramValues = match.slice(1).map(function (v) {
10402 return v != null ? decodeURIComponent(v) : v;
10403 });
10404 } else {
10405 remainingPathname = paramValues = null;
10406 }
10407
10408 return {
10409 remainingPathname: remainingPathname,
10410 paramNames: paramNames,
10411 paramValues: paramValues
10412 };
10413}
10414
10415function getParamNames(pattern) {
10416 return compilePattern(pattern).paramNames;
10417}
10418
10419function getParams(pattern, pathname) {
10420 var _matchPattern = matchPattern(pattern, pathname);
10421
10422 var paramNames = _matchPattern.paramNames;
10423 var paramValues = _matchPattern.paramValues;
10424
10425 if (paramValues != null) {
10426 return paramNames.reduce(function (memo, paramName, index) {
10427 memo[paramName] = paramValues[index];
10428 return memo;
10429 }, {});
10430 }
10431
10432 return null;
10433}
10434
10435/**
10436 * Returns a version of the given pattern with params interpolated. Throws
10437 * if there is a dynamic segment of the pattern for which there is no param.
10438 */
10439
10440function formatPattern(pattern, params) {
10441 params = params || {};
10442
10443 var _compilePattern3 = compilePattern(pattern);
10444
10445 var tokens = _compilePattern3.tokens;
10446
10447 var parenCount = 0,
10448 pathname = '',
10449 splatIndex = 0;
10450
10451 var token = undefined,
10452 paramName = undefined,
10453 paramValue = undefined;
10454 for (var i = 0, len = tokens.length; i < len; ++i) {
10455 token = tokens[i];
10456
10457 if (token === '*' || token === '**') {
10458 paramValue = Array.isArray(params.splat) ? params.splat[splatIndex++] : params.splat;
10459
10460 !(paramValue != null || parenCount > 0) ? process.env.NODE_ENV !== 'production' ? _invariant2['default'](false, 'Missing splat #%s for path "%s"', splatIndex, pattern) : _invariant2['default'](false) : undefined;
10461
10462 if (paramValue != null) pathname += encodeURI(paramValue);
10463 } else if (token === '(') {
10464 parenCount += 1;
10465 } else if (token === ')') {
10466 parenCount -= 1;
10467 } else if (token.charAt(0) === ':') {
10468 paramName = token.substring(1);
10469 paramValue = params[paramName];
10470
10471 !(paramValue != null || parenCount > 0) ? process.env.NODE_ENV !== 'production' ? _invariant2['default'](false, 'Missing "%s" parameter for path "%s"', paramName, pattern) : _invariant2['default'](false) : undefined;
10472
10473 if (paramValue != null) pathname += encodeURIComponent(paramValue);
10474 } else {
10475 pathname += token;
10476 }
10477 }
10478
10479 return pathname.replace(/\/+/g, '/');
10480}
10481}).call(this,require(91))
10482},{"81":81,"91":91}],117:[function(require,module,exports){
10483'use strict';
10484
10485exports.__esModule = true;
10486exports.falsy = falsy;
10487
10488var _react = require(297);
10489
10490var func = _react.PropTypes.func;
10491var object = _react.PropTypes.object;
10492var arrayOf = _react.PropTypes.arrayOf;
10493var oneOfType = _react.PropTypes.oneOfType;
10494var element = _react.PropTypes.element;
10495var shape = _react.PropTypes.shape;
10496var string = _react.PropTypes.string;
10497
10498function falsy(props, propName, componentName) {
10499 if (props[propName]) return new Error('<' + componentName + '> should not have a "' + propName + '" prop');
10500}
10501
10502var history = shape({
10503 listen: func.isRequired,
10504 pushState: func.isRequired,
10505 replaceState: func.isRequired,
10506 go: func.isRequired
10507});
10508
10509exports.history = history;
10510var location = shape({
10511 pathname: string.isRequired,
10512 search: string.isRequired,
10513 state: object,
10514 action: string.isRequired,
10515 key: string
10516});
10517
10518exports.location = location;
10519var component = oneOfType([func, string]);
10520exports.component = component;
10521var components = oneOfType([component, object]);
10522exports.components = components;
10523var route = oneOfType([object, element]);
10524exports.route = route;
10525var routes = oneOfType([route, arrayOf(route)]);
10526
10527exports.routes = routes;
10528exports['default'] = {
10529 falsy: falsy,
10530 history: history,
10531 location: location,
10532 component: component,
10533 components: components,
10534 route: route
10535};
10536},{"297":297}],118:[function(require,module,exports){
10537(function (process){
10538'use strict';
10539
10540exports.__esModule = true;
10541
10542function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
10543
10544var _react = require(297);
10545
10546var _react2 = _interopRequireDefault(_react);
10547
10548var _invariant = require(81);
10549
10550var _invariant2 = _interopRequireDefault(_invariant);
10551
10552var _RouteUtils = require(121);
10553
10554var _PatternUtils = require(116);
10555
10556var _PropTypes = require(117);
10557
10558var _React$PropTypes = _react2['default'].PropTypes;
10559var string = _React$PropTypes.string;
10560var object = _React$PropTypes.object;
10561
10562/**
10563 * A <Redirect> is used to declare another URL path a client should
10564 * be sent to when they request a given URL.
10565 *
10566 * Redirects are placed alongside routes in the route configuration
10567 * and are traversed in the same manner.
10568 */
10569var Redirect = _react2['default'].createClass({
10570 displayName: 'Redirect',
10571
10572 statics: {
10573
10574 createRouteFromReactElement: function createRouteFromReactElement(element) {
10575 var route = _RouteUtils.createRouteFromReactElement(element);
10576
10577 if (route.from) route.path = route.from;
10578
10579 route.onEnter = function (nextState, replace) {
10580 var location = nextState.location;
10581 var params = nextState.params;
10582
10583 var pathname = undefined;
10584 if (route.to.charAt(0) === '/') {
10585 pathname = _PatternUtils.formatPattern(route.to, params);
10586 } else if (!route.to) {
10587 pathname = location.pathname;
10588 } else {
10589 var routeIndex = nextState.routes.indexOf(route);
10590 var parentPattern = Redirect.getRoutePattern(nextState.routes, routeIndex - 1);
10591 var pattern = parentPattern.replace(/\/*$/, '/') + route.to;
10592 pathname = _PatternUtils.formatPattern(pattern, params);
10593 }
10594
10595 replace({
10596 pathname: pathname,
10597 query: route.query || location.query,
10598 state: route.state || location.state
10599 });
10600 };
10601
10602 return route;
10603 },
10604
10605 getRoutePattern: function getRoutePattern(routes, routeIndex) {
10606 var parentPattern = '';
10607
10608 for (var i = routeIndex; i >= 0; i--) {
10609 var route = routes[i];
10610 var pattern = route.path || '';
10611
10612 parentPattern = pattern.replace(/\/*$/, '/') + parentPattern;
10613
10614 if (pattern.indexOf('/') === 0) break;
10615 }
10616
10617 return '/' + parentPattern;
10618 }
10619
10620 },
10621
10622 propTypes: {
10623 path: string,
10624 from: string, // Alias for path
10625 to: string.isRequired,
10626 query: object,
10627 state: object,
10628 onEnter: _PropTypes.falsy,
10629 children: _PropTypes.falsy
10630 },
10631
10632 /* istanbul ignore next: sanity check */
10633 render: function render() {
10634 !false ? process.env.NODE_ENV !== 'production' ? _invariant2['default'](false, '<Redirect> elements are for router configuration only and should not be rendered') : _invariant2['default'](false) : undefined;
10635 }
10636
10637});
10638
10639exports['default'] = Redirect;
10640module.exports = exports['default'];
10641}).call(this,require(91))
10642},{"116":116,"117":117,"121":121,"297":297,"81":81,"91":91}],119:[function(require,module,exports){
10643(function (process){
10644'use strict';
10645
10646exports.__esModule = true;
10647
10648function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
10649
10650var _react = require(297);
10651
10652var _react2 = _interopRequireDefault(_react);
10653
10654var _invariant = require(81);
10655
10656var _invariant2 = _interopRequireDefault(_invariant);
10657
10658var _RouteUtils = require(121);
10659
10660var _PropTypes = require(117);
10661
10662var _React$PropTypes = _react2['default'].PropTypes;
10663var string = _React$PropTypes.string;
10664var func = _React$PropTypes.func;
10665
10666/**
10667 * A <Route> is used to declare which components are rendered to the
10668 * page when the URL matches a given pattern.
10669 *
10670 * Routes are arranged in a nested tree structure. When a new URL is
10671 * requested, the tree is searched depth-first to find a route whose
10672 * path matches the URL. When one is found, all routes in the tree
10673 * that lead to it are considered "active" and their components are
10674 * rendered into the DOM, nested in the same order as in the tree.
10675 */
10676var Route = _react2['default'].createClass({
10677 displayName: 'Route',
10678
10679 statics: {
10680 createRouteFromReactElement: _RouteUtils.createRouteFromReactElement
10681 },
10682
10683 propTypes: {
10684 path: string,
10685 component: _PropTypes.component,
10686 components: _PropTypes.components,
10687 getComponent: func,
10688 getComponents: func
10689 },
10690
10691 /* istanbul ignore next: sanity check */
10692 render: function render() {
10693 !false ? process.env.NODE_ENV !== 'production' ? _invariant2['default'](false, '<Route> elements are for router configuration only and should not be rendered') : _invariant2['default'](false) : undefined;
10694 }
10695
10696});
10697
10698exports['default'] = Route;
10699module.exports = exports['default'];
10700}).call(this,require(91))
10701},{"117":117,"121":121,"297":297,"81":81,"91":91}],120:[function(require,module,exports){
10702(function (process){
10703'use strict';
10704
10705exports.__esModule = true;
10706
10707function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
10708
10709var _routerWarning = require(140);
10710
10711var _routerWarning2 = _interopRequireDefault(_routerWarning);
10712
10713var _react = require(297);
10714
10715var _react2 = _interopRequireDefault(_react);
10716
10717var object = _react2['default'].PropTypes.object;
10718
10719/**
10720 * The RouteContext mixin provides a convenient way for route
10721 * components to set the route in context. This is needed for
10722 * routes that render elements that want to use the Lifecycle
10723 * mixin to prevent transitions.
10724 */
10725var RouteContext = {
10726
10727 propTypes: {
10728 route: object.isRequired
10729 },
10730
10731 childContextTypes: {
10732 route: object.isRequired
10733 },
10734
10735 getChildContext: function getChildContext() {
10736 return {
10737 route: this.props.route
10738 };
10739 },
10740
10741 componentWillMount: function componentWillMount() {
10742 process.env.NODE_ENV !== 'production' ? _routerWarning2['default'](false, 'The `RouteContext` mixin is deprecated. You can provide `this.props.route` on context with your own `contextTypes`. http://tiny.cc/router-routecontextmixin') : undefined;
10743 }
10744
10745};
10746
10747exports['default'] = RouteContext;
10748module.exports = exports['default'];
10749}).call(this,require(91))
10750},{"140":140,"297":297,"91":91}],121:[function(require,module,exports){
10751(function (process){
10752'use strict';
10753
10754exports.__esModule = true;
10755
10756var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
10757
10758exports.isReactChildren = isReactChildren;
10759exports.createRouteFromReactElement = createRouteFromReactElement;
10760exports.createRoutesFromReactChildren = createRoutesFromReactChildren;
10761exports.createRoutes = createRoutes;
10762
10763function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
10764
10765var _react = require(297);
10766
10767var _react2 = _interopRequireDefault(_react);
10768
10769var _routerWarning = require(140);
10770
10771var _routerWarning2 = _interopRequireDefault(_routerWarning);
10772
10773function isValidChild(object) {
10774 return object == null || _react2['default'].isValidElement(object);
10775}
10776
10777function isReactChildren(object) {
10778 return isValidChild(object) || Array.isArray(object) && object.every(isValidChild);
10779}
10780
10781function checkPropTypes(componentName, propTypes, props) {
10782 componentName = componentName || 'UnknownComponent';
10783
10784 for (var propName in propTypes) {
10785 if (propTypes.hasOwnProperty(propName)) {
10786 var error = propTypes[propName](props, propName, componentName);
10787
10788 /* istanbul ignore if: error logging */
10789 if (error instanceof Error) process.env.NODE_ENV !== 'production' ? _routerWarning2['default'](false, error.message) : undefined;
10790 }
10791 }
10792}
10793
10794function createRoute(defaultProps, props) {
10795 return _extends({}, defaultProps, props);
10796}
10797
10798function createRouteFromReactElement(element) {
10799 var type = element.type;
10800 var route = createRoute(type.defaultProps, element.props);
10801
10802 if (type.propTypes) checkPropTypes(type.displayName || type.name, type.propTypes, route);
10803
10804 if (route.children) {
10805 var childRoutes = createRoutesFromReactChildren(route.children, route);
10806
10807 if (childRoutes.length) route.childRoutes = childRoutes;
10808
10809 delete route.children;
10810 }
10811
10812 return route;
10813}
10814
10815/**
10816 * Creates and returns a routes object from the given ReactChildren. JSX
10817 * provides a convenient way to visualize how routes in the hierarchy are
10818 * nested.
10819 *
10820 * import { Route, createRoutesFromReactChildren } from 'react-router'
10821 *
10822 * const routes = createRoutesFromReactChildren(
10823 * <Route component={App}>
10824 * <Route path="home" component={Dashboard}/>
10825 * <Route path="news" component={NewsFeed}/>
10826 * </Route>
10827 * )
10828 *
10829 * Note: This method is automatically used when you provide <Route> children
10830 * to a <Router> component.
10831 */
10832
10833function createRoutesFromReactChildren(children, parentRoute) {
10834 var routes = [];
10835
10836 _react2['default'].Children.forEach(children, function (element) {
10837 if (_react2['default'].isValidElement(element)) {
10838 // Component classes may have a static create* method.
10839 if (element.type.createRouteFromReactElement) {
10840 var route = element.type.createRouteFromReactElement(element, parentRoute);
10841
10842 if (route) routes.push(route);
10843 } else {
10844 routes.push(createRouteFromReactElement(element));
10845 }
10846 }
10847 });
10848
10849 return routes;
10850}
10851
10852/**
10853 * Creates and returns an array of routes from the given object which
10854 * may be a JSX route, a plain object route, or an array of either.
10855 */
10856
10857function createRoutes(routes) {
10858 if (isReactChildren(routes)) {
10859 routes = createRoutesFromReactChildren(routes);
10860 } else if (routes && !Array.isArray(routes)) {
10861 routes = [routes];
10862 }
10863
10864 return routes;
10865}
10866}).call(this,require(91))
10867},{"140":140,"297":297,"91":91}],122:[function(require,module,exports){
10868(function (process){
10869'use strict';
10870
10871exports.__esModule = true;
10872
10873var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
10874
10875function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
10876
10877function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; }
10878
10879var _historyLibCreateHashHistory = require(151);
10880
10881var _historyLibCreateHashHistory2 = _interopRequireDefault(_historyLibCreateHashHistory);
10882
10883var _historyLibUseQueries = require(158);
10884
10885var _historyLibUseQueries2 = _interopRequireDefault(_historyLibUseQueries);
10886
10887var _react = require(297);
10888
10889var _react2 = _interopRequireDefault(_react);
10890
10891var _createTransitionManager = require(131);
10892
10893var _createTransitionManager2 = _interopRequireDefault(_createTransitionManager);
10894
10895var _PropTypes = require(117);
10896
10897var _RouterContext = require(123);
10898
10899var _RouterContext2 = _interopRequireDefault(_RouterContext);
10900
10901var _RouteUtils = require(121);
10902
10903var _RouterUtils = require(124);
10904
10905var _routerWarning = require(140);
10906
10907var _routerWarning2 = _interopRequireDefault(_routerWarning);
10908
10909function isDeprecatedHistory(history) {
10910 return !history || !history.__v2_compatible__;
10911}
10912
10913var _React$PropTypes = _react2['default'].PropTypes;
10914var func = _React$PropTypes.func;
10915var object = _React$PropTypes.object;
10916
10917/**
10918 * A <Router> is a high-level API for automatically setting up
10919 * a router that renders a <RouterContext> with all the props
10920 * it needs each time the URL changes.
10921 */
10922var Router = _react2['default'].createClass({
10923 displayName: 'Router',
10924
10925 propTypes: {
10926 history: object,
10927 children: _PropTypes.routes,
10928 routes: _PropTypes.routes, // alias for children
10929 render: func,
10930 createElement: func,
10931 onError: func,
10932 onUpdate: func,
10933
10934 // PRIVATE: For client-side rehydration of server match.
10935 matchContext: object
10936 },
10937
10938 getDefaultProps: function getDefaultProps() {
10939 return {
10940 render: function render(props) {
10941 return _react2['default'].createElement(_RouterContext2['default'], props);
10942 }
10943 };
10944 },
10945
10946 getInitialState: function getInitialState() {
10947 return {
10948 location: null,
10949 routes: null,
10950 params: null,
10951 components: null
10952 };
10953 },
10954
10955 handleError: function handleError(error) {
10956 if (this.props.onError) {
10957 this.props.onError.call(this, error);
10958 } else {
10959 // Throw errors by default so we don't silently swallow them!
10960 throw error; // This error probably occurred in getChildRoutes or getComponents.
10961 }
10962 },
10963
10964 componentWillMount: function componentWillMount() {
10965 var _this = this;
10966
10967 var _props = this.props;
10968 var parseQueryString = _props.parseQueryString;
10969 var stringifyQuery = _props.stringifyQuery;
10970
10971 process.env.NODE_ENV !== 'production' ? _routerWarning2['default'](!(parseQueryString || stringifyQuery), '`parseQueryString` and `stringifyQuery` are deprecated. Please create a custom history. http://tiny.cc/router-customquerystring') : undefined;
10972
10973 var _createRouterObjects = this.createRouterObjects();
10974
10975 var history = _createRouterObjects.history;
10976 var transitionManager = _createRouterObjects.transitionManager;
10977 var router = _createRouterObjects.router;
10978
10979 this._unlisten = transitionManager.listen(function (error, state) {
10980 if (error) {
10981 _this.handleError(error);
10982 } else {
10983 _this.setState(state, _this.props.onUpdate);
10984 }
10985 });
10986
10987 this.history = history;
10988 this.router = router;
10989 },
10990
10991 createRouterObjects: function createRouterObjects() {
10992 var matchContext = this.props.matchContext;
10993
10994 if (matchContext) {
10995 return matchContext;
10996 }
10997
10998 var history = this.props.history;
10999 var _props2 = this.props;
11000 var routes = _props2.routes;
11001 var children = _props2.children;
11002
11003 if (isDeprecatedHistory(history)) {
11004 history = this.wrapDeprecatedHistory(history);
11005 }
11006
11007 var transitionManager = _createTransitionManager2['default'](history, _RouteUtils.createRoutes(routes || children));
11008 var router = _RouterUtils.createRouterObject(history, transitionManager);
11009 var routingHistory = _RouterUtils.createRoutingHistory(history, transitionManager);
11010
11011 return { history: routingHistory, transitionManager: transitionManager, router: router };
11012 },
11013
11014 wrapDeprecatedHistory: function wrapDeprecatedHistory(history) {
11015 var _props3 = this.props;
11016 var parseQueryString = _props3.parseQueryString;
11017 var stringifyQuery = _props3.stringifyQuery;
11018
11019 var createHistory = undefined;
11020 if (history) {
11021 process.env.NODE_ENV !== 'production' ? _routerWarning2['default'](false, 'It appears you have provided a deprecated history object to `<Router/>`, please use a history provided by ' + 'React Router with `import { browserHistory } from \'react-router\'` or `import { hashHistory } from \'react-router\'`. ' + 'If you are using a custom history please create it with `useRouterHistory`, see http://tiny.cc/router-usinghistory for details.') : undefined;
11022 createHistory = function () {
11023 return history;
11024 };
11025 } else {
11026 process.env.NODE_ENV !== 'production' ? _routerWarning2['default'](false, '`Router` no longer defaults the history prop to hash history. Please use the `hashHistory` singleton instead. http://tiny.cc/router-defaulthistory') : undefined;
11027 createHistory = _historyLibCreateHashHistory2['default'];
11028 }
11029
11030 return _historyLibUseQueries2['default'](createHistory)({ parseQueryString: parseQueryString, stringifyQuery: stringifyQuery });
11031 },
11032
11033 /* istanbul ignore next: sanity check */
11034 componentWillReceiveProps: function componentWillReceiveProps(nextProps) {
11035 process.env.NODE_ENV !== 'production' ? _routerWarning2['default'](nextProps.history === this.props.history, 'You cannot change <Router history>; it will be ignored') : undefined;
11036
11037 process.env.NODE_ENV !== 'production' ? _routerWarning2['default']((nextProps.routes || nextProps.children) === (this.props.routes || this.props.children), 'You cannot change <Router routes>; it will be ignored') : undefined;
11038 },
11039
11040 componentWillUnmount: function componentWillUnmount() {
11041 if (this._unlisten) this._unlisten();
11042 },
11043
11044 render: function render() {
11045 var _state = this.state;
11046 var location = _state.location;
11047 var routes = _state.routes;
11048 var params = _state.params;
11049 var components = _state.components;
11050 var _props4 = this.props;
11051 var createElement = _props4.createElement;
11052 var render = _props4.render;
11053
11054 var props = _objectWithoutProperties(_props4, ['createElement', 'render']);
11055
11056 if (location == null) return null; // Async match
11057
11058 // Only forward non-Router-specific props to routing context, as those are
11059 // the only ones that might be custom routing context props.
11060 Object.keys(Router.propTypes).forEach(function (propType) {
11061 return delete props[propType];
11062 });
11063
11064 return render(_extends({}, props, {
11065 history: this.history,
11066 router: this.router,
11067 location: location,
11068 routes: routes,
11069 params: params,
11070 components: components,
11071 createElement: createElement
11072 }));
11073 }
11074
11075});
11076
11077exports['default'] = Router;
11078module.exports = exports['default'];
11079}).call(this,require(91))
11080},{"117":117,"121":121,"123":123,"124":124,"131":131,"140":140,"151":151,"158":158,"297":297,"91":91}],123:[function(require,module,exports){
11081(function (process){
11082'use strict';
11083
11084exports.__esModule = true;
11085
11086var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
11087
11088function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
11089
11090var _invariant = require(81);
11091
11092var _invariant2 = _interopRequireDefault(_invariant);
11093
11094var _react = require(297);
11095
11096var _react2 = _interopRequireDefault(_react);
11097
11098var _deprecateObjectProperties = require(132);
11099
11100var _deprecateObjectProperties2 = _interopRequireDefault(_deprecateObjectProperties);
11101
11102var _getRouteParams = require(134);
11103
11104var _getRouteParams2 = _interopRequireDefault(_getRouteParams);
11105
11106var _RouteUtils = require(121);
11107
11108var _routerWarning = require(140);
11109
11110var _routerWarning2 = _interopRequireDefault(_routerWarning);
11111
11112var _React$PropTypes = _react2['default'].PropTypes;
11113var array = _React$PropTypes.array;
11114var func = _React$PropTypes.func;
11115var object = _React$PropTypes.object;
11116
11117/**
11118 * A <RouterContext> renders the component tree for a given router state
11119 * and sets the history object and the current location in context.
11120 */
11121var RouterContext = _react2['default'].createClass({
11122 displayName: 'RouterContext',
11123
11124 propTypes: {
11125 history: object,
11126 router: object.isRequired,
11127 location: object.isRequired,
11128 routes: array.isRequired,
11129 params: object.isRequired,
11130 components: array.isRequired,
11131 createElement: func.isRequired
11132 },
11133
11134 getDefaultProps: function getDefaultProps() {
11135 return {
11136 createElement: _react2['default'].createElement
11137 };
11138 },
11139
11140 childContextTypes: {
11141 history: object,
11142 location: object.isRequired,
11143 router: object.isRequired
11144 },
11145
11146 getChildContext: function getChildContext() {
11147 var _props = this.props;
11148 var router = _props.router;
11149 var history = _props.history;
11150 var location = _props.location;
11151
11152 if (!router) {
11153 process.env.NODE_ENV !== 'production' ? _routerWarning2['default'](false, '`<RouterContext>` expects a `router` rather than a `history`') : undefined;
11154
11155 router = _extends({}, history, {
11156 setRouteLeaveHook: history.listenBeforeLeavingRoute
11157 });
11158 delete router.listenBeforeLeavingRoute;
11159 }
11160
11161 if (process.env.NODE_ENV !== 'production') {
11162 location = _deprecateObjectProperties2['default'](location, '`context.location` is deprecated, please use a route component\'s `props.location` instead. http://tiny.cc/router-accessinglocation');
11163 }
11164
11165 return { history: history, location: location, router: router };
11166 },
11167
11168 createElement: function createElement(component, props) {
11169 return component == null ? null : this.props.createElement(component, props);
11170 },
11171
11172 render: function render() {
11173 var _this = this;
11174
11175 var _props2 = this.props;
11176 var history = _props2.history;
11177 var location = _props2.location;
11178 var routes = _props2.routes;
11179 var params = _props2.params;
11180 var components = _props2.components;
11181
11182 var element = null;
11183
11184 if (components) {
11185 element = components.reduceRight(function (element, components, index) {
11186 if (components == null) return element; // Don't create new children; use the grandchildren.
11187
11188 var route = routes[index];
11189 var routeParams = _getRouteParams2['default'](route, params);
11190 var props = {
11191 history: history,
11192 location: location,
11193 params: params,
11194 route: route,
11195 routeParams: routeParams,
11196 routes: routes
11197 };
11198
11199 if (_RouteUtils.isReactChildren(element)) {
11200 props.children = element;
11201 } else if (element) {
11202 for (var prop in element) {
11203 if (element.hasOwnProperty(prop)) props[prop] = element[prop];
11204 }
11205 }
11206
11207 if (typeof components === 'object') {
11208 var elements = {};
11209
11210 for (var key in components) {
11211 if (components.hasOwnProperty(key)) {
11212 // Pass through the key as a prop to createElement to allow
11213 // custom createElement functions to know which named component
11214 // they're rendering, for e.g. matching up to fetched data.
11215 elements[key] = _this.createElement(components[key], _extends({
11216 key: key }, props));
11217 }
11218 }
11219
11220 return elements;
11221 }
11222
11223 return _this.createElement(components, props);
11224 }, element);
11225 }
11226
11227 !(element === null || element === false || _react2['default'].isValidElement(element)) ? process.env.NODE_ENV !== 'production' ? _invariant2['default'](false, 'The root route must render a single element') : _invariant2['default'](false) : undefined;
11228
11229 return element;
11230 }
11231
11232});
11233
11234exports['default'] = RouterContext;
11235module.exports = exports['default'];
11236}).call(this,require(91))
11237},{"121":121,"132":132,"134":134,"140":140,"297":297,"81":81,"91":91}],124:[function(require,module,exports){
11238(function (process){
11239'use strict';
11240
11241exports.__esModule = true;
11242
11243var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
11244
11245exports.createRouterObject = createRouterObject;
11246exports.createRoutingHistory = createRoutingHistory;
11247
11248function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
11249
11250var _deprecateObjectProperties = require(132);
11251
11252var _deprecateObjectProperties2 = _interopRequireDefault(_deprecateObjectProperties);
11253
11254function createRouterObject(history, transitionManager) {
11255 return _extends({}, history, {
11256 setRouteLeaveHook: transitionManager.listenBeforeLeavingRoute,
11257 isActive: transitionManager.isActive
11258 });
11259}
11260
11261// deprecated
11262
11263function createRoutingHistory(history, transitionManager) {
11264 history = _extends({}, history, transitionManager);
11265
11266 if (process.env.NODE_ENV !== 'production') {
11267 history = _deprecateObjectProperties2['default'](history, '`props.history` and `context.history` are deprecated. Please use `context.router`. http://tiny.cc/router-contextchanges');
11268 }
11269
11270 return history;
11271}
11272}).call(this,require(91))
11273},{"132":132,"91":91}],125:[function(require,module,exports){
11274(function (process){
11275'use strict';
11276
11277exports.__esModule = true;
11278
11279function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
11280
11281var _react = require(297);
11282
11283var _react2 = _interopRequireDefault(_react);
11284
11285var _RouterContext = require(123);
11286
11287var _RouterContext2 = _interopRequireDefault(_RouterContext);
11288
11289var _routerWarning = require(140);
11290
11291var _routerWarning2 = _interopRequireDefault(_routerWarning);
11292
11293var RoutingContext = _react2['default'].createClass({
11294 displayName: 'RoutingContext',
11295
11296 componentWillMount: function componentWillMount() {
11297 process.env.NODE_ENV !== 'production' ? _routerWarning2['default'](false, '`RoutingContext` has been renamed to `RouterContext`. Please use `import { RouterContext } from \'react-router\'`. http://tiny.cc/router-routercontext') : undefined;
11298 },
11299
11300 render: function render() {
11301 return _react2['default'].createElement(_RouterContext2['default'], this.props);
11302 }
11303});
11304
11305exports['default'] = RoutingContext;
11306module.exports = exports['default'];
11307}).call(this,require(91))
11308},{"123":123,"140":140,"297":297,"91":91}],126:[function(require,module,exports){
11309(function (process){
11310'use strict';
11311
11312exports.__esModule = true;
11313exports.runEnterHooks = runEnterHooks;
11314exports.runLeaveHooks = runLeaveHooks;
11315
11316function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
11317
11318var _AsyncUtils = require(109);
11319
11320var _routerWarning = require(140);
11321
11322var _routerWarning2 = _interopRequireDefault(_routerWarning);
11323
11324function createEnterHook(hook, route) {
11325 return function (a, b, callback) {
11326 hook.apply(route, arguments);
11327
11328 if (hook.length < 3) {
11329 // Assume hook executes synchronously and
11330 // automatically call the callback.
11331 callback();
11332 }
11333 };
11334}
11335
11336function getEnterHooks(routes) {
11337 return routes.reduce(function (hooks, route) {
11338 if (route.onEnter) hooks.push(createEnterHook(route.onEnter, route));
11339
11340 return hooks;
11341 }, []);
11342}
11343
11344/**
11345 * Runs all onEnter hooks in the given array of routes in order
11346 * with onEnter(nextState, replace, callback) and calls
11347 * callback(error, redirectInfo) when finished. The first hook
11348 * to use replace short-circuits the loop.
11349 *
11350 * If a hook needs to run asynchronously, it may use the callback
11351 * function. However, doing so will cause the transition to pause,
11352 * which could lead to a non-responsive UI if the hook is slow.
11353 */
11354
11355function runEnterHooks(routes, nextState, callback) {
11356 var hooks = getEnterHooks(routes);
11357
11358 if (!hooks.length) {
11359 callback();
11360 return;
11361 }
11362
11363 var redirectInfo = undefined;
11364 function replace(location, deprecatedPathname, deprecatedQuery) {
11365 if (deprecatedPathname) {
11366 process.env.NODE_ENV !== 'production' ? _routerWarning2['default'](false, '`replaceState(state, pathname, query) is deprecated; use `replace(location)` with a location descriptor instead. http://tiny.cc/router-isActivedeprecated') : undefined;
11367 redirectInfo = {
11368 pathname: deprecatedPathname,
11369 query: deprecatedQuery,
11370 state: location
11371 };
11372
11373 return;
11374 }
11375
11376 redirectInfo = location;
11377 }
11378
11379 _AsyncUtils.loopAsync(hooks.length, function (index, next, done) {
11380 hooks[index](nextState, replace, function (error) {
11381 if (error || redirectInfo) {
11382 done(error, redirectInfo); // No need to continue.
11383 } else {
11384 next();
11385 }
11386 });
11387 }, callback);
11388}
11389
11390/**
11391 * Runs all onLeave hooks in the given array of routes in order.
11392 */
11393
11394function runLeaveHooks(routes) {
11395 for (var i = 0, len = routes.length; i < len; ++i) {
11396 if (routes[i].onLeave) routes[i].onLeave.call(routes[i]);
11397 }
11398}
11399}).call(this,require(91))
11400},{"109":109,"140":140,"91":91}],127:[function(require,module,exports){
11401'use strict';
11402
11403exports.__esModule = true;
11404
11405function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
11406
11407var _historyLibCreateBrowserHistory = require(149);
11408
11409var _historyLibCreateBrowserHistory2 = _interopRequireDefault(_historyLibCreateBrowserHistory);
11410
11411var _createRouterHistory = require(130);
11412
11413var _createRouterHistory2 = _interopRequireDefault(_createRouterHistory);
11414
11415exports['default'] = _createRouterHistory2['default'](_historyLibCreateBrowserHistory2['default']);
11416module.exports = exports['default'];
11417},{"130":130,"149":149}],128:[function(require,module,exports){
11418'use strict';
11419
11420exports.__esModule = true;
11421
11422var _PatternUtils = require(116);
11423
11424function routeParamsChanged(route, prevState, nextState) {
11425 if (!route.path) return false;
11426
11427 var paramNames = _PatternUtils.getParamNames(route.path);
11428
11429 return paramNames.some(function (paramName) {
11430 return prevState.params[paramName] !== nextState.params[paramName];
11431 });
11432}
11433
11434/**
11435 * Returns an object of { leaveRoutes, enterRoutes } determined by
11436 * the change from prevState to nextState. We leave routes if either
11437 * 1) they are not in the next state or 2) they are in the next state
11438 * but their params have changed (i.e. /users/123 => /users/456).
11439 *
11440 * leaveRoutes are ordered starting at the leaf route of the tree
11441 * we're leaving up to the common parent route. enterRoutes are ordered
11442 * from the top of the tree we're entering down to the leaf route.
11443 */
11444function computeChangedRoutes(prevState, nextState) {
11445 var prevRoutes = prevState && prevState.routes;
11446 var nextRoutes = nextState.routes;
11447
11448 var leaveRoutes = undefined,
11449 enterRoutes = undefined;
11450 if (prevRoutes) {
11451 leaveRoutes = prevRoutes.filter(function (route) {
11452 return nextRoutes.indexOf(route) === -1 || routeParamsChanged(route, prevState, nextState);
11453 });
11454
11455 // onLeave hooks start at the leaf route.
11456 leaveRoutes.reverse();
11457
11458 enterRoutes = nextRoutes.filter(function (route) {
11459 return prevRoutes.indexOf(route) === -1 || leaveRoutes.indexOf(route) !== -1;
11460 });
11461 } else {
11462 leaveRoutes = [];
11463 enterRoutes = nextRoutes;
11464 }
11465
11466 return {
11467 leaveRoutes: leaveRoutes,
11468 enterRoutes: enterRoutes
11469 };
11470}
11471
11472exports['default'] = computeChangedRoutes;
11473module.exports = exports['default'];
11474},{"116":116}],129:[function(require,module,exports){
11475'use strict';
11476
11477exports.__esModule = true;
11478exports['default'] = createMemoryHistory;
11479
11480function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
11481
11482var _historyLibUseQueries = require(158);
11483
11484var _historyLibUseQueries2 = _interopRequireDefault(_historyLibUseQueries);
11485
11486var _historyLibUseBasename = require(157);
11487
11488var _historyLibUseBasename2 = _interopRequireDefault(_historyLibUseBasename);
11489
11490var _historyLibCreateMemoryHistory = require(154);
11491
11492var _historyLibCreateMemoryHistory2 = _interopRequireDefault(_historyLibCreateMemoryHistory);
11493
11494function createMemoryHistory(options) {
11495 // signatures and type checking differ between `useRoutes` and
11496 // `createMemoryHistory`, have to create `memoryHistory` first because
11497 // `useQueries` doesn't understand the signature
11498 var memoryHistory = _historyLibCreateMemoryHistory2['default'](options);
11499 var createHistory = function createHistory() {
11500 return memoryHistory;
11501 };
11502 var history = _historyLibUseQueries2['default'](_historyLibUseBasename2['default'](createHistory))(options);
11503 history.__v2_compatible__ = true;
11504 return history;
11505}
11506
11507module.exports = exports['default'];
11508},{"154":154,"157":157,"158":158}],130:[function(require,module,exports){
11509'use strict';
11510
11511exports.__esModule = true;
11512
11513function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
11514
11515var _useRouterHistory = require(141);
11516
11517var _useRouterHistory2 = _interopRequireDefault(_useRouterHistory);
11518
11519var canUseDOM = !!(typeof window !== 'undefined' && window.document && window.document.createElement);
11520
11521exports['default'] = function (createHistory) {
11522 var history = undefined;
11523 if (canUseDOM) history = _useRouterHistory2['default'](createHistory)();
11524 return history;
11525};
11526
11527module.exports = exports['default'];
11528},{"141":141}],131:[function(require,module,exports){
11529(function (process){
11530'use strict';
11531
11532exports.__esModule = true;
11533
11534var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
11535
11536exports['default'] = createTransitionManager;
11537
11538function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
11539
11540var _routerWarning = require(140);
11541
11542var _routerWarning2 = _interopRequireDefault(_routerWarning);
11543
11544var _historyLibActions = require(143);
11545
11546var _computeChangedRoutes2 = require(128);
11547
11548var _computeChangedRoutes3 = _interopRequireDefault(_computeChangedRoutes2);
11549
11550var _TransitionUtils = require(126);
11551
11552var _isActive2 = require(137);
11553
11554var _isActive3 = _interopRequireDefault(_isActive2);
11555
11556var _getComponents = require(133);
11557
11558var _getComponents2 = _interopRequireDefault(_getComponents);
11559
11560var _matchRoutes = require(139);
11561
11562var _matchRoutes2 = _interopRequireDefault(_matchRoutes);
11563
11564function hasAnyProperties(object) {
11565 for (var p in object) {
11566 if (object.hasOwnProperty(p)) return true;
11567 }return false;
11568}
11569
11570function createTransitionManager(history, routes) {
11571 var state = {};
11572
11573 // Signature should be (location, indexOnly), but needs to support (path,
11574 // query, indexOnly)
11575 function isActive(location) {
11576 var indexOnlyOrDeprecatedQuery = arguments.length <= 1 || arguments[1] === undefined ? false : arguments[1];
11577 var deprecatedIndexOnly = arguments.length <= 2 || arguments[2] === undefined ? null : arguments[2];
11578
11579 var indexOnly = undefined;
11580 if (indexOnlyOrDeprecatedQuery && indexOnlyOrDeprecatedQuery !== true || deprecatedIndexOnly !== null) {
11581 process.env.NODE_ENV !== 'production' ? _routerWarning2['default'](false, '`isActive(pathname, query, indexOnly) is deprecated; use `isActive(location, indexOnly)` with a location descriptor instead. http://tiny.cc/router-isActivedeprecated') : undefined;
11582 location = { pathname: location, query: indexOnlyOrDeprecatedQuery };
11583 indexOnly = deprecatedIndexOnly || false;
11584 } else {
11585 location = history.createLocation(location);
11586 indexOnly = indexOnlyOrDeprecatedQuery;
11587 }
11588
11589 return _isActive3['default'](location, indexOnly, state.location, state.routes, state.params);
11590 }
11591
11592 function createLocationFromRedirectInfo(location) {
11593 return history.createLocation(location, _historyLibActions.REPLACE);
11594 }
11595
11596 var partialNextState = undefined;
11597
11598 function match(location, callback) {
11599 if (partialNextState && partialNextState.location === location) {
11600 // Continue from where we left off.
11601 finishMatch(partialNextState, callback);
11602 } else {
11603 _matchRoutes2['default'](routes, location, function (error, nextState) {
11604 if (error) {
11605 callback(error);
11606 } else if (nextState) {
11607 finishMatch(_extends({}, nextState, { location: location }), callback);
11608 } else {
11609 callback();
11610 }
11611 });
11612 }
11613 }
11614
11615 function finishMatch(nextState, callback) {
11616 var _computeChangedRoutes = _computeChangedRoutes3['default'](state, nextState);
11617
11618 var leaveRoutes = _computeChangedRoutes.leaveRoutes;
11619 var enterRoutes = _computeChangedRoutes.enterRoutes;
11620
11621 _TransitionUtils.runLeaveHooks(leaveRoutes);
11622
11623 // Tear down confirmation hooks for left routes
11624 leaveRoutes.forEach(removeListenBeforeHooksForRoute);
11625
11626 _TransitionUtils.runEnterHooks(enterRoutes, nextState, function (error, redirectInfo) {
11627 if (error) {
11628 callback(error);
11629 } else if (redirectInfo) {
11630 callback(null, createLocationFromRedirectInfo(redirectInfo));
11631 } else {
11632 // TODO: Fetch components after state is updated.
11633 _getComponents2['default'](nextState, function (error, components) {
11634 if (error) {
11635 callback(error);
11636 } else {
11637 // TODO: Make match a pure function and have some other API
11638 // for "match and update state".
11639 callback(null, null, state = _extends({}, nextState, { components: components }));
11640 }
11641 });
11642 }
11643 });
11644 }
11645
11646 var RouteGuid = 1;
11647
11648 function getRouteID(route) {
11649 var create = arguments.length <= 1 || arguments[1] === undefined ? true : arguments[1];
11650
11651 return route.__id__ || create && (route.__id__ = RouteGuid++);
11652 }
11653
11654 var RouteHooks = {};
11655
11656 function getRouteHooksForRoutes(routes) {
11657 return routes.reduce(function (hooks, route) {
11658 hooks.push.apply(hooks, RouteHooks[getRouteID(route)]);
11659 return hooks;
11660 }, []);
11661 }
11662
11663 function transitionHook(location, callback) {
11664 _matchRoutes2['default'](routes, location, function (error, nextState) {
11665 if (nextState == null) {
11666 // TODO: We didn't actually match anything, but hang
11667 // onto error/nextState so we don't have to matchRoutes
11668 // again in the listen callback.
11669 callback();
11670 return;
11671 }
11672
11673 // Cache some state here so we don't have to
11674 // matchRoutes() again in the listen callback.
11675 partialNextState = _extends({}, nextState, { location: location });
11676
11677 var hooks = getRouteHooksForRoutes(_computeChangedRoutes3['default'](state, partialNextState).leaveRoutes);
11678
11679 var result = undefined;
11680 for (var i = 0, len = hooks.length; result == null && i < len; ++i) {
11681 // Passing the location arg here indicates to
11682 // the user that this is a transition hook.
11683 result = hooks[i](location);
11684 }
11685
11686 callback(result);
11687 });
11688 }
11689
11690 /* istanbul ignore next: untestable with Karma */
11691 function beforeUnloadHook() {
11692 // Synchronously check to see if any route hooks want
11693 // to prevent the current window/tab from closing.
11694 if (state.routes) {
11695 var hooks = getRouteHooksForRoutes(state.routes);
11696
11697 var message = undefined;
11698 for (var i = 0, len = hooks.length; typeof message !== 'string' && i < len; ++i) {
11699 // Passing no args indicates to the user that this is a
11700 // beforeunload hook. We don't know the next location.
11701 message = hooks[i]();
11702 }
11703
11704 return message;
11705 }
11706 }
11707
11708 var unlistenBefore = undefined,
11709 unlistenBeforeUnload = undefined;
11710
11711 function removeListenBeforeHooksForRoute(route) {
11712 var routeID = getRouteID(route, false);
11713 if (!routeID) {
11714 return;
11715 }
11716
11717 delete RouteHooks[routeID];
11718
11719 if (!hasAnyProperties(RouteHooks)) {
11720 // teardown transition & beforeunload hooks
11721 if (unlistenBefore) {
11722 unlistenBefore();
11723 unlistenBefore = null;
11724 }
11725
11726 if (unlistenBeforeUnload) {
11727 unlistenBeforeUnload();
11728 unlistenBeforeUnload = null;
11729 }
11730 }
11731 }
11732
11733 /**
11734 * Registers the given hook function to run before leaving the given route.
11735 *
11736 * During a normal transition, the hook function receives the next location
11737 * as its only argument and must return either a) a prompt message to show
11738 * the user, to make sure they want to leave the page or b) false, to prevent
11739 * the transition.
11740 *
11741 * During the beforeunload event (in browsers) the hook receives no arguments.
11742 * In this case it must return a prompt message to prevent the transition.
11743 *
11744 * Returns a function that may be used to unbind the listener.
11745 */
11746 function listenBeforeLeavingRoute(route, hook) {
11747 // TODO: Warn if they register for a route that isn't currently
11748 // active. They're probably doing something wrong, like re-creating
11749 // route objects on every location change.
11750 var routeID = getRouteID(route);
11751 var hooks = RouteHooks[routeID];
11752
11753 if (!hooks) {
11754 var thereWereNoRouteHooks = !hasAnyProperties(RouteHooks);
11755
11756 RouteHooks[routeID] = [hook];
11757
11758 if (thereWereNoRouteHooks) {
11759 // setup transition & beforeunload hooks
11760 unlistenBefore = history.listenBefore(transitionHook);
11761
11762 if (history.listenBeforeUnload) unlistenBeforeUnload = history.listenBeforeUnload(beforeUnloadHook);
11763 }
11764 } else {
11765 if (hooks.indexOf(hook) === -1) {
11766 process.env.NODE_ENV !== 'production' ? _routerWarning2['default'](false, 'adding multiple leave hooks for the same route is deprecated; manage multiple confirmations in your own code instead') : undefined;
11767
11768 hooks.push(hook);
11769 }
11770 }
11771
11772 return function () {
11773 var hooks = RouteHooks[routeID];
11774
11775 if (hooks) {
11776 var newHooks = hooks.filter(function (item) {
11777 return item !== hook;
11778 });
11779
11780 if (newHooks.length === 0) {
11781 removeListenBeforeHooksForRoute(route);
11782 } else {
11783 RouteHooks[routeID] = newHooks;
11784 }
11785 }
11786 };
11787 }
11788
11789 /**
11790 * This is the API for stateful environments. As the location
11791 * changes, we update state and call the listener. We can also
11792 * gracefully handle errors and redirects.
11793 */
11794 function listen(listener) {
11795 // TODO: Only use a single history listener. Otherwise we'll
11796 // end up with multiple concurrent calls to match.
11797 return history.listen(function (location) {
11798 if (state.location === location) {
11799 listener(null, state);
11800 } else {
11801 match(location, function (error, redirectLocation, nextState) {
11802 if (error) {
11803 listener(error);
11804 } else if (redirectLocation) {
11805 history.transitionTo(redirectLocation);
11806 } else if (nextState) {
11807 listener(null, nextState);
11808 } else {
11809 process.env.NODE_ENV !== 'production' ? _routerWarning2['default'](false, 'Location "%s" did not match any routes', location.pathname + location.search + location.hash) : undefined;
11810 }
11811 });
11812 }
11813 });
11814 }
11815
11816 return {
11817 isActive: isActive,
11818 match: match,
11819 listenBeforeLeavingRoute: listenBeforeLeavingRoute,
11820 listen: listen
11821 };
11822}
11823
11824//export default useRoutes
11825module.exports = exports['default'];
11826}).call(this,require(91))
11827},{"126":126,"128":128,"133":133,"137":137,"139":139,"140":140,"143":143,"91":91}],132:[function(require,module,exports){
11828(function (process){
11829/*eslint no-empty: 0*/
11830'use strict';
11831
11832exports.__esModule = true;
11833exports['default'] = deprecateObjectProperties;
11834
11835function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
11836
11837var _routerWarning = require(140);
11838
11839var _routerWarning2 = _interopRequireDefault(_routerWarning);
11840
11841var useMembrane = false;
11842
11843if (process.env.NODE_ENV !== 'production') {
11844 try {
11845 if (Object.defineProperty({}, 'x', { get: function get() {
11846 return true;
11847 } }).x) {
11848 useMembrane = true;
11849 }
11850 } catch (e) {}
11851}
11852
11853// wraps an object in a membrane to warn about deprecated property access
11854
11855function deprecateObjectProperties(object, message) {
11856 if (!useMembrane) return object;
11857
11858 var membrane = {};
11859
11860 var _loop = function (prop) {
11861 if (typeof object[prop] === 'function') {
11862 membrane[prop] = function () {
11863 process.env.NODE_ENV !== 'production' ? _routerWarning2['default'](false, message) : undefined;
11864 return object[prop].apply(object, arguments);
11865 };
11866 } else {
11867 Object.defineProperty(membrane, prop, {
11868 configurable: false,
11869 enumerable: false,
11870 get: function get() {
11871 process.env.NODE_ENV !== 'production' ? _routerWarning2['default'](false, message) : undefined;
11872 return object[prop];
11873 }
11874 });
11875 }
11876 };
11877
11878 for (var prop in object) {
11879 _loop(prop);
11880 }
11881
11882 return membrane;
11883}
11884
11885module.exports = exports['default'];
11886}).call(this,require(91))
11887},{"140":140,"91":91}],133:[function(require,module,exports){
11888'use strict';
11889
11890exports.__esModule = true;
11891
11892var _AsyncUtils = require(109);
11893
11894function getComponentsForRoute(location, route, callback) {
11895 if (route.component || route.components) {
11896 callback(null, route.component || route.components);
11897 } else if (route.getComponent) {
11898 route.getComponent(location, callback);
11899 } else if (route.getComponents) {
11900 route.getComponents(location, callback);
11901 } else {
11902 callback();
11903 }
11904}
11905
11906/**
11907 * Asynchronously fetches all components needed for the given router
11908 * state and calls callback(error, components) when finished.
11909 *
11910 * Note: This operation may finish synchronously if no routes have an
11911 * asynchronous getComponents method.
11912 */
11913function getComponents(nextState, callback) {
11914 _AsyncUtils.mapAsync(nextState.routes, function (route, index, callback) {
11915 getComponentsForRoute(nextState.location, route, callback);
11916 }, callback);
11917}
11918
11919exports['default'] = getComponents;
11920module.exports = exports['default'];
11921},{"109":109}],134:[function(require,module,exports){
11922'use strict';
11923
11924exports.__esModule = true;
11925
11926var _PatternUtils = require(116);
11927
11928/**
11929 * Extracts an object of params the given route cares about from
11930 * the given params object.
11931 */
11932function getRouteParams(route, params) {
11933 var routeParams = {};
11934
11935 if (!route.path) return routeParams;
11936
11937 var paramNames = _PatternUtils.getParamNames(route.path);
11938
11939 for (var p in params) {
11940 if (params.hasOwnProperty(p) && paramNames.indexOf(p) !== -1) routeParams[p] = params[p];
11941 }return routeParams;
11942}
11943
11944exports['default'] = getRouteParams;
11945module.exports = exports['default'];
11946},{"116":116}],135:[function(require,module,exports){
11947'use strict';
11948
11949exports.__esModule = true;
11950
11951function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
11952
11953var _historyLibCreateHashHistory = require(151);
11954
11955var _historyLibCreateHashHistory2 = _interopRequireDefault(_historyLibCreateHashHistory);
11956
11957var _createRouterHistory = require(130);
11958
11959var _createRouterHistory2 = _interopRequireDefault(_createRouterHistory);
11960
11961exports['default'] = _createRouterHistory2['default'](_historyLibCreateHashHistory2['default']);
11962module.exports = exports['default'];
11963},{"130":130,"151":151}],136:[function(require,module,exports){
11964/* components */
11965'use strict';
11966
11967exports.__esModule = true;
11968
11969function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
11970
11971var _Router2 = require(122);
11972
11973var _Router3 = _interopRequireDefault(_Router2);
11974
11975exports.Router = _Router3['default'];
11976
11977var _Link2 = require(115);
11978
11979var _Link3 = _interopRequireDefault(_Link2);
11980
11981exports.Link = _Link3['default'];
11982
11983var _IndexLink2 = require(111);
11984
11985var _IndexLink3 = _interopRequireDefault(_IndexLink2);
11986
11987exports.IndexLink = _IndexLink3['default'];
11988
11989/* components (configuration) */
11990
11991var _IndexRedirect2 = require(112);
11992
11993var _IndexRedirect3 = _interopRequireDefault(_IndexRedirect2);
11994
11995exports.IndexRedirect = _IndexRedirect3['default'];
11996
11997var _IndexRoute2 = require(113);
11998
11999var _IndexRoute3 = _interopRequireDefault(_IndexRoute2);
12000
12001exports.IndexRoute = _IndexRoute3['default'];
12002
12003var _Redirect2 = require(118);
12004
12005var _Redirect3 = _interopRequireDefault(_Redirect2);
12006
12007exports.Redirect = _Redirect3['default'];
12008
12009var _Route2 = require(119);
12010
12011var _Route3 = _interopRequireDefault(_Route2);
12012
12013exports.Route = _Route3['default'];
12014
12015/* mixins */
12016
12017var _History2 = require(110);
12018
12019var _History3 = _interopRequireDefault(_History2);
12020
12021exports.History = _History3['default'];
12022
12023var _Lifecycle2 = require(114);
12024
12025var _Lifecycle3 = _interopRequireDefault(_Lifecycle2);
12026
12027exports.Lifecycle = _Lifecycle3['default'];
12028
12029var _RouteContext2 = require(120);
12030
12031var _RouteContext3 = _interopRequireDefault(_RouteContext2);
12032
12033exports.RouteContext = _RouteContext3['default'];
12034
12035/* utils */
12036
12037var _useRoutes2 = require(142);
12038
12039var _useRoutes3 = _interopRequireDefault(_useRoutes2);
12040
12041exports.useRoutes = _useRoutes3['default'];
12042
12043var _RouteUtils = require(121);
12044
12045exports.createRoutes = _RouteUtils.createRoutes;
12046
12047var _RouterContext2 = require(123);
12048
12049var _RouterContext3 = _interopRequireDefault(_RouterContext2);
12050
12051exports.RouterContext = _RouterContext3['default'];
12052
12053var _RoutingContext2 = require(125);
12054
12055var _RoutingContext3 = _interopRequireDefault(_RoutingContext2);
12056
12057exports.RoutingContext = _RoutingContext3['default'];
12058
12059var _PropTypes2 = require(117);
12060
12061var _PropTypes3 = _interopRequireDefault(_PropTypes2);
12062
12063exports.PropTypes = _PropTypes3['default'];
12064
12065var _match2 = require(138);
12066
12067var _match3 = _interopRequireDefault(_match2);
12068
12069exports.match = _match3['default'];
12070
12071var _useRouterHistory2 = require(141);
12072
12073var _useRouterHistory3 = _interopRequireDefault(_useRouterHistory2);
12074
12075exports.useRouterHistory = _useRouterHistory3['default'];
12076
12077var _PatternUtils = require(116);
12078
12079exports.formatPattern = _PatternUtils.formatPattern;
12080
12081/* histories */
12082
12083var _browserHistory2 = require(127);
12084
12085var _browserHistory3 = _interopRequireDefault(_browserHistory2);
12086
12087exports.browserHistory = _browserHistory3['default'];
12088
12089var _hashHistory2 = require(135);
12090
12091var _hashHistory3 = _interopRequireDefault(_hashHistory2);
12092
12093exports.hashHistory = _hashHistory3['default'];
12094
12095var _createMemoryHistory2 = require(129);
12096
12097var _createMemoryHistory3 = _interopRequireDefault(_createMemoryHistory2);
12098
12099exports.createMemoryHistory = _createMemoryHistory3['default'];
12100},{"110":110,"111":111,"112":112,"113":113,"114":114,"115":115,"116":116,"117":117,"118":118,"119":119,"120":120,"121":121,"122":122,"123":123,"125":125,"127":127,"129":129,"135":135,"138":138,"141":141,"142":142}],137:[function(require,module,exports){
12101'use strict';
12102
12103exports.__esModule = true;
12104exports['default'] = isActive;
12105
12106var _PatternUtils = require(116);
12107
12108function deepEqual(a, b) {
12109 if (a == b) return true;
12110
12111 if (a == null || b == null) return false;
12112
12113 if (Array.isArray(a)) {
12114 return Array.isArray(b) && a.length === b.length && a.every(function (item, index) {
12115 return deepEqual(item, b[index]);
12116 });
12117 }
12118
12119 if (typeof a === 'object') {
12120 for (var p in a) {
12121 if (!a.hasOwnProperty(p)) {
12122 continue;
12123 }
12124
12125 if (a[p] === undefined) {
12126 if (b[p] !== undefined) {
12127 return false;
12128 }
12129 } else if (!b.hasOwnProperty(p)) {
12130 return false;
12131 } else if (!deepEqual(a[p], b[p])) {
12132 return false;
12133 }
12134 }
12135
12136 return true;
12137 }
12138
12139 return String(a) === String(b);
12140}
12141
12142function paramsAreActive(paramNames, paramValues, activeParams) {
12143 // FIXME: This doesn't work on repeated params in activeParams.
12144 return paramNames.every(function (paramName, index) {
12145 return String(paramValues[index]) === String(activeParams[paramName]);
12146 });
12147}
12148
12149function getMatchingRouteIndex(pathname, activeRoutes, activeParams) {
12150 var remainingPathname = pathname,
12151 paramNames = [],
12152 paramValues = [];
12153
12154 for (var i = 0, len = activeRoutes.length; i < len; ++i) {
12155 var route = activeRoutes[i];
12156 var pattern = route.path || '';
12157
12158 if (pattern.charAt(0) === '/') {
12159 remainingPathname = pathname;
12160 paramNames = [];
12161 paramValues = [];
12162 }
12163
12164 if (remainingPathname !== null) {
12165 var matched = _PatternUtils.matchPattern(pattern, remainingPathname);
12166 remainingPathname = matched.remainingPathname;
12167 paramNames = [].concat(paramNames, matched.paramNames);
12168 paramValues = [].concat(paramValues, matched.paramValues);
12169 }
12170
12171 if (remainingPathname === '' && route.path && paramsAreActive(paramNames, paramValues, activeParams)) return i;
12172 }
12173
12174 return null;
12175}
12176
12177/**
12178 * Returns true if the given pathname matches the active routes
12179 * and params.
12180 */
12181function routeIsActive(pathname, routes, params, indexOnly) {
12182 var i = getMatchingRouteIndex(pathname, routes, params);
12183
12184 if (i === null) {
12185 // No match.
12186 return false;
12187 } else if (!indexOnly) {
12188 // Any match is good enough.
12189 return true;
12190 }
12191
12192 // If any remaining routes past the match index have paths, then we can't
12193 // be on the index route.
12194 return routes.slice(i + 1).every(function (route) {
12195 return !route.path;
12196 });
12197}
12198
12199/**
12200 * Returns true if all key/value pairs in the given query are
12201 * currently active.
12202 */
12203function queryIsActive(query, activeQuery) {
12204 if (activeQuery == null) return query == null;
12205
12206 if (query == null) return true;
12207
12208 return deepEqual(query, activeQuery);
12209}
12210
12211/**
12212 * Returns true if a <Link> to the given pathname/query combination is
12213 * currently active.
12214 */
12215
12216function isActive(_ref, indexOnly, currentLocation, routes, params) {
12217 var pathname = _ref.pathname;
12218 var query = _ref.query;
12219
12220 if (currentLocation == null) return false;
12221
12222 if (!routeIsActive(pathname, routes, params, indexOnly)) return false;
12223
12224 return queryIsActive(query, currentLocation.query);
12225}
12226
12227module.exports = exports['default'];
12228},{"116":116}],138:[function(require,module,exports){
12229(function (process){
12230'use strict';
12231
12232exports.__esModule = true;
12233
12234var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
12235
12236function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
12237
12238function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; }
12239
12240var _invariant = require(81);
12241
12242var _invariant2 = _interopRequireDefault(_invariant);
12243
12244var _createMemoryHistory = require(129);
12245
12246var _createMemoryHistory2 = _interopRequireDefault(_createMemoryHistory);
12247
12248var _createTransitionManager = require(131);
12249
12250var _createTransitionManager2 = _interopRequireDefault(_createTransitionManager);
12251
12252var _RouteUtils = require(121);
12253
12254var _RouterUtils = require(124);
12255
12256/**
12257 * A high-level API to be used for server-side rendering.
12258 *
12259 * This function matches a location to a set of routes and calls
12260 * callback(error, redirectLocation, renderProps) when finished.
12261 *
12262 * Note: You probably don't want to use this in a browser unless you're using
12263 * server-side rendering with async routes.
12264 */
12265function match(_ref, callback) {
12266 var history = _ref.history;
12267 var routes = _ref.routes;
12268 var location = _ref.location;
12269
12270 var options = _objectWithoutProperties(_ref, ['history', 'routes', 'location']);
12271
12272 !(history || location) ? process.env.NODE_ENV !== 'production' ? _invariant2['default'](false, 'match needs a history or a location') : _invariant2['default'](false) : undefined;
12273
12274 history = history ? history : _createMemoryHistory2['default'](options);
12275 var transitionManager = _createTransitionManager2['default'](history, _RouteUtils.createRoutes(routes));
12276
12277 var unlisten = undefined;
12278
12279 if (location) {
12280 // Allow match({ location: '/the/path', ... })
12281 location = history.createLocation(location);
12282 } else {
12283 // Pick up the location from the history via synchronous history.listen
12284 // call if needed.
12285 unlisten = history.listen(function (historyLocation) {
12286 location = historyLocation;
12287 });
12288 }
12289
12290 var router = _RouterUtils.createRouterObject(history, transitionManager);
12291 history = _RouterUtils.createRoutingHistory(history, transitionManager);
12292
12293 transitionManager.match(location, function (error, redirectLocation, nextState) {
12294 callback(error, redirectLocation, nextState && _extends({}, nextState, {
12295 history: history,
12296 router: router,
12297 matchContext: { history: history, transitionManager: transitionManager, router: router }
12298 }));
12299
12300 // Defer removing the listener to here to prevent DOM histories from having
12301 // to unwind DOM event listeners unnecessarily, in case callback renders a
12302 // <Router> and attaches another history listener.
12303 if (unlisten) {
12304 unlisten();
12305 }
12306 });
12307}
12308
12309exports['default'] = match;
12310module.exports = exports['default'];
12311}).call(this,require(91))
12312},{"121":121,"124":124,"129":129,"131":131,"81":81,"91":91}],139:[function(require,module,exports){
12313(function (process){
12314'use strict';
12315
12316exports.__esModule = true;
12317
12318function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
12319
12320var _routerWarning = require(140);
12321
12322var _routerWarning2 = _interopRequireDefault(_routerWarning);
12323
12324var _AsyncUtils = require(109);
12325
12326var _PatternUtils = require(116);
12327
12328var _RouteUtils = require(121);
12329
12330function getChildRoutes(route, location, callback) {
12331 if (route.childRoutes) {
12332 return [null, route.childRoutes];
12333 }
12334 if (!route.getChildRoutes) {
12335 return [];
12336 }
12337
12338 var sync = true,
12339 result = undefined;
12340
12341 route.getChildRoutes(location, function (error, childRoutes) {
12342 childRoutes = !error && _RouteUtils.createRoutes(childRoutes);
12343 if (sync) {
12344 result = [error, childRoutes];
12345 return;
12346 }
12347
12348 callback(error, childRoutes);
12349 });
12350
12351 sync = false;
12352 return result; // Might be undefined.
12353}
12354
12355function getIndexRoute(route, location, callback) {
12356 if (route.indexRoute) {
12357 callback(null, route.indexRoute);
12358 } else if (route.getIndexRoute) {
12359 route.getIndexRoute(location, function (error, indexRoute) {
12360 callback(error, !error && _RouteUtils.createRoutes(indexRoute)[0]);
12361 });
12362 } else if (route.childRoutes) {
12363 (function () {
12364 var pathless = route.childRoutes.filter(function (obj) {
12365 return !obj.hasOwnProperty('path');
12366 });
12367
12368 _AsyncUtils.loopAsync(pathless.length, function (index, next, done) {
12369 getIndexRoute(pathless[index], location, function (error, indexRoute) {
12370 if (error || indexRoute) {
12371 var routes = [pathless[index]].concat(Array.isArray(indexRoute) ? indexRoute : [indexRoute]);
12372 done(error, routes);
12373 } else {
12374 next();
12375 }
12376 });
12377 }, function (err, routes) {
12378 callback(null, routes);
12379 });
12380 })();
12381 } else {
12382 callback();
12383 }
12384}
12385
12386function assignParams(params, paramNames, paramValues) {
12387 return paramNames.reduce(function (params, paramName, index) {
12388 var paramValue = paramValues && paramValues[index];
12389
12390 if (Array.isArray(params[paramName])) {
12391 params[paramName].push(paramValue);
12392 } else if (paramName in params) {
12393 params[paramName] = [params[paramName], paramValue];
12394 } else {
12395 params[paramName] = paramValue;
12396 }
12397
12398 return params;
12399 }, params);
12400}
12401
12402function createParams(paramNames, paramValues) {
12403 return assignParams({}, paramNames, paramValues);
12404}
12405
12406function matchRouteDeep(route, location, remainingPathname, paramNames, paramValues, callback) {
12407 var pattern = route.path || '';
12408
12409 if (pattern.charAt(0) === '/') {
12410 remainingPathname = location.pathname;
12411 paramNames = [];
12412 paramValues = [];
12413 }
12414
12415 if (remainingPathname !== null) {
12416 var matched = _PatternUtils.matchPattern(pattern, remainingPathname);
12417 remainingPathname = matched.remainingPathname;
12418 paramNames = [].concat(paramNames, matched.paramNames);
12419 paramValues = [].concat(paramValues, matched.paramValues);
12420
12421 if (remainingPathname === '' && route.path) {
12422 var _ret2 = (function () {
12423 var match = {
12424 routes: [route],
12425 params: createParams(paramNames, paramValues)
12426 };
12427
12428 getIndexRoute(route, location, function (error, indexRoute) {
12429 if (error) {
12430 callback(error);
12431 } else {
12432 if (Array.isArray(indexRoute)) {
12433 var _match$routes;
12434
12435 process.env.NODE_ENV !== 'production' ? _routerWarning2['default'](indexRoute.every(function (route) {
12436 return !route.path;
12437 }), 'Index routes should not have paths') : undefined;
12438 (_match$routes = match.routes).push.apply(_match$routes, indexRoute);
12439 } else if (indexRoute) {
12440 process.env.NODE_ENV !== 'production' ? _routerWarning2['default'](!indexRoute.path, 'Index routes should not have paths') : undefined;
12441 match.routes.push(indexRoute);
12442 }
12443
12444 callback(null, match);
12445 }
12446 });
12447 return {
12448 v: undefined
12449 };
12450 })();
12451
12452 if (typeof _ret2 === 'object') return _ret2.v;
12453 }
12454 }
12455
12456 if (remainingPathname != null || route.childRoutes) {
12457 // Either a) this route matched at least some of the path or b)
12458 // we don't have to load this route's children asynchronously. In
12459 // either case continue checking for matches in the subtree.
12460 var onChildRoutes = function onChildRoutes(error, childRoutes) {
12461 if (error) {
12462 callback(error);
12463 } else if (childRoutes) {
12464 // Check the child routes to see if any of them match.
12465 matchRoutes(childRoutes, location, function (error, match) {
12466 if (error) {
12467 callback(error);
12468 } else if (match) {
12469 // A child route matched! Augment the match and pass it up the stack.
12470 match.routes.unshift(route);
12471 callback(null, match);
12472 } else {
12473 callback();
12474 }
12475 }, remainingPathname, paramNames, paramValues);
12476 } else {
12477 callback();
12478 }
12479 };
12480
12481 var result = getChildRoutes(route, location, onChildRoutes);
12482 if (result) {
12483 onChildRoutes.apply(undefined, result);
12484 }
12485 } else {
12486 callback();
12487 }
12488}
12489
12490/**
12491 * Asynchronously matches the given location to a set of routes and calls
12492 * callback(error, state) when finished. The state object will have the
12493 * following properties:
12494 *
12495 * - routes An array of routes that matched, in hierarchical order
12496 * - params An object of URL parameters
12497 *
12498 * Note: This operation may finish synchronously if no routes have an
12499 * asynchronous getChildRoutes method.
12500 */
12501function matchRoutes(routes, location, callback) {
12502 var remainingPathname = arguments.length <= 3 || arguments[3] === undefined ? location.pathname : arguments[3];
12503 var paramNames = arguments.length <= 4 || arguments[4] === undefined ? [] : arguments[4];
12504 var paramValues = arguments.length <= 5 || arguments[5] === undefined ? [] : arguments[5];
12505 return (function () {
12506 _AsyncUtils.loopAsync(routes.length, function (index, next, done) {
12507 matchRouteDeep(routes[index], location, remainingPathname, paramNames, paramValues, function (error, match) {
12508 if (error || match) {
12509 done(error, match);
12510 } else {
12511 next();
12512 }
12513 });
12514 }, callback);
12515 })();
12516}
12517
12518exports['default'] = matchRoutes;
12519module.exports = exports['default'];
12520}).call(this,require(91))
12521},{"109":109,"116":116,"121":121,"140":140,"91":91}],140:[function(require,module,exports){
12522(function (process){
12523'use strict';
12524
12525exports.__esModule = true;
12526exports['default'] = routerWarning;
12527
12528function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
12529
12530var _warning = require(337);
12531
12532var _warning2 = _interopRequireDefault(_warning);
12533
12534function routerWarning(falseToWarn, message) {
12535 message = '[react-router] ' + message;
12536
12537 for (var _len = arguments.length, args = Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
12538 args[_key - 2] = arguments[_key];
12539 }
12540
12541 process.env.NODE_ENV !== 'production' ? _warning2['default'].apply(undefined, [falseToWarn, message].concat(args)) : undefined;
12542}
12543
12544module.exports = exports['default'];
12545}).call(this,require(91))
12546},{"337":337,"91":91}],141:[function(require,module,exports){
12547'use strict';
12548
12549exports.__esModule = true;
12550exports['default'] = useRouterHistory;
12551
12552function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
12553
12554var _historyLibUseQueries = require(158);
12555
12556var _historyLibUseQueries2 = _interopRequireDefault(_historyLibUseQueries);
12557
12558var _historyLibUseBasename = require(157);
12559
12560var _historyLibUseBasename2 = _interopRequireDefault(_historyLibUseBasename);
12561
12562function useRouterHistory(createHistory) {
12563 return function (options) {
12564 var history = _historyLibUseQueries2['default'](_historyLibUseBasename2['default'](createHistory))(options);
12565 history.__v2_compatible__ = true;
12566 return history;
12567 };
12568}
12569
12570module.exports = exports['default'];
12571},{"157":157,"158":158}],142:[function(require,module,exports){
12572(function (process){
12573'use strict';
12574
12575exports.__esModule = true;
12576
12577var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
12578
12579function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
12580
12581function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; }
12582
12583var _historyLibUseQueries = require(158);
12584
12585var _historyLibUseQueries2 = _interopRequireDefault(_historyLibUseQueries);
12586
12587var _createTransitionManager = require(131);
12588
12589var _createTransitionManager2 = _interopRequireDefault(_createTransitionManager);
12590
12591var _routerWarning = require(140);
12592
12593var _routerWarning2 = _interopRequireDefault(_routerWarning);
12594
12595/**
12596 * Returns a new createHistory function that may be used to create
12597 * history objects that know about routing.
12598 *
12599 * Enhances history objects with the following methods:
12600 *
12601 * - listen((error, nextState) => {})
12602 * - listenBeforeLeavingRoute(route, (nextLocation) => {})
12603 * - match(location, (error, redirectLocation, nextState) => {})
12604 * - isActive(pathname, query, indexOnly=false)
12605 */
12606function useRoutes(createHistory) {
12607 process.env.NODE_ENV !== 'production' ? _routerWarning2['default'](false, '`useRoutes` is deprecated. Please use `createTransitionManager` instead.') : undefined;
12608
12609 return function () {
12610 var _ref = arguments.length <= 0 || arguments[0] === undefined ? {} : arguments[0];
12611
12612 var routes = _ref.routes;
12613
12614 var options = _objectWithoutProperties(_ref, ['routes']);
12615
12616 var history = _historyLibUseQueries2['default'](createHistory)(options);
12617 var transitionManager = _createTransitionManager2['default'](history, routes);
12618 return _extends({}, history, transitionManager);
12619 };
12620}
12621
12622exports['default'] = useRoutes;
12623module.exports = exports['default'];
12624}).call(this,require(91))
12625},{"131":131,"140":140,"158":158,"91":91}],143:[function(require,module,exports){
12626/**
12627 * Indicates that navigation was caused by a call to history.push.
12628 */
12629'use strict';
12630
12631exports.__esModule = true;
12632var PUSH = 'PUSH';
12633
12634exports.PUSH = PUSH;
12635/**
12636 * Indicates that navigation was caused by a call to history.replace.
12637 */
12638var REPLACE = 'REPLACE';
12639
12640exports.REPLACE = REPLACE;
12641/**
12642 * Indicates that navigation was caused by some other action such
12643 * as using a browser's back/forward buttons and/or manually manipulating
12644 * the URL in a browser's location bar. This is the default.
12645 *
12646 * See https://developer.mozilla.org/en-US/docs/Web/API/WindowEventHandlers/onpopstate
12647 * for more information.
12648 */
12649var POP = 'POP';
12650
12651exports.POP = POP;
12652exports['default'] = {
12653 PUSH: PUSH,
12654 REPLACE: REPLACE,
12655 POP: POP
12656};
12657},{}],144:[function(require,module,exports){
12658"use strict";
12659
12660exports.__esModule = true;
12661var _slice = Array.prototype.slice;
12662exports.loopAsync = loopAsync;
12663
12664function loopAsync(turns, work, callback) {
12665 var currentTurn = 0,
12666 isDone = false;
12667 var sync = false,
12668 hasNext = false,
12669 doneArgs = undefined;
12670
12671 function done() {
12672 isDone = true;
12673 if (sync) {
12674 // Iterate instead of recursing if possible.
12675 doneArgs = [].concat(_slice.call(arguments));
12676 return;
12677 }
12678
12679 callback.apply(this, arguments);
12680 }
12681
12682 function next() {
12683 if (isDone) {
12684 return;
12685 }
12686
12687 hasNext = true;
12688 if (sync) {
12689 // Iterate instead of recursing if possible.
12690 return;
12691 }
12692
12693 sync = true;
12694
12695 while (!isDone && currentTurn < turns && hasNext) {
12696 hasNext = false;
12697 work.call(this, currentTurn++, next, done);
12698 }
12699
12700 sync = false;
12701
12702 if (isDone) {
12703 // This means the loop finished synchronously.
12704 callback.apply(this, doneArgs);
12705 return;
12706 }
12707
12708 if (currentTurn >= turns && hasNext) {
12709 isDone = true;
12710 callback();
12711 }
12712 }
12713
12714 next();
12715}
12716},{}],145:[function(require,module,exports){
12717(function (process){
12718/*eslint-disable no-empty */
12719'use strict';
12720
12721exports.__esModule = true;
12722exports.saveState = saveState;
12723exports.readState = readState;
12724
12725function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
12726
12727var _warning = require(337);
12728
12729var _warning2 = _interopRequireDefault(_warning);
12730
12731var KeyPrefix = '@@History/';
12732var QuotaExceededErrors = ['QuotaExceededError', 'QUOTA_EXCEEDED_ERR'];
12733
12734var SecurityError = 'SecurityError';
12735
12736function createKey(key) {
12737 return KeyPrefix + key;
12738}
12739
12740function saveState(key, state) {
12741 try {
12742 if (state == null) {
12743 window.sessionStorage.removeItem(createKey(key));
12744 } else {
12745 window.sessionStorage.setItem(createKey(key), JSON.stringify(state));
12746 }
12747 } catch (error) {
12748 if (error.name === SecurityError) {
12749 // Blocking cookies in Chrome/Firefox/Safari throws SecurityError on any
12750 // attempt to access window.sessionStorage.
12751 process.env.NODE_ENV !== 'production' ? _warning2['default'](false, '[history] Unable to save state; sessionStorage is not available due to security settings') : undefined;
12752
12753 return;
12754 }
12755
12756 if (QuotaExceededErrors.indexOf(error.name) >= 0 && window.sessionStorage.length === 0) {
12757 // Safari "private mode" throws QuotaExceededError.
12758 process.env.NODE_ENV !== 'production' ? _warning2['default'](false, '[history] Unable to save state; sessionStorage is not available in Safari private mode') : undefined;
12759
12760 return;
12761 }
12762
12763 throw error;
12764 }
12765}
12766
12767function readState(key) {
12768 var json = undefined;
12769 try {
12770 json = window.sessionStorage.getItem(createKey(key));
12771 } catch (error) {
12772 if (error.name === SecurityError) {
12773 // Blocking cookies in Chrome/Firefox/Safari throws SecurityError on any
12774 // attempt to access window.sessionStorage.
12775 process.env.NODE_ENV !== 'production' ? _warning2['default'](false, '[history] Unable to read state; sessionStorage is not available due to security settings') : undefined;
12776
12777 return null;
12778 }
12779 }
12780
12781 if (json) {
12782 try {
12783 return JSON.parse(json);
12784 } catch (error) {
12785 // Ignore invalid JSON.
12786 }
12787 }
12788
12789 return null;
12790}
12791}).call(this,require(91))
12792},{"337":337,"91":91}],146:[function(require,module,exports){
12793'use strict';
12794
12795exports.__esModule = true;
12796exports.addEventListener = addEventListener;
12797exports.removeEventListener = removeEventListener;
12798exports.getHashPath = getHashPath;
12799exports.replaceHashPath = replaceHashPath;
12800exports.getWindowPath = getWindowPath;
12801exports.go = go;
12802exports.getUserConfirmation = getUserConfirmation;
12803exports.supportsHistory = supportsHistory;
12804exports.supportsGoWithoutReloadUsingHash = supportsGoWithoutReloadUsingHash;
12805
12806function addEventListener(node, event, listener) {
12807 if (node.addEventListener) {
12808 node.addEventListener(event, listener, false);
12809 } else {
12810 node.attachEvent('on' + event, listener);
12811 }
12812}
12813
12814function removeEventListener(node, event, listener) {
12815 if (node.removeEventListener) {
12816 node.removeEventListener(event, listener, false);
12817 } else {
12818 node.detachEvent('on' + event, listener);
12819 }
12820}
12821
12822function getHashPath() {
12823 // We can't use window.location.hash here because it's not
12824 // consistent across browsers - Firefox will pre-decode it!
12825 return window.location.href.split('#')[1] || '';
12826}
12827
12828function replaceHashPath(path) {
12829 window.location.replace(window.location.pathname + window.location.search + '#' + path);
12830}
12831
12832function getWindowPath() {
12833 return window.location.pathname + window.location.search + window.location.hash;
12834}
12835
12836function go(n) {
12837 if (n) window.history.go(n);
12838}
12839
12840function getUserConfirmation(message, callback) {
12841 callback(window.confirm(message));
12842}
12843
12844/**
12845 * Returns true if the HTML5 history API is supported. Taken from Modernizr.
12846 *
12847 * https://github.com/Modernizr/Modernizr/blob/master/LICENSE
12848 * https://github.com/Modernizr/Modernizr/blob/master/feature-detects/history.js
12849 * changed to avoid false negatives for Windows Phones: https://github.com/rackt/react-router/issues/586
12850 */
12851
12852function supportsHistory() {
12853 var ua = navigator.userAgent;
12854 if ((ua.indexOf('Android 2.') !== -1 || ua.indexOf('Android 4.0') !== -1) && ua.indexOf('Mobile Safari') !== -1 && ua.indexOf('Chrome') === -1 && ua.indexOf('Windows Phone') === -1) {
12855 return false;
12856 }
12857 return window.history && 'pushState' in window.history;
12858}
12859
12860/**
12861 * Returns false if using go(n) with hash history causes a full page reload.
12862 */
12863
12864function supportsGoWithoutReloadUsingHash() {
12865 var ua = navigator.userAgent;
12866 return ua.indexOf('Firefox') === -1;
12867}
12868},{}],147:[function(require,module,exports){
12869'use strict';
12870
12871exports.__esModule = true;
12872var canUseDOM = !!(typeof window !== 'undefined' && window.document && window.document.createElement);
12873exports.canUseDOM = canUseDOM;
12874},{}],148:[function(require,module,exports){
12875(function (process){
12876'use strict';
12877
12878exports.__esModule = true;
12879exports.extractPath = extractPath;
12880exports.parsePath = parsePath;
12881
12882function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
12883
12884var _warning = require(337);
12885
12886var _warning2 = _interopRequireDefault(_warning);
12887
12888function extractPath(string) {
12889 var match = string.match(/^https?:\/\/[^\/]*/);
12890
12891 if (match == null) return string;
12892
12893 return string.substring(match[0].length);
12894}
12895
12896function parsePath(path) {
12897 var pathname = extractPath(path);
12898 var search = '';
12899 var hash = '';
12900
12901 process.env.NODE_ENV !== 'production' ? _warning2['default'](path === pathname, 'A path must be pathname + search + hash only, not a fully qualified URL like "%s"', path) : undefined;
12902
12903 var hashIndex = pathname.indexOf('#');
12904 if (hashIndex !== -1) {
12905 hash = pathname.substring(hashIndex);
12906 pathname = pathname.substring(0, hashIndex);
12907 }
12908
12909 var searchIndex = pathname.indexOf('?');
12910 if (searchIndex !== -1) {
12911 search = pathname.substring(searchIndex);
12912 pathname = pathname.substring(0, searchIndex);
12913 }
12914
12915 if (pathname === '') pathname = '/';
12916
12917 return {
12918 pathname: pathname,
12919 search: search,
12920 hash: hash
12921 };
12922}
12923}).call(this,require(91))
12924},{"337":337,"91":91}],149:[function(require,module,exports){
12925(function (process){
12926'use strict';
12927
12928exports.__esModule = true;
12929
12930var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
12931
12932function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
12933
12934var _invariant = require(81);
12935
12936var _invariant2 = _interopRequireDefault(_invariant);
12937
12938var _Actions = require(143);
12939
12940var _PathUtils = require(148);
12941
12942var _ExecutionEnvironment = require(147);
12943
12944var _DOMUtils = require(146);
12945
12946var _DOMStateStorage = require(145);
12947
12948var _createDOMHistory = require(150);
12949
12950var _createDOMHistory2 = _interopRequireDefault(_createDOMHistory);
12951
12952/**
12953 * Creates and returns a history object that uses HTML5's history API
12954 * (pushState, replaceState, and the popstate event) to manage history.
12955 * This is the recommended method of managing history in browsers because
12956 * it provides the cleanest URLs.
12957 *
12958 * Note: In browsers that do not support the HTML5 history API full
12959 * page reloads will be used to preserve URLs.
12960 */
12961function createBrowserHistory() {
12962 var options = arguments.length <= 0 || arguments[0] === undefined ? {} : arguments[0];
12963
12964 !_ExecutionEnvironment.canUseDOM ? process.env.NODE_ENV !== 'production' ? _invariant2['default'](false, 'Browser history needs a DOM') : _invariant2['default'](false) : undefined;
12965
12966 var forceRefresh = options.forceRefresh;
12967
12968 var isSupported = _DOMUtils.supportsHistory();
12969 var useRefresh = !isSupported || forceRefresh;
12970
12971 function getCurrentLocation(historyState) {
12972 try {
12973 historyState = historyState || window.history.state || {};
12974 } catch (e) {
12975 historyState = {};
12976 }
12977
12978 var path = _DOMUtils.getWindowPath();
12979 var _historyState = historyState;
12980 var key = _historyState.key;
12981
12982 var state = undefined;
12983 if (key) {
12984 state = _DOMStateStorage.readState(key);
12985 } else {
12986 state = null;
12987 key = history.createKey();
12988
12989 if (isSupported) window.history.replaceState(_extends({}, historyState, { key: key }), null);
12990 }
12991
12992 var location = _PathUtils.parsePath(path);
12993
12994 return history.createLocation(_extends({}, location, { state: state }), undefined, key);
12995 }
12996
12997 function startPopStateListener(_ref) {
12998 var transitionTo = _ref.transitionTo;
12999
13000 function popStateListener(event) {
13001 if (event.state === undefined) return; // Ignore extraneous popstate events in WebKit.
13002
13003 transitionTo(getCurrentLocation(event.state));
13004 }
13005
13006 _DOMUtils.addEventListener(window, 'popstate', popStateListener);
13007
13008 return function () {
13009 _DOMUtils.removeEventListener(window, 'popstate', popStateListener);
13010 };
13011 }
13012
13013 function finishTransition(location) {
13014 var basename = location.basename;
13015 var pathname = location.pathname;
13016 var search = location.search;
13017 var hash = location.hash;
13018 var state = location.state;
13019 var action = location.action;
13020 var key = location.key;
13021
13022 if (action === _Actions.POP) return; // Nothing to do.
13023
13024 _DOMStateStorage.saveState(key, state);
13025
13026 var path = (basename || '') + pathname + search + hash;
13027 var historyState = {
13028 key: key
13029 };
13030
13031 if (action === _Actions.PUSH) {
13032 if (useRefresh) {
13033 window.location.href = path;
13034 return false; // Prevent location update.
13035 } else {
13036 window.history.pushState(historyState, null, path);
13037 }
13038 } else {
13039 // REPLACE
13040 if (useRefresh) {
13041 window.location.replace(path);
13042 return false; // Prevent location update.
13043 } else {
13044 window.history.replaceState(historyState, null, path);
13045 }
13046 }
13047 }
13048
13049 var history = _createDOMHistory2['default'](_extends({}, options, {
13050 getCurrentLocation: getCurrentLocation,
13051 finishTransition: finishTransition,
13052 saveState: _DOMStateStorage.saveState
13053 }));
13054
13055 var listenerCount = 0,
13056 stopPopStateListener = undefined;
13057
13058 function listenBefore(listener) {
13059 if (++listenerCount === 1) stopPopStateListener = startPopStateListener(history);
13060
13061 var unlisten = history.listenBefore(listener);
13062
13063 return function () {
13064 unlisten();
13065
13066 if (--listenerCount === 0) stopPopStateListener();
13067 };
13068 }
13069
13070 function listen(listener) {
13071 if (++listenerCount === 1) stopPopStateListener = startPopStateListener(history);
13072
13073 var unlisten = history.listen(listener);
13074
13075 return function () {
13076 unlisten();
13077
13078 if (--listenerCount === 0) stopPopStateListener();
13079 };
13080 }
13081
13082 // deprecated
13083 function registerTransitionHook(hook) {
13084 if (++listenerCount === 1) stopPopStateListener = startPopStateListener(history);
13085
13086 history.registerTransitionHook(hook);
13087 }
13088
13089 // deprecated
13090 function unregisterTransitionHook(hook) {
13091 history.unregisterTransitionHook(hook);
13092
13093 if (--listenerCount === 0) stopPopStateListener();
13094 }
13095
13096 return _extends({}, history, {
13097 listenBefore: listenBefore,
13098 listen: listen,
13099 registerTransitionHook: registerTransitionHook,
13100 unregisterTransitionHook: unregisterTransitionHook
13101 });
13102}
13103
13104exports['default'] = createBrowserHistory;
13105module.exports = exports['default'];
13106}).call(this,require(91))
13107},{"143":143,"145":145,"146":146,"147":147,"148":148,"150":150,"81":81,"91":91}],150:[function(require,module,exports){
13108(function (process){
13109'use strict';
13110
13111exports.__esModule = true;
13112
13113var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
13114
13115function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
13116
13117var _invariant = require(81);
13118
13119var _invariant2 = _interopRequireDefault(_invariant);
13120
13121var _ExecutionEnvironment = require(147);
13122
13123var _DOMUtils = require(146);
13124
13125var _createHistory = require(152);
13126
13127var _createHistory2 = _interopRequireDefault(_createHistory);
13128
13129function createDOMHistory(options) {
13130 var history = _createHistory2['default'](_extends({
13131 getUserConfirmation: _DOMUtils.getUserConfirmation
13132 }, options, {
13133 go: _DOMUtils.go
13134 }));
13135
13136 function listen(listener) {
13137 !_ExecutionEnvironment.canUseDOM ? process.env.NODE_ENV !== 'production' ? _invariant2['default'](false, 'DOM history needs a DOM') : _invariant2['default'](false) : undefined;
13138
13139 return history.listen(listener);
13140 }
13141
13142 return _extends({}, history, {
13143 listen: listen
13144 });
13145}
13146
13147exports['default'] = createDOMHistory;
13148module.exports = exports['default'];
13149}).call(this,require(91))
13150},{"146":146,"147":147,"152":152,"81":81,"91":91}],151:[function(require,module,exports){
13151(function (process){
13152'use strict';
13153
13154exports.__esModule = true;
13155
13156var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
13157
13158function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
13159
13160var _warning = require(337);
13161
13162var _warning2 = _interopRequireDefault(_warning);
13163
13164var _invariant = require(81);
13165
13166var _invariant2 = _interopRequireDefault(_invariant);
13167
13168var _Actions = require(143);
13169
13170var _PathUtils = require(148);
13171
13172var _ExecutionEnvironment = require(147);
13173
13174var _DOMUtils = require(146);
13175
13176var _DOMStateStorage = require(145);
13177
13178var _createDOMHistory = require(150);
13179
13180var _createDOMHistory2 = _interopRequireDefault(_createDOMHistory);
13181
13182function isAbsolutePath(path) {
13183 return typeof path === 'string' && path.charAt(0) === '/';
13184}
13185
13186function ensureSlash() {
13187 var path = _DOMUtils.getHashPath();
13188
13189 if (isAbsolutePath(path)) return true;
13190
13191 _DOMUtils.replaceHashPath('/' + path);
13192
13193 return false;
13194}
13195
13196function addQueryStringValueToPath(path, key, value) {
13197 return path + (path.indexOf('?') === -1 ? '?' : '&') + (key + '=' + value);
13198}
13199
13200function stripQueryStringValueFromPath(path, key) {
13201 return path.replace(new RegExp('[?&]?' + key + '=[a-zA-Z0-9]+'), '');
13202}
13203
13204function getQueryStringValueFromPath(path, key) {
13205 var match = path.match(new RegExp('\\?.*?\\b' + key + '=(.+?)\\b'));
13206 return match && match[1];
13207}
13208
13209var DefaultQueryKey = '_k';
13210
13211function createHashHistory() {
13212 var options = arguments.length <= 0 || arguments[0] === undefined ? {} : arguments[0];
13213
13214 !_ExecutionEnvironment.canUseDOM ? process.env.NODE_ENV !== 'production' ? _invariant2['default'](false, 'Hash history needs a DOM') : _invariant2['default'](false) : undefined;
13215
13216 var queryKey = options.queryKey;
13217
13218 if (queryKey === undefined || !!queryKey) queryKey = typeof queryKey === 'string' ? queryKey : DefaultQueryKey;
13219
13220 function getCurrentLocation() {
13221 var path = _DOMUtils.getHashPath();
13222
13223 var key = undefined,
13224 state = undefined;
13225 if (queryKey) {
13226 key = getQueryStringValueFromPath(path, queryKey);
13227 path = stripQueryStringValueFromPath(path, queryKey);
13228
13229 if (key) {
13230 state = _DOMStateStorage.readState(key);
13231 } else {
13232 state = null;
13233 key = history.createKey();
13234 _DOMUtils.replaceHashPath(addQueryStringValueToPath(path, queryKey, key));
13235 }
13236 } else {
13237 key = state = null;
13238 }
13239
13240 var location = _PathUtils.parsePath(path);
13241
13242 return history.createLocation(_extends({}, location, { state: state }), undefined, key);
13243 }
13244
13245 function startHashChangeListener(_ref) {
13246 var transitionTo = _ref.transitionTo;
13247
13248 function hashChangeListener() {
13249 if (!ensureSlash()) return; // Always make sure hashes are preceeded with a /.
13250
13251 transitionTo(getCurrentLocation());
13252 }
13253
13254 ensureSlash();
13255 _DOMUtils.addEventListener(window, 'hashchange', hashChangeListener);
13256
13257 return function () {
13258 _DOMUtils.removeEventListener(window, 'hashchange', hashChangeListener);
13259 };
13260 }
13261
13262 function finishTransition(location) {
13263 var basename = location.basename;
13264 var pathname = location.pathname;
13265 var search = location.search;
13266 var state = location.state;
13267 var action = location.action;
13268 var key = location.key;
13269
13270 if (action === _Actions.POP) return; // Nothing to do.
13271
13272 var path = (basename || '') + pathname + search;
13273
13274 if (queryKey) {
13275 path = addQueryStringValueToPath(path, queryKey, key);
13276 _DOMStateStorage.saveState(key, state);
13277 } else {
13278 // Drop key and state.
13279 location.key = location.state = null;
13280 }
13281
13282 var currentHash = _DOMUtils.getHashPath();
13283
13284 if (action === _Actions.PUSH) {
13285 if (currentHash !== path) {
13286 window.location.hash = path;
13287 } else {
13288 process.env.NODE_ENV !== 'production' ? _warning2['default'](false, 'You cannot PUSH the same path using hash history') : undefined;
13289 }
13290 } else if (currentHash !== path) {
13291 // REPLACE
13292 _DOMUtils.replaceHashPath(path);
13293 }
13294 }
13295
13296 var history = _createDOMHistory2['default'](_extends({}, options, {
13297 getCurrentLocation: getCurrentLocation,
13298 finishTransition: finishTransition,
13299 saveState: _DOMStateStorage.saveState
13300 }));
13301
13302 var listenerCount = 0,
13303 stopHashChangeListener = undefined;
13304
13305 function listenBefore(listener) {
13306 if (++listenerCount === 1) stopHashChangeListener = startHashChangeListener(history);
13307
13308 var unlisten = history.listenBefore(listener);
13309
13310 return function () {
13311 unlisten();
13312
13313 if (--listenerCount === 0) stopHashChangeListener();
13314 };
13315 }
13316
13317 function listen(listener) {
13318 if (++listenerCount === 1) stopHashChangeListener = startHashChangeListener(history);
13319
13320 var unlisten = history.listen(listener);
13321
13322 return function () {
13323 unlisten();
13324
13325 if (--listenerCount === 0) stopHashChangeListener();
13326 };
13327 }
13328
13329 function push(location) {
13330 process.env.NODE_ENV !== 'production' ? _warning2['default'](queryKey || location.state == null, 'You cannot use state without a queryKey it will be dropped') : undefined;
13331
13332 history.push(location);
13333 }
13334
13335 function replace(location) {
13336 process.env.NODE_ENV !== 'production' ? _warning2['default'](queryKey || location.state == null, 'You cannot use state without a queryKey it will be dropped') : undefined;
13337
13338 history.replace(location);
13339 }
13340
13341 var goIsSupportedWithoutReload = _DOMUtils.supportsGoWithoutReloadUsingHash();
13342
13343 function go(n) {
13344 process.env.NODE_ENV !== 'production' ? _warning2['default'](goIsSupportedWithoutReload, 'Hash history go(n) causes a full page reload in this browser') : undefined;
13345
13346 history.go(n);
13347 }
13348
13349 function createHref(path) {
13350 return '#' + history.createHref(path);
13351 }
13352
13353 // deprecated
13354 function registerTransitionHook(hook) {
13355 if (++listenerCount === 1) stopHashChangeListener = startHashChangeListener(history);
13356
13357 history.registerTransitionHook(hook);
13358 }
13359
13360 // deprecated
13361 function unregisterTransitionHook(hook) {
13362 history.unregisterTransitionHook(hook);
13363
13364 if (--listenerCount === 0) stopHashChangeListener();
13365 }
13366
13367 // deprecated
13368 function pushState(state, path) {
13369 process.env.NODE_ENV !== 'production' ? _warning2['default'](queryKey || state == null, 'You cannot use state without a queryKey it will be dropped') : undefined;
13370
13371 history.pushState(state, path);
13372 }
13373
13374 // deprecated
13375 function replaceState(state, path) {
13376 process.env.NODE_ENV !== 'production' ? _warning2['default'](queryKey || state == null, 'You cannot use state without a queryKey it will be dropped') : undefined;
13377
13378 history.replaceState(state, path);
13379 }
13380
13381 return _extends({}, history, {
13382 listenBefore: listenBefore,
13383 listen: listen,
13384 push: push,
13385 replace: replace,
13386 go: go,
13387 createHref: createHref,
13388
13389 registerTransitionHook: registerTransitionHook, // deprecated - warning is in createHistory
13390 unregisterTransitionHook: unregisterTransitionHook, // deprecated - warning is in createHistory
13391 pushState: pushState, // deprecated - warning is in createHistory
13392 replaceState: replaceState // deprecated - warning is in createHistory
13393 });
13394}
13395
13396exports['default'] = createHashHistory;
13397module.exports = exports['default'];
13398}).call(this,require(91))
13399},{"143":143,"145":145,"146":146,"147":147,"148":148,"150":150,"337":337,"81":81,"91":91}],152:[function(require,module,exports){
13400(function (process){
13401'use strict';
13402
13403exports.__esModule = true;
13404
13405var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
13406
13407function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
13408
13409var _warning = require(337);
13410
13411var _warning2 = _interopRequireDefault(_warning);
13412
13413var _deepEqual = require(14);
13414
13415var _deepEqual2 = _interopRequireDefault(_deepEqual);
13416
13417var _PathUtils = require(148);
13418
13419var _AsyncUtils = require(144);
13420
13421var _Actions = require(143);
13422
13423var _createLocation2 = require(153);
13424
13425var _createLocation3 = _interopRequireDefault(_createLocation2);
13426
13427var _runTransitionHook = require(156);
13428
13429var _runTransitionHook2 = _interopRequireDefault(_runTransitionHook);
13430
13431var _deprecate = require(155);
13432
13433var _deprecate2 = _interopRequireDefault(_deprecate);
13434
13435function createRandomKey(length) {
13436 return Math.random().toString(36).substr(2, length);
13437}
13438
13439function locationsAreEqual(a, b) {
13440 return a.pathname === b.pathname && a.search === b.search &&
13441 //a.action === b.action && // Different action !== location change.
13442 a.key === b.key && _deepEqual2['default'](a.state, b.state);
13443}
13444
13445var DefaultKeyLength = 6;
13446
13447function createHistory() {
13448 var options = arguments.length <= 0 || arguments[0] === undefined ? {} : arguments[0];
13449 var getCurrentLocation = options.getCurrentLocation;
13450 var finishTransition = options.finishTransition;
13451 var saveState = options.saveState;
13452 var go = options.go;
13453 var getUserConfirmation = options.getUserConfirmation;
13454 var keyLength = options.keyLength;
13455
13456 if (typeof keyLength !== 'number') keyLength = DefaultKeyLength;
13457
13458 var transitionHooks = [];
13459
13460 function listenBefore(hook) {
13461 transitionHooks.push(hook);
13462
13463 return function () {
13464 transitionHooks = transitionHooks.filter(function (item) {
13465 return item !== hook;
13466 });
13467 };
13468 }
13469
13470 var allKeys = [];
13471 var changeListeners = [];
13472 var location = undefined;
13473
13474 function getCurrent() {
13475 if (pendingLocation && pendingLocation.action === _Actions.POP) {
13476 return allKeys.indexOf(pendingLocation.key);
13477 } else if (location) {
13478 return allKeys.indexOf(location.key);
13479 } else {
13480 return -1;
13481 }
13482 }
13483
13484 function updateLocation(newLocation) {
13485 var current = getCurrent();
13486
13487 location = newLocation;
13488
13489 if (location.action === _Actions.PUSH) {
13490 allKeys = [].concat(allKeys.slice(0, current + 1), [location.key]);
13491 } else if (location.action === _Actions.REPLACE) {
13492 allKeys[current] = location.key;
13493 }
13494
13495 changeListeners.forEach(function (listener) {
13496 listener(location);
13497 });
13498 }
13499
13500 function listen(listener) {
13501 changeListeners.push(listener);
13502
13503 if (location) {
13504 listener(location);
13505 } else {
13506 var _location = getCurrentLocation();
13507 allKeys = [_location.key];
13508 updateLocation(_location);
13509 }
13510
13511 return function () {
13512 changeListeners = changeListeners.filter(function (item) {
13513 return item !== listener;
13514 });
13515 };
13516 }
13517
13518 function confirmTransitionTo(location, callback) {
13519 _AsyncUtils.loopAsync(transitionHooks.length, function (index, next, done) {
13520 _runTransitionHook2['default'](transitionHooks[index], location, function (result) {
13521 if (result != null) {
13522 done(result);
13523 } else {
13524 next();
13525 }
13526 });
13527 }, function (message) {
13528 if (getUserConfirmation && typeof message === 'string') {
13529 getUserConfirmation(message, function (ok) {
13530 callback(ok !== false);
13531 });
13532 } else {
13533 callback(message !== false);
13534 }
13535 });
13536 }
13537
13538 var pendingLocation = undefined;
13539
13540 function transitionTo(nextLocation) {
13541 if (location && locationsAreEqual(location, nextLocation)) return; // Nothing to do.
13542
13543 pendingLocation = nextLocation;
13544
13545 confirmTransitionTo(nextLocation, function (ok) {
13546 if (pendingLocation !== nextLocation) return; // Transition was interrupted.
13547
13548 if (ok) {
13549 // treat PUSH to current path like REPLACE to be consistent with browsers
13550 if (nextLocation.action === _Actions.PUSH) {
13551 var prevPath = createPath(location);
13552 var nextPath = createPath(nextLocation);
13553
13554 if (nextPath === prevPath && _deepEqual2['default'](location.state, nextLocation.state)) nextLocation.action = _Actions.REPLACE;
13555 }
13556
13557 if (finishTransition(nextLocation) !== false) updateLocation(nextLocation);
13558 } else if (location && nextLocation.action === _Actions.POP) {
13559 var prevIndex = allKeys.indexOf(location.key);
13560 var nextIndex = allKeys.indexOf(nextLocation.key);
13561
13562 if (prevIndex !== -1 && nextIndex !== -1) go(prevIndex - nextIndex); // Restore the URL.
13563 }
13564 });
13565 }
13566
13567 function push(location) {
13568 transitionTo(createLocation(location, _Actions.PUSH, createKey()));
13569 }
13570
13571 function replace(location) {
13572 transitionTo(createLocation(location, _Actions.REPLACE, createKey()));
13573 }
13574
13575 function goBack() {
13576 go(-1);
13577 }
13578
13579 function goForward() {
13580 go(1);
13581 }
13582
13583 function createKey() {
13584 return createRandomKey(keyLength);
13585 }
13586
13587 function createPath(location) {
13588 if (location == null || typeof location === 'string') return location;
13589
13590 var pathname = location.pathname;
13591 var search = location.search;
13592 var hash = location.hash;
13593
13594 var result = pathname;
13595
13596 if (search) result += search;
13597
13598 if (hash) result += hash;
13599
13600 return result;
13601 }
13602
13603 function createHref(location) {
13604 return createPath(location);
13605 }
13606
13607 function createLocation(location, action) {
13608 var key = arguments.length <= 2 || arguments[2] === undefined ? createKey() : arguments[2];
13609
13610 if (typeof action === 'object') {
13611 process.env.NODE_ENV !== 'production' ? _warning2['default'](false, 'The state (2nd) argument to history.createLocation is deprecated; use a ' + 'location descriptor instead') : undefined;
13612
13613 if (typeof location === 'string') location = _PathUtils.parsePath(location);
13614
13615 location = _extends({}, location, { state: action });
13616
13617 action = key;
13618 key = arguments[3] || createKey();
13619 }
13620
13621 return _createLocation3['default'](location, action, key);
13622 }
13623
13624 // deprecated
13625 function setState(state) {
13626 if (location) {
13627 updateLocationState(location, state);
13628 updateLocation(location);
13629 } else {
13630 updateLocationState(getCurrentLocation(), state);
13631 }
13632 }
13633
13634 function updateLocationState(location, state) {
13635 location.state = _extends({}, location.state, state);
13636 saveState(location.key, location.state);
13637 }
13638
13639 // deprecated
13640 function registerTransitionHook(hook) {
13641 if (transitionHooks.indexOf(hook) === -1) transitionHooks.push(hook);
13642 }
13643
13644 // deprecated
13645 function unregisterTransitionHook(hook) {
13646 transitionHooks = transitionHooks.filter(function (item) {
13647 return item !== hook;
13648 });
13649 }
13650
13651 // deprecated
13652 function pushState(state, path) {
13653 if (typeof path === 'string') path = _PathUtils.parsePath(path);
13654
13655 push(_extends({ state: state }, path));
13656 }
13657
13658 // deprecated
13659 function replaceState(state, path) {
13660 if (typeof path === 'string') path = _PathUtils.parsePath(path);
13661
13662 replace(_extends({ state: state }, path));
13663 }
13664
13665 return {
13666 listenBefore: listenBefore,
13667 listen: listen,
13668 transitionTo: transitionTo,
13669 push: push,
13670 replace: replace,
13671 go: go,
13672 goBack: goBack,
13673 goForward: goForward,
13674 createKey: createKey,
13675 createPath: createPath,
13676 createHref: createHref,
13677 createLocation: createLocation,
13678
13679 setState: _deprecate2['default'](setState, 'setState is deprecated; use location.key to save state instead'),
13680 registerTransitionHook: _deprecate2['default'](registerTransitionHook, 'registerTransitionHook is deprecated; use listenBefore instead'),
13681 unregisterTransitionHook: _deprecate2['default'](unregisterTransitionHook, 'unregisterTransitionHook is deprecated; use the callback returned from listenBefore instead'),
13682 pushState: _deprecate2['default'](pushState, 'pushState is deprecated; use push instead'),
13683 replaceState: _deprecate2['default'](replaceState, 'replaceState is deprecated; use replace instead')
13684 };
13685}
13686
13687exports['default'] = createHistory;
13688module.exports = exports['default'];
13689}).call(this,require(91))
13690},{"14":14,"143":143,"144":144,"148":148,"153":153,"155":155,"156":156,"337":337,"91":91}],153:[function(require,module,exports){
13691(function (process){
13692'use strict';
13693
13694exports.__esModule = true;
13695
13696var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
13697
13698function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
13699
13700var _warning = require(337);
13701
13702var _warning2 = _interopRequireDefault(_warning);
13703
13704var _Actions = require(143);
13705
13706var _PathUtils = require(148);
13707
13708function createLocation() {
13709 var location = arguments.length <= 0 || arguments[0] === undefined ? '/' : arguments[0];
13710 var action = arguments.length <= 1 || arguments[1] === undefined ? _Actions.POP : arguments[1];
13711 var key = arguments.length <= 2 || arguments[2] === undefined ? null : arguments[2];
13712
13713 var _fourthArg = arguments.length <= 3 || arguments[3] === undefined ? null : arguments[3];
13714
13715 if (typeof location === 'string') location = _PathUtils.parsePath(location);
13716
13717 if (typeof action === 'object') {
13718 process.env.NODE_ENV !== 'production' ? _warning2['default'](false, 'The state (2nd) argument to createLocation is deprecated; use a ' + 'location descriptor instead') : undefined;
13719
13720 location = _extends({}, location, { state: action });
13721
13722 action = key || _Actions.POP;
13723 key = _fourthArg;
13724 }
13725
13726 var pathname = location.pathname || '/';
13727 var search = location.search || '';
13728 var hash = location.hash || '';
13729 var state = location.state || null;
13730
13731 return {
13732 pathname: pathname,
13733 search: search,
13734 hash: hash,
13735 state: state,
13736 action: action,
13737 key: key
13738 };
13739}
13740
13741exports['default'] = createLocation;
13742module.exports = exports['default'];
13743}).call(this,require(91))
13744},{"143":143,"148":148,"337":337,"91":91}],154:[function(require,module,exports){
13745(function (process){
13746'use strict';
13747
13748exports.__esModule = true;
13749
13750var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
13751
13752function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
13753
13754var _warning = require(337);
13755
13756var _warning2 = _interopRequireDefault(_warning);
13757
13758var _invariant = require(81);
13759
13760var _invariant2 = _interopRequireDefault(_invariant);
13761
13762var _PathUtils = require(148);
13763
13764var _Actions = require(143);
13765
13766var _createHistory = require(152);
13767
13768var _createHistory2 = _interopRequireDefault(_createHistory);
13769
13770function createStateStorage(entries) {
13771 return entries.filter(function (entry) {
13772 return entry.state;
13773 }).reduce(function (memo, entry) {
13774 memo[entry.key] = entry.state;
13775 return memo;
13776 }, {});
13777}
13778
13779function createMemoryHistory() {
13780 var options = arguments.length <= 0 || arguments[0] === undefined ? {} : arguments[0];
13781
13782 if (Array.isArray(options)) {
13783 options = { entries: options };
13784 } else if (typeof options === 'string') {
13785 options = { entries: [options] };
13786 }
13787
13788 var history = _createHistory2['default'](_extends({}, options, {
13789 getCurrentLocation: getCurrentLocation,
13790 finishTransition: finishTransition,
13791 saveState: saveState,
13792 go: go
13793 }));
13794
13795 var _options = options;
13796 var entries = _options.entries;
13797 var current = _options.current;
13798
13799 if (typeof entries === 'string') {
13800 entries = [entries];
13801 } else if (!Array.isArray(entries)) {
13802 entries = ['/'];
13803 }
13804
13805 entries = entries.map(function (entry) {
13806 var key = history.createKey();
13807
13808 if (typeof entry === 'string') return { pathname: entry, key: key };
13809
13810 if (typeof entry === 'object' && entry) return _extends({}, entry, { key: key });
13811
13812 !false ? process.env.NODE_ENV !== 'production' ? _invariant2['default'](false, 'Unable to create history entry from %s', entry) : _invariant2['default'](false) : undefined;
13813 });
13814
13815 if (current == null) {
13816 current = entries.length - 1;
13817 } else {
13818 !(current >= 0 && current < entries.length) ? process.env.NODE_ENV !== 'production' ? _invariant2['default'](false, 'Current index must be >= 0 and < %s, was %s', entries.length, current) : _invariant2['default'](false) : undefined;
13819 }
13820
13821 var storage = createStateStorage(entries);
13822
13823 function saveState(key, state) {
13824 storage[key] = state;
13825 }
13826
13827 function readState(key) {
13828 return storage[key];
13829 }
13830
13831 function getCurrentLocation() {
13832 var entry = entries[current];
13833 var basename = entry.basename;
13834 var pathname = entry.pathname;
13835 var search = entry.search;
13836
13837 var path = (basename || '') + pathname + (search || '');
13838
13839 var key = undefined,
13840 state = undefined;
13841 if (entry.key) {
13842 key = entry.key;
13843 state = readState(key);
13844 } else {
13845 key = history.createKey();
13846 state = null;
13847 entry.key = key;
13848 }
13849
13850 var location = _PathUtils.parsePath(path);
13851
13852 return history.createLocation(_extends({}, location, { state: state }), undefined, key);
13853 }
13854
13855 function canGo(n) {
13856 var index = current + n;
13857 return index >= 0 && index < entries.length;
13858 }
13859
13860 function go(n) {
13861 if (n) {
13862 if (!canGo(n)) {
13863 process.env.NODE_ENV !== 'production' ? _warning2['default'](false, 'Cannot go(%s) there is not enough history', n) : undefined;
13864 return;
13865 }
13866
13867 current += n;
13868
13869 var currentLocation = getCurrentLocation();
13870
13871 // change action to POP
13872 history.transitionTo(_extends({}, currentLocation, { action: _Actions.POP }));
13873 }
13874 }
13875
13876 function finishTransition(location) {
13877 switch (location.action) {
13878 case _Actions.PUSH:
13879 current += 1;
13880
13881 // if we are not on the top of stack
13882 // remove rest and push new
13883 if (current < entries.length) entries.splice(current);
13884
13885 entries.push(location);
13886 saveState(location.key, location.state);
13887 break;
13888 case _Actions.REPLACE:
13889 entries[current] = location;
13890 saveState(location.key, location.state);
13891 break;
13892 }
13893 }
13894
13895 return history;
13896}
13897
13898exports['default'] = createMemoryHistory;
13899module.exports = exports['default'];
13900}).call(this,require(91))
13901},{"143":143,"148":148,"152":152,"337":337,"81":81,"91":91}],155:[function(require,module,exports){
13902(function (process){
13903'use strict';
13904
13905exports.__esModule = true;
13906
13907function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
13908
13909var _warning = require(337);
13910
13911var _warning2 = _interopRequireDefault(_warning);
13912
13913function deprecate(fn, message) {
13914 return function () {
13915 process.env.NODE_ENV !== 'production' ? _warning2['default'](false, '[history] ' + message) : undefined;
13916 return fn.apply(this, arguments);
13917 };
13918}
13919
13920exports['default'] = deprecate;
13921module.exports = exports['default'];
13922}).call(this,require(91))
13923},{"337":337,"91":91}],156:[function(require,module,exports){
13924(function (process){
13925'use strict';
13926
13927exports.__esModule = true;
13928
13929function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
13930
13931var _warning = require(337);
13932
13933var _warning2 = _interopRequireDefault(_warning);
13934
13935function runTransitionHook(hook, location, callback) {
13936 var result = hook(location, callback);
13937
13938 if (hook.length < 2) {
13939 // Assume the hook runs synchronously and automatically
13940 // call the callback with the return value.
13941 callback(result);
13942 } else {
13943 process.env.NODE_ENV !== 'production' ? _warning2['default'](result === undefined, 'You should not "return" in a transition hook with a callback argument; call the callback instead') : undefined;
13944 }
13945}
13946
13947exports['default'] = runTransitionHook;
13948module.exports = exports['default'];
13949}).call(this,require(91))
13950},{"337":337,"91":91}],157:[function(require,module,exports){
13951(function (process){
13952'use strict';
13953
13954exports.__esModule = true;
13955
13956var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
13957
13958function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
13959
13960var _warning = require(337);
13961
13962var _warning2 = _interopRequireDefault(_warning);
13963
13964var _ExecutionEnvironment = require(147);
13965
13966var _PathUtils = require(148);
13967
13968var _runTransitionHook = require(156);
13969
13970var _runTransitionHook2 = _interopRequireDefault(_runTransitionHook);
13971
13972var _deprecate = require(155);
13973
13974var _deprecate2 = _interopRequireDefault(_deprecate);
13975
13976function useBasename(createHistory) {
13977 return function () {
13978 var options = arguments.length <= 0 || arguments[0] === undefined ? {} : arguments[0];
13979
13980 var history = createHistory(options);
13981
13982 var basename = options.basename;
13983
13984 var checkedBaseHref = false;
13985
13986 function checkBaseHref() {
13987 if (checkedBaseHref) {
13988 return;
13989 }
13990
13991 // Automatically use the value of <base href> in HTML
13992 // documents as basename if it's not explicitly given.
13993 if (basename == null && _ExecutionEnvironment.canUseDOM) {
13994 var base = document.getElementsByTagName('base')[0];
13995 var baseHref = base && base.getAttribute('href');
13996
13997 if (baseHref != null) {
13998 basename = baseHref;
13999
14000 process.env.NODE_ENV !== 'production' ? _warning2['default'](false, 'Automatically setting basename using <base href> is deprecated and will ' + 'be removed in the next major release. The semantics of <base href> are ' + 'subtly different from basename. Please pass the basename explicitly in ' + 'the options to createHistory') : undefined;
14001 }
14002 }
14003
14004 checkedBaseHref = true;
14005 }
14006
14007 function addBasename(location) {
14008 checkBaseHref();
14009
14010 if (basename && location.basename == null) {
14011 if (location.pathname.indexOf(basename) === 0) {
14012 location.pathname = location.pathname.substring(basename.length);
14013 location.basename = basename;
14014
14015 if (location.pathname === '') location.pathname = '/';
14016 } else {
14017 location.basename = '';
14018 }
14019 }
14020
14021 return location;
14022 }
14023
14024 function prependBasename(location) {
14025 checkBaseHref();
14026
14027 if (!basename) return location;
14028
14029 if (typeof location === 'string') location = _PathUtils.parsePath(location);
14030
14031 var pname = location.pathname;
14032 var normalizedBasename = basename.slice(-1) === '/' ? basename : basename + '/';
14033 var normalizedPathname = pname.charAt(0) === '/' ? pname.slice(1) : pname;
14034 var pathname = normalizedBasename + normalizedPathname;
14035
14036 return _extends({}, location, {
14037 pathname: pathname
14038 });
14039 }
14040
14041 // Override all read methods with basename-aware versions.
14042 function listenBefore(hook) {
14043 return history.listenBefore(function (location, callback) {
14044 _runTransitionHook2['default'](hook, addBasename(location), callback);
14045 });
14046 }
14047
14048 function listen(listener) {
14049 return history.listen(function (location) {
14050 listener(addBasename(location));
14051 });
14052 }
14053
14054 // Override all write methods with basename-aware versions.
14055 function push(location) {
14056 history.push(prependBasename(location));
14057 }
14058
14059 function replace(location) {
14060 history.replace(prependBasename(location));
14061 }
14062
14063 function createPath(location) {
14064 return history.createPath(prependBasename(location));
14065 }
14066
14067 function createHref(location) {
14068 return history.createHref(prependBasename(location));
14069 }
14070
14071 function createLocation(location) {
14072 for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
14073 args[_key - 1] = arguments[_key];
14074 }
14075
14076 return addBasename(history.createLocation.apply(history, [prependBasename(location)].concat(args)));
14077 }
14078
14079 // deprecated
14080 function pushState(state, path) {
14081 if (typeof path === 'string') path = _PathUtils.parsePath(path);
14082
14083 push(_extends({ state: state }, path));
14084 }
14085
14086 // deprecated
14087 function replaceState(state, path) {
14088 if (typeof path === 'string') path = _PathUtils.parsePath(path);
14089
14090 replace(_extends({ state: state }, path));
14091 }
14092
14093 return _extends({}, history, {
14094 listenBefore: listenBefore,
14095 listen: listen,
14096 push: push,
14097 replace: replace,
14098 createPath: createPath,
14099 createHref: createHref,
14100 createLocation: createLocation,
14101
14102 pushState: _deprecate2['default'](pushState, 'pushState is deprecated; use push instead'),
14103 replaceState: _deprecate2['default'](replaceState, 'replaceState is deprecated; use replace instead')
14104 });
14105 };
14106}
14107
14108exports['default'] = useBasename;
14109module.exports = exports['default'];
14110}).call(this,require(91))
14111},{"147":147,"148":148,"155":155,"156":156,"337":337,"91":91}],158:[function(require,module,exports){
14112(function (process){
14113'use strict';
14114
14115exports.__esModule = true;
14116
14117var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
14118
14119function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
14120
14121var _warning = require(337);
14122
14123var _warning2 = _interopRequireDefault(_warning);
14124
14125var _queryString = require(93);
14126
14127var _runTransitionHook = require(156);
14128
14129var _runTransitionHook2 = _interopRequireDefault(_runTransitionHook);
14130
14131var _PathUtils = require(148);
14132
14133var _deprecate = require(155);
14134
14135var _deprecate2 = _interopRequireDefault(_deprecate);
14136
14137var SEARCH_BASE_KEY = '$searchBase';
14138
14139function defaultStringifyQuery(query) {
14140 return _queryString.stringify(query).replace(/%20/g, '+');
14141}
14142
14143var defaultParseQueryString = _queryString.parse;
14144
14145function isNestedObject(object) {
14146 for (var p in object) {
14147 if (Object.prototype.hasOwnProperty.call(object, p) && typeof object[p] === 'object' && !Array.isArray(object[p]) && object[p] !== null) return true;
14148 }return false;
14149}
14150
14151/**
14152 * Returns a new createHistory function that may be used to create
14153 * history objects that know how to handle URL queries.
14154 */
14155function useQueries(createHistory) {
14156 return function () {
14157 var options = arguments.length <= 0 || arguments[0] === undefined ? {} : arguments[0];
14158
14159 var history = createHistory(options);
14160
14161 var stringifyQuery = options.stringifyQuery;
14162 var parseQueryString = options.parseQueryString;
14163
14164 if (typeof stringifyQuery !== 'function') stringifyQuery = defaultStringifyQuery;
14165
14166 if (typeof parseQueryString !== 'function') parseQueryString = defaultParseQueryString;
14167
14168 function addQuery(location) {
14169 if (location.query == null) {
14170 var search = location.search;
14171
14172 location.query = parseQueryString(search.substring(1));
14173 location[SEARCH_BASE_KEY] = { search: search, searchBase: '' };
14174 }
14175
14176 // TODO: Instead of all the book-keeping here, this should just strip the
14177 // stringified query from the search.
14178
14179 return location;
14180 }
14181
14182 function appendQuery(location, query) {
14183 var _extends2;
14184
14185 var searchBaseSpec = location[SEARCH_BASE_KEY];
14186 var queryString = query ? stringifyQuery(query) : '';
14187 if (!searchBaseSpec && !queryString) {
14188 return location;
14189 }
14190
14191 process.env.NODE_ENV !== 'production' ? _warning2['default'](stringifyQuery !== defaultStringifyQuery || !isNestedObject(query), 'useQueries does not stringify nested query objects by default; ' + 'use a custom stringifyQuery function') : undefined;
14192
14193 if (typeof location === 'string') location = _PathUtils.parsePath(location);
14194
14195 var searchBase = undefined;
14196 if (searchBaseSpec && location.search === searchBaseSpec.search) {
14197 searchBase = searchBaseSpec.searchBase;
14198 } else {
14199 searchBase = location.search || '';
14200 }
14201
14202 var search = searchBase;
14203 if (queryString) {
14204 search += (search ? '&' : '?') + queryString;
14205 }
14206
14207 return _extends({}, location, (_extends2 = {
14208 search: search
14209 }, _extends2[SEARCH_BASE_KEY] = { search: search, searchBase: searchBase }, _extends2));
14210 }
14211
14212 // Override all read methods with query-aware versions.
14213 function listenBefore(hook) {
14214 return history.listenBefore(function (location, callback) {
14215 _runTransitionHook2['default'](hook, addQuery(location), callback);
14216 });
14217 }
14218
14219 function listen(listener) {
14220 return history.listen(function (location) {
14221 listener(addQuery(location));
14222 });
14223 }
14224
14225 // Override all write methods with query-aware versions.
14226 function push(location) {
14227 history.push(appendQuery(location, location.query));
14228 }
14229
14230 function replace(location) {
14231 history.replace(appendQuery(location, location.query));
14232 }
14233
14234 function createPath(location, query) {
14235 process.env.NODE_ENV !== 'production' ? _warning2['default'](!query, 'the query argument to createPath is deprecated; use a location descriptor instead') : undefined;
14236
14237 return history.createPath(appendQuery(location, query || location.query));
14238 }
14239
14240 function createHref(location, query) {
14241 process.env.NODE_ENV !== 'production' ? _warning2['default'](!query, 'the query argument to createHref is deprecated; use a location descriptor instead') : undefined;
14242
14243 return history.createHref(appendQuery(location, query || location.query));
14244 }
14245
14246 function createLocation(location) {
14247 for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
14248 args[_key - 1] = arguments[_key];
14249 }
14250
14251 var fullLocation = history.createLocation.apply(history, [appendQuery(location, location.query)].concat(args));
14252 if (location.query) {
14253 fullLocation.query = location.query;
14254 }
14255 return addQuery(fullLocation);
14256 }
14257
14258 // deprecated
14259 function pushState(state, path, query) {
14260 if (typeof path === 'string') path = _PathUtils.parsePath(path);
14261
14262 push(_extends({ state: state }, path, { query: query }));
14263 }
14264
14265 // deprecated
14266 function replaceState(state, path, query) {
14267 if (typeof path === 'string') path = _PathUtils.parsePath(path);
14268
14269 replace(_extends({ state: state }, path, { query: query }));
14270 }
14271
14272 return _extends({}, history, {
14273 listenBefore: listenBefore,
14274 listen: listen,
14275 push: push,
14276 replace: replace,
14277 createPath: createPath,
14278 createHref: createHref,
14279 createLocation: createLocation,
14280
14281 pushState: _deprecate2['default'](pushState, 'pushState is deprecated; use push instead'),
14282 replaceState: _deprecate2['default'](replaceState, 'replaceState is deprecated; use replace instead')
14283 });
14284 };
14285}
14286
14287exports['default'] = useQueries;
14288module.exports = exports['default'];
14289}).call(this,require(91))
14290},{"148":148,"155":155,"156":156,"337":337,"91":91,"93":93}],159:[function(require,module,exports){
14291/**
14292 * Copyright 2013-present, Facebook, Inc.
14293 * All rights reserved.
14294 *
14295 * This source code is licensed under the BSD-style license found in the
14296 * LICENSE file in the root directory of this source tree. An additional grant
14297 * of patent rights can be found in the PATENTS file in the same directory.
14298 *
14299 * @providesModule AutoFocusUtils
14300 */
14301
14302'use strict';
14303
14304var ReactDOMComponentTree = require(199);
14305
14306var focusNode = require(39);
14307
14308var AutoFocusUtils = {
14309 focusDOMComponent: function () {
14310 focusNode(ReactDOMComponentTree.getNodeFromInstance(this));
14311 }
14312};
14313
14314module.exports = AutoFocusUtils;
14315},{"199":199,"39":39}],160:[function(require,module,exports){
14316/**
14317 * Copyright 2013-present Facebook, Inc.
14318 * All rights reserved.
14319 *
14320 * This source code is licensed under the BSD-style license found in the
14321 * LICENSE file in the root directory of this source tree. An additional grant
14322 * of patent rights can be found in the PATENTS file in the same directory.
14323 *
14324 * @providesModule BeforeInputEventPlugin
14325 */
14326
14327'use strict';
14328
14329var EventConstants = require(174);
14330var EventPropagators = require(178);
14331var ExecutionEnvironment = require(31);
14332var FallbackCompositionState = require(179);
14333var SyntheticCompositionEvent = require(254);
14334var SyntheticInputEvent = require(258);
14335
14336var keyOf = require(49);
14337
14338var END_KEYCODES = [9, 13, 27, 32]; // Tab, Return, Esc, Space
14339var START_KEYCODE = 229;
14340
14341var canUseCompositionEvent = ExecutionEnvironment.canUseDOM && 'CompositionEvent' in window;
14342
14343var documentMode = null;
14344if (ExecutionEnvironment.canUseDOM && 'documentMode' in document) {
14345 documentMode = document.documentMode;
14346}
14347
14348// Webkit offers a very useful `textInput` event that can be used to
14349// directly represent `beforeInput`. The IE `textinput` event is not as
14350// useful, so we don't use it.
14351var canUseTextInputEvent = ExecutionEnvironment.canUseDOM && 'TextEvent' in window && !documentMode && !isPresto();
14352
14353// In IE9+, we have access to composition events, but the data supplied
14354// by the native compositionend event may be incorrect. Japanese ideographic
14355// spaces, for instance (\u3000) are not recorded correctly.
14356var useFallbackCompositionData = ExecutionEnvironment.canUseDOM && (!canUseCompositionEvent || documentMode && documentMode > 8 && documentMode <= 11);
14357
14358/**
14359 * Opera <= 12 includes TextEvent in window, but does not fire
14360 * text input events. Rely on keypress instead.
14361 */
14362function isPresto() {
14363 var opera = window.opera;
14364 return typeof opera === 'object' && typeof opera.version === 'function' && parseInt(opera.version(), 10) <= 12;
14365}
14366
14367var SPACEBAR_CODE = 32;
14368var SPACEBAR_CHAR = String.fromCharCode(SPACEBAR_CODE);
14369
14370var topLevelTypes = EventConstants.topLevelTypes;
14371
14372// Events and their corresponding property names.
14373var eventTypes = {
14374 beforeInput: {
14375 phasedRegistrationNames: {
14376 bubbled: keyOf({ onBeforeInput: null }),
14377 captured: keyOf({ onBeforeInputCapture: null })
14378 },
14379 dependencies: [topLevelTypes.topCompositionEnd, topLevelTypes.topKeyPress, topLevelTypes.topTextInput, topLevelTypes.topPaste]
14380 },
14381 compositionEnd: {
14382 phasedRegistrationNames: {
14383 bubbled: keyOf({ onCompositionEnd: null }),
14384 captured: keyOf({ onCompositionEndCapture: null })
14385 },
14386 dependencies: [topLevelTypes.topBlur, topLevelTypes.topCompositionEnd, topLevelTypes.topKeyDown, topLevelTypes.topKeyPress, topLevelTypes.topKeyUp, topLevelTypes.topMouseDown]
14387 },
14388 compositionStart: {
14389 phasedRegistrationNames: {
14390 bubbled: keyOf({ onCompositionStart: null }),
14391 captured: keyOf({ onCompositionStartCapture: null })
14392 },
14393 dependencies: [topLevelTypes.topBlur, topLevelTypes.topCompositionStart, topLevelTypes.topKeyDown, topLevelTypes.topKeyPress, topLevelTypes.topKeyUp, topLevelTypes.topMouseDown]
14394 },
14395 compositionUpdate: {
14396 phasedRegistrationNames: {
14397 bubbled: keyOf({ onCompositionUpdate: null }),
14398 captured: keyOf({ onCompositionUpdateCapture: null })
14399 },
14400 dependencies: [topLevelTypes.topBlur, topLevelTypes.topCompositionUpdate, topLevelTypes.topKeyDown, topLevelTypes.topKeyPress, topLevelTypes.topKeyUp, topLevelTypes.topMouseDown]
14401 }
14402};
14403
14404// Track whether we've ever handled a keypress on the space key.
14405var hasSpaceKeypress = false;
14406
14407/**
14408 * Return whether a native keypress event is assumed to be a command.
14409 * This is required because Firefox fires `keypress` events for key commands
14410 * (cut, copy, select-all, etc.) even though no character is inserted.
14411 */
14412function isKeypressCommand(nativeEvent) {
14413 return (nativeEvent.ctrlKey || nativeEvent.altKey || nativeEvent.metaKey) &&
14414 // ctrlKey && altKey is equivalent to AltGr, and is not a command.
14415 !(nativeEvent.ctrlKey && nativeEvent.altKey);
14416}
14417
14418/**
14419 * Translate native top level events into event types.
14420 *
14421 * @param {string} topLevelType
14422 * @return {object}
14423 */
14424function getCompositionEventType(topLevelType) {
14425 switch (topLevelType) {
14426 case topLevelTypes.topCompositionStart:
14427 return eventTypes.compositionStart;
14428 case topLevelTypes.topCompositionEnd:
14429 return eventTypes.compositionEnd;
14430 case topLevelTypes.topCompositionUpdate:
14431 return eventTypes.compositionUpdate;
14432 }
14433}
14434
14435/**
14436 * Does our fallback best-guess model think this event signifies that
14437 * composition has begun?
14438 *
14439 * @param {string} topLevelType
14440 * @param {object} nativeEvent
14441 * @return {boolean}
14442 */
14443function isFallbackCompositionStart(topLevelType, nativeEvent) {
14444 return topLevelType === topLevelTypes.topKeyDown && nativeEvent.keyCode === START_KEYCODE;
14445}
14446
14447/**
14448 * Does our fallback mode think that this event is the end of composition?
14449 *
14450 * @param {string} topLevelType
14451 * @param {object} nativeEvent
14452 * @return {boolean}
14453 */
14454function isFallbackCompositionEnd(topLevelType, nativeEvent) {
14455 switch (topLevelType) {
14456 case topLevelTypes.topKeyUp:
14457 // Command keys insert or clear IME input.
14458 return END_KEYCODES.indexOf(nativeEvent.keyCode) !== -1;
14459 case topLevelTypes.topKeyDown:
14460 // Expect IME keyCode on each keydown. If we get any other
14461 // code we must have exited earlier.
14462 return nativeEvent.keyCode !== START_KEYCODE;
14463 case topLevelTypes.topKeyPress:
14464 case topLevelTypes.topMouseDown:
14465 case topLevelTypes.topBlur:
14466 // Events are not possible without cancelling IME.
14467 return true;
14468 default:
14469 return false;
14470 }
14471}
14472
14473/**
14474 * Google Input Tools provides composition data via a CustomEvent,
14475 * with the `data` property populated in the `detail` object. If this
14476 * is available on the event object, use it. If not, this is a plain
14477 * composition event and we have nothing special to extract.
14478 *
14479 * @param {object} nativeEvent
14480 * @return {?string}
14481 */
14482function getDataFromCustomEvent(nativeEvent) {
14483 var detail = nativeEvent.detail;
14484 if (typeof detail === 'object' && 'data' in detail) {
14485 return detail.data;
14486 }
14487 return null;
14488}
14489
14490// Track the current IME composition fallback object, if any.
14491var currentComposition = null;
14492
14493/**
14494 * @return {?object} A SyntheticCompositionEvent.
14495 */
14496function extractCompositionEvent(topLevelType, targetInst, nativeEvent, nativeEventTarget) {
14497 var eventType;
14498 var fallbackData;
14499
14500 if (canUseCompositionEvent) {
14501 eventType = getCompositionEventType(topLevelType);
14502 } else if (!currentComposition) {
14503 if (isFallbackCompositionStart(topLevelType, nativeEvent)) {
14504 eventType = eventTypes.compositionStart;
14505 }
14506 } else if (isFallbackCompositionEnd(topLevelType, nativeEvent)) {
14507 eventType = eventTypes.compositionEnd;
14508 }
14509
14510 if (!eventType) {
14511 return null;
14512 }
14513
14514 if (useFallbackCompositionData) {
14515 // The current composition is stored statically and must not be
14516 // overwritten while composition continues.
14517 if (!currentComposition && eventType === eventTypes.compositionStart) {
14518 currentComposition = FallbackCompositionState.getPooled(nativeEventTarget);
14519 } else if (eventType === eventTypes.compositionEnd) {
14520 if (currentComposition) {
14521 fallbackData = currentComposition.getData();
14522 }
14523 }
14524 }
14525
14526 var event = SyntheticCompositionEvent.getPooled(eventType, targetInst, nativeEvent, nativeEventTarget);
14527
14528 if (fallbackData) {
14529 // Inject data generated from fallback path into the synthetic event.
14530 // This matches the property of native CompositionEventInterface.
14531 event.data = fallbackData;
14532 } else {
14533 var customData = getDataFromCustomEvent(nativeEvent);
14534 if (customData !== null) {
14535 event.data = customData;
14536 }
14537 }
14538
14539 EventPropagators.accumulateTwoPhaseDispatches(event);
14540 return event;
14541}
14542
14543/**
14544 * @param {string} topLevelType Record from `EventConstants`.
14545 * @param {object} nativeEvent Native browser event.
14546 * @return {?string} The string corresponding to this `beforeInput` event.
14547 */
14548function getNativeBeforeInputChars(topLevelType, nativeEvent) {
14549 switch (topLevelType) {
14550 case topLevelTypes.topCompositionEnd:
14551 return getDataFromCustomEvent(nativeEvent);
14552 case topLevelTypes.topKeyPress:
14553 /**
14554 * If native `textInput` events are available, our goal is to make
14555 * use of them. However, there is a special case: the spacebar key.
14556 * In Webkit, preventing default on a spacebar `textInput` event
14557 * cancels character insertion, but it *also* causes the browser
14558 * to fall back to its default spacebar behavior of scrolling the
14559 * page.
14560 *
14561 * Tracking at:
14562 * https://code.google.com/p/chromium/issues/detail?id=355103
14563 *
14564 * To avoid this issue, use the keypress event as if no `textInput`
14565 * event is available.
14566 */
14567 var which = nativeEvent.which;
14568 if (which !== SPACEBAR_CODE) {
14569 return null;
14570 }
14571
14572 hasSpaceKeypress = true;
14573 return SPACEBAR_CHAR;
14574
14575 case topLevelTypes.topTextInput:
14576 // Record the characters to be added to the DOM.
14577 var chars = nativeEvent.data;
14578
14579 // If it's a spacebar character, assume that we have already handled
14580 // it at the keypress level and bail immediately. Android Chrome
14581 // doesn't give us keycodes, so we need to blacklist it.
14582 if (chars === SPACEBAR_CHAR && hasSpaceKeypress) {
14583 return null;
14584 }
14585
14586 return chars;
14587
14588 default:
14589 // For other native event types, do nothing.
14590 return null;
14591 }
14592}
14593
14594/**
14595 * For browsers that do not provide the `textInput` event, extract the
14596 * appropriate string to use for SyntheticInputEvent.
14597 *
14598 * @param {string} topLevelType Record from `EventConstants`.
14599 * @param {object} nativeEvent Native browser event.
14600 * @return {?string} The fallback string for this `beforeInput` event.
14601 */
14602function getFallbackBeforeInputChars(topLevelType, nativeEvent) {
14603 // If we are currently composing (IME) and using a fallback to do so,
14604 // try to extract the composed characters from the fallback object.
14605 if (currentComposition) {
14606 if (topLevelType === topLevelTypes.topCompositionEnd || isFallbackCompositionEnd(topLevelType, nativeEvent)) {
14607 var chars = currentComposition.getData();
14608 FallbackCompositionState.release(currentComposition);
14609 currentComposition = null;
14610 return chars;
14611 }
14612 return null;
14613 }
14614
14615 switch (topLevelType) {
14616 case topLevelTypes.topPaste:
14617 // If a paste event occurs after a keypress, throw out the input
14618 // chars. Paste events should not lead to BeforeInput events.
14619 return null;
14620 case topLevelTypes.topKeyPress:
14621 /**
14622 * As of v27, Firefox may fire keypress events even when no character
14623 * will be inserted. A few possibilities:
14624 *
14625 * - `which` is `0`. Arrow keys, Esc key, etc.
14626 *
14627 * - `which` is the pressed key code, but no char is available.
14628 * Ex: 'AltGr + d` in Polish. There is no modified character for
14629 * this key combination and no character is inserted into the
14630 * document, but FF fires the keypress for char code `100` anyway.
14631 * No `input` event will occur.
14632 *
14633 * - `which` is the pressed key code, but a command combination is
14634 * being used. Ex: `Cmd+C`. No character is inserted, and no
14635 * `input` event will occur.
14636 */
14637 if (nativeEvent.which && !isKeypressCommand(nativeEvent)) {
14638 return String.fromCharCode(nativeEvent.which);
14639 }
14640 return null;
14641 case topLevelTypes.topCompositionEnd:
14642 return useFallbackCompositionData ? null : nativeEvent.data;
14643 default:
14644 return null;
14645 }
14646}
14647
14648/**
14649 * Extract a SyntheticInputEvent for `beforeInput`, based on either native
14650 * `textInput` or fallback behavior.
14651 *
14652 * @return {?object} A SyntheticInputEvent.
14653 */
14654function extractBeforeInputEvent(topLevelType, targetInst, nativeEvent, nativeEventTarget) {
14655 var chars;
14656
14657 if (canUseTextInputEvent) {
14658 chars = getNativeBeforeInputChars(topLevelType, nativeEvent);
14659 } else {
14660 chars = getFallbackBeforeInputChars(topLevelType, nativeEvent);
14661 }
14662
14663 // If no characters are being inserted, no BeforeInput event should
14664 // be fired.
14665 if (!chars) {
14666 return null;
14667 }
14668
14669 var event = SyntheticInputEvent.getPooled(eventTypes.beforeInput, targetInst, nativeEvent, nativeEventTarget);
14670
14671 event.data = chars;
14672 EventPropagators.accumulateTwoPhaseDispatches(event);
14673 return event;
14674}
14675
14676/**
14677 * Create an `onBeforeInput` event to match
14678 * http://www.w3.org/TR/2013/WD-DOM-Level-3-Events-20131105/#events-inputevents.
14679 *
14680 * This event plugin is based on the native `textInput` event
14681 * available in Chrome, Safari, Opera, and IE. This event fires after
14682 * `onKeyPress` and `onCompositionEnd`, but before `onInput`.
14683 *
14684 * `beforeInput` is spec'd but not implemented in any browsers, and
14685 * the `input` event does not provide any useful information about what has
14686 * actually been added, contrary to the spec. Thus, `textInput` is the best
14687 * available event to identify the characters that have actually been inserted
14688 * into the target node.
14689 *
14690 * This plugin is also responsible for emitting `composition` events, thus
14691 * allowing us to share composition fallback code for both `beforeInput` and
14692 * `composition` event types.
14693 */
14694var BeforeInputEventPlugin = {
14695
14696 eventTypes: eventTypes,
14697
14698 extractEvents: function (topLevelType, targetInst, nativeEvent, nativeEventTarget) {
14699 return [extractCompositionEvent(topLevelType, targetInst, nativeEvent, nativeEventTarget), extractBeforeInputEvent(topLevelType, targetInst, nativeEvent, nativeEventTarget)];
14700 }
14701};
14702
14703module.exports = BeforeInputEventPlugin;
14704},{"174":174,"178":178,"179":179,"254":254,"258":258,"31":31,"49":49}],161:[function(require,module,exports){
14705/**
14706 * Copyright 2013-present, Facebook, Inc.
14707 * All rights reserved.
14708 *
14709 * This source code is licensed under the BSD-style license found in the
14710 * LICENSE file in the root directory of this source tree. An additional grant
14711 * of patent rights can be found in the PATENTS file in the same directory.
14712 *
14713 * @providesModule CSSProperty
14714 */
14715
14716'use strict';
14717
14718/**
14719 * CSS properties which accept numbers but are not in units of "px".
14720 */
14721
14722var isUnitlessNumber = {
14723 animationIterationCount: true,
14724 borderImageOutset: true,
14725 borderImageSlice: true,
14726 borderImageWidth: true,
14727 boxFlex: true,
14728 boxFlexGroup: true,
14729 boxOrdinalGroup: true,
14730 columnCount: true,
14731 flex: true,
14732 flexGrow: true,
14733 flexPositive: true,
14734 flexShrink: true,
14735 flexNegative: true,
14736 flexOrder: true,
14737 gridRow: true,
14738 gridColumn: true,
14739 fontWeight: true,
14740 lineClamp: true,
14741 lineHeight: true,
14742 opacity: true,
14743 order: true,
14744 orphans: true,
14745 tabSize: true,
14746 widows: true,
14747 zIndex: true,
14748 zoom: true,
14749
14750 // SVG-related properties
14751 fillOpacity: true,
14752 floodOpacity: true,
14753 stopOpacity: true,
14754 strokeDasharray: true,
14755 strokeDashoffset: true,
14756 strokeMiterlimit: true,
14757 strokeOpacity: true,
14758 strokeWidth: true
14759};
14760
14761/**
14762 * @param {string} prefix vendor-specific prefix, eg: Webkit
14763 * @param {string} key style name, eg: transitionDuration
14764 * @return {string} style name prefixed with `prefix`, properly camelCased, eg:
14765 * WebkitTransitionDuration
14766 */
14767function prefixKey(prefix, key) {
14768 return prefix + key.charAt(0).toUpperCase() + key.substring(1);
14769}
14770
14771/**
14772 * Support style names that may come passed in prefixed by adding permutations
14773 * of vendor prefixes.
14774 */
14775var prefixes = ['Webkit', 'ms', 'Moz', 'O'];
14776
14777// Using Object.keys here, or else the vanilla for-in loop makes IE8 go into an
14778// infinite loop, because it iterates over the newly added props too.
14779Object.keys(isUnitlessNumber).forEach(function (prop) {
14780 prefixes.forEach(function (prefix) {
14781 isUnitlessNumber[prefixKey(prefix, prop)] = isUnitlessNumber[prop];
14782 });
14783});
14784
14785/**
14786 * Most style properties can be unset by doing .style[prop] = '' but IE8
14787 * doesn't like doing that with shorthand properties so for the properties that
14788 * IE8 breaks on, which are listed here, we instead unset each of the
14789 * individual properties. See http://bugs.jquery.com/ticket/12385.
14790 * The 4-value 'clock' properties like margin, padding, border-width seem to
14791 * behave without any problems. Curiously, list-style works too without any
14792 * special prodding.
14793 */
14794var shorthandPropertyExpansions = {
14795 background: {
14796 backgroundAttachment: true,
14797 backgroundColor: true,
14798 backgroundImage: true,
14799 backgroundPositionX: true,
14800 backgroundPositionY: true,
14801 backgroundRepeat: true
14802 },
14803 backgroundPosition: {
14804 backgroundPositionX: true,
14805 backgroundPositionY: true
14806 },
14807 border: {
14808 borderWidth: true,
14809 borderStyle: true,
14810 borderColor: true
14811 },
14812 borderBottom: {
14813 borderBottomWidth: true,
14814 borderBottomStyle: true,
14815 borderBottomColor: true
14816 },
14817 borderLeft: {
14818 borderLeftWidth: true,
14819 borderLeftStyle: true,
14820 borderLeftColor: true
14821 },
14822 borderRight: {
14823 borderRightWidth: true,
14824 borderRightStyle: true,
14825 borderRightColor: true
14826 },
14827 borderTop: {
14828 borderTopWidth: true,
14829 borderTopStyle: true,
14830 borderTopColor: true
14831 },
14832 font: {
14833 fontStyle: true,
14834 fontVariant: true,
14835 fontWeight: true,
14836 fontSize: true,
14837 lineHeight: true,
14838 fontFamily: true
14839 },
14840 outline: {
14841 outlineWidth: true,
14842 outlineStyle: true,
14843 outlineColor: true
14844 }
14845};
14846
14847var CSSProperty = {
14848 isUnitlessNumber: isUnitlessNumber,
14849 shorthandPropertyExpansions: shorthandPropertyExpansions
14850};
14851
14852module.exports = CSSProperty;
14853},{}],162:[function(require,module,exports){
14854(function (process){
14855/**
14856 * Copyright 2013-present, Facebook, Inc.
14857 * All rights reserved.
14858 *
14859 * This source code is licensed under the BSD-style license found in the
14860 * LICENSE file in the root directory of this source tree. An additional grant
14861 * of patent rights can be found in the PATENTS file in the same directory.
14862 *
14863 * @providesModule CSSPropertyOperations
14864 */
14865
14866'use strict';
14867
14868var CSSProperty = require(161);
14869var ExecutionEnvironment = require(31);
14870var ReactInstrumentation = require(228);
14871
14872var camelizeStyleName = require(33);
14873var dangerousStyleValue = require(271);
14874var hyphenateStyleName = require(44);
14875var memoizeStringOnly = require(51);
14876var warning = require(55);
14877
14878var processStyleName = memoizeStringOnly(function (styleName) {
14879 return hyphenateStyleName(styleName);
14880});
14881
14882var hasShorthandPropertyBug = false;
14883var styleFloatAccessor = 'cssFloat';
14884if (ExecutionEnvironment.canUseDOM) {
14885 var tempStyle = document.createElement('div').style;
14886 try {
14887 // IE8 throws "Invalid argument." if resetting shorthand style properties.
14888 tempStyle.font = '';
14889 } catch (e) {
14890 hasShorthandPropertyBug = true;
14891 }
14892 // IE8 only supports accessing cssFloat (standard) as styleFloat
14893 if (document.documentElement.style.cssFloat === undefined) {
14894 styleFloatAccessor = 'styleFloat';
14895 }
14896}
14897
14898if (process.env.NODE_ENV !== 'production') {
14899 // 'msTransform' is correct, but the other prefixes should be capitalized
14900 var badVendoredStyleNamePattern = /^(?:webkit|moz|o)[A-Z]/;
14901
14902 // style values shouldn't contain a semicolon
14903 var badStyleValueWithSemicolonPattern = /;\s*$/;
14904
14905 var warnedStyleNames = {};
14906 var warnedStyleValues = {};
14907 var warnedForNaNValue = false;
14908
14909 var warnHyphenatedStyleName = function (name, owner) {
14910 if (warnedStyleNames.hasOwnProperty(name) && warnedStyleNames[name]) {
14911 return;
14912 }
14913
14914 warnedStyleNames[name] = true;
14915 process.env.NODE_ENV !== 'production' ? warning(false, 'Unsupported style property %s. Did you mean %s?%s', name, camelizeStyleName(name), checkRenderMessage(owner)) : void 0;
14916 };
14917
14918 var warnBadVendoredStyleName = function (name, owner) {
14919 if (warnedStyleNames.hasOwnProperty(name) && warnedStyleNames[name]) {
14920 return;
14921 }
14922
14923 warnedStyleNames[name] = true;
14924 process.env.NODE_ENV !== 'production' ? warning(false, 'Unsupported vendor-prefixed style property %s. Did you mean %s?%s', name, name.charAt(0).toUpperCase() + name.slice(1), checkRenderMessage(owner)) : void 0;
14925 };
14926
14927 var warnStyleValueWithSemicolon = function (name, value, owner) {
14928 if (warnedStyleValues.hasOwnProperty(value) && warnedStyleValues[value]) {
14929 return;
14930 }
14931
14932 warnedStyleValues[value] = true;
14933 process.env.NODE_ENV !== 'production' ? warning(false, 'Style property values shouldn\'t contain a semicolon.%s ' + 'Try "%s: %s" instead.', checkRenderMessage(owner), name, value.replace(badStyleValueWithSemicolonPattern, '')) : void 0;
14934 };
14935
14936 var warnStyleValueIsNaN = function (name, value, owner) {
14937 if (warnedForNaNValue) {
14938 return;
14939 }
14940
14941 warnedForNaNValue = true;
14942 process.env.NODE_ENV !== 'production' ? warning(false, '`NaN` is an invalid value for the `%s` css style property.%s', name, checkRenderMessage(owner)) : void 0;
14943 };
14944
14945 var checkRenderMessage = function (owner) {
14946 if (owner) {
14947 var name = owner.getName();
14948 if (name) {
14949 return ' Check the render method of `' + name + '`.';
14950 }
14951 }
14952 return '';
14953 };
14954
14955 /**
14956 * @param {string} name
14957 * @param {*} value
14958 * @param {ReactDOMComponent} component
14959 */
14960 var warnValidStyle = function (name, value, component) {
14961 var owner;
14962 if (component) {
14963 owner = component._currentElement._owner;
14964 }
14965 if (name.indexOf('-') > -1) {
14966 warnHyphenatedStyleName(name, owner);
14967 } else if (badVendoredStyleNamePattern.test(name)) {
14968 warnBadVendoredStyleName(name, owner);
14969 } else if (badStyleValueWithSemicolonPattern.test(value)) {
14970 warnStyleValueWithSemicolon(name, value, owner);
14971 }
14972
14973 if (typeof value === 'number' && isNaN(value)) {
14974 warnStyleValueIsNaN(name, value, owner);
14975 }
14976 };
14977}
14978
14979/**
14980 * Operations for dealing with CSS properties.
14981 */
14982var CSSPropertyOperations = {
14983
14984 /**
14985 * Serializes a mapping of style properties for use as inline styles:
14986 *
14987 * > createMarkupForStyles({width: '200px', height: 0})
14988 * "width:200px;height:0;"
14989 *
14990 * Undefined values are ignored so that declarative programming is easier.
14991 * The result should be HTML-escaped before insertion into the DOM.
14992 *
14993 * @param {object} styles
14994 * @param {ReactDOMComponent} component
14995 * @return {?string}
14996 */
14997 createMarkupForStyles: function (styles, component) {
14998 var serialized = '';
14999 for (var styleName in styles) {
15000 if (!styles.hasOwnProperty(styleName)) {
15001 continue;
15002 }
15003 var styleValue = styles[styleName];
15004 if (process.env.NODE_ENV !== 'production') {
15005 warnValidStyle(styleName, styleValue, component);
15006 }
15007 if (styleValue != null) {
15008 serialized += processStyleName(styleName) + ':';
15009 serialized += dangerousStyleValue(styleName, styleValue, component) + ';';
15010 }
15011 }
15012 return serialized || null;
15013 },
15014
15015 /**
15016 * Sets the value for multiple styles on a node. If a value is specified as
15017 * '' (empty string), the corresponding style property will be unset.
15018 *
15019 * @param {DOMElement} node
15020 * @param {object} styles
15021 * @param {ReactDOMComponent} component
15022 */
15023 setValueForStyles: function (node, styles, component) {
15024 if (process.env.NODE_ENV !== 'production') {
15025 ReactInstrumentation.debugTool.onNativeOperation(component._debugID, 'update styles', styles);
15026 }
15027
15028 var style = node.style;
15029 for (var styleName in styles) {
15030 if (!styles.hasOwnProperty(styleName)) {
15031 continue;
15032 }
15033 if (process.env.NODE_ENV !== 'production') {
15034 warnValidStyle(styleName, styles[styleName], component);
15035 }
15036 var styleValue = dangerousStyleValue(styleName, styles[styleName], component);
15037 if (styleName === 'float' || styleName === 'cssFloat') {
15038 styleName = styleFloatAccessor;
15039 }
15040 if (styleValue) {
15041 style[styleName] = styleValue;
15042 } else {
15043 var expansion = hasShorthandPropertyBug && CSSProperty.shorthandPropertyExpansions[styleName];
15044 if (expansion) {
15045 // Shorthand property that IE8 won't like unsetting, so unset each
15046 // component to placate it
15047 for (var individualStyleName in expansion) {
15048 style[individualStyleName] = '';
15049 }
15050 } else {
15051 style[styleName] = '';
15052 }
15053 }
15054 }
15055 }
15056
15057};
15058
15059module.exports = CSSPropertyOperations;
15060}).call(this,require(91))
15061},{"161":161,"228":228,"271":271,"31":31,"33":33,"44":44,"51":51,"55":55,"91":91}],163:[function(require,module,exports){
15062(function (process){
15063/**
15064 * Copyright 2013-present, Facebook, Inc.
15065 * All rights reserved.
15066 *
15067 * This source code is licensed under the BSD-style license found in the
15068 * LICENSE file in the root directory of this source tree. An additional grant
15069 * of patent rights can be found in the PATENTS file in the same directory.
15070 *
15071 * @providesModule CallbackQueue
15072 */
15073
15074'use strict';
15075
15076var _assign = require(296);
15077
15078var PooledClass = require(183);
15079
15080var invariant = require(45);
15081
15082/**
15083 * A specialized pseudo-event module to help keep track of components waiting to
15084 * be notified when their DOM representations are available for use.
15085 *
15086 * This implements `PooledClass`, so you should never need to instantiate this.
15087 * Instead, use `CallbackQueue.getPooled()`.
15088 *
15089 * @class ReactMountReady
15090 * @implements PooledClass
15091 * @internal
15092 */
15093function CallbackQueue() {
15094 this._callbacks = null;
15095 this._contexts = null;
15096}
15097
15098_assign(CallbackQueue.prototype, {
15099
15100 /**
15101 * Enqueues a callback to be invoked when `notifyAll` is invoked.
15102 *
15103 * @param {function} callback Invoked when `notifyAll` is invoked.
15104 * @param {?object} context Context to call `callback` with.
15105 * @internal
15106 */
15107 enqueue: function (callback, context) {
15108 this._callbacks = this._callbacks || [];
15109 this._contexts = this._contexts || [];
15110 this._callbacks.push(callback);
15111 this._contexts.push(context);
15112 },
15113
15114 /**
15115 * Invokes all enqueued callbacks and clears the queue. This is invoked after
15116 * the DOM representation of a component has been created or updated.
15117 *
15118 * @internal
15119 */
15120 notifyAll: function () {
15121 var callbacks = this._callbacks;
15122 var contexts = this._contexts;
15123 if (callbacks) {
15124 !(callbacks.length === contexts.length) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Mismatched list of contexts in callback queue') : invariant(false) : void 0;
15125 this._callbacks = null;
15126 this._contexts = null;
15127 for (var i = 0; i < callbacks.length; i++) {
15128 callbacks[i].call(contexts[i]);
15129 }
15130 callbacks.length = 0;
15131 contexts.length = 0;
15132 }
15133 },
15134
15135 checkpoint: function () {
15136 return this._callbacks ? this._callbacks.length : 0;
15137 },
15138
15139 rollback: function (len) {
15140 if (this._callbacks) {
15141 this._callbacks.length = len;
15142 this._contexts.length = len;
15143 }
15144 },
15145
15146 /**
15147 * Resets the internal queue.
15148 *
15149 * @internal
15150 */
15151 reset: function () {
15152 this._callbacks = null;
15153 this._contexts = null;
15154 },
15155
15156 /**
15157 * `PooledClass` looks for this.
15158 */
15159 destructor: function () {
15160 this.reset();
15161 }
15162
15163});
15164
15165PooledClass.addPoolingTo(CallbackQueue);
15166
15167module.exports = CallbackQueue;
15168}).call(this,require(91))
15169},{"183":183,"296":296,"45":45,"91":91}],164:[function(require,module,exports){
15170/**
15171 * Copyright 2013-present, Facebook, Inc.
15172 * All rights reserved.
15173 *
15174 * This source code is licensed under the BSD-style license found in the
15175 * LICENSE file in the root directory of this source tree. An additional grant
15176 * of patent rights can be found in the PATENTS file in the same directory.
15177 *
15178 * @providesModule ChangeEventPlugin
15179 */
15180
15181'use strict';
15182
15183var EventConstants = require(174);
15184var EventPluginHub = require(175);
15185var EventPropagators = require(178);
15186var ExecutionEnvironment = require(31);
15187var ReactDOMComponentTree = require(199);
15188var ReactUpdates = require(247);
15189var SyntheticEvent = require(256);
15190
15191var getEventTarget = require(279);
15192var isEventSupported = require(286);
15193var isTextInputElement = require(287);
15194var keyOf = require(49);
15195
15196var topLevelTypes = EventConstants.topLevelTypes;
15197
15198var eventTypes = {
15199 change: {
15200 phasedRegistrationNames: {
15201 bubbled: keyOf({ onChange: null }),
15202 captured: keyOf({ onChangeCapture: null })
15203 },
15204 dependencies: [topLevelTypes.topBlur, topLevelTypes.topChange, topLevelTypes.topClick, topLevelTypes.topFocus, topLevelTypes.topInput, topLevelTypes.topKeyDown, topLevelTypes.topKeyUp, topLevelTypes.topSelectionChange]
15205 }
15206};
15207
15208/**
15209 * For IE shims
15210 */
15211var activeElement = null;
15212var activeElementInst = null;
15213var activeElementValue = null;
15214var activeElementValueProp = null;
15215
15216/**
15217 * SECTION: handle `change` event
15218 */
15219function shouldUseChangeEvent(elem) {
15220 var nodeName = elem.nodeName && elem.nodeName.toLowerCase();
15221 return nodeName === 'select' || nodeName === 'input' && elem.type === 'file';
15222}
15223
15224var doesChangeEventBubble = false;
15225if (ExecutionEnvironment.canUseDOM) {
15226 // See `handleChange` comment below
15227 doesChangeEventBubble = isEventSupported('change') && (!('documentMode' in document) || document.documentMode > 8);
15228}
15229
15230function manualDispatchChangeEvent(nativeEvent) {
15231 var event = SyntheticEvent.getPooled(eventTypes.change, activeElementInst, nativeEvent, getEventTarget(nativeEvent));
15232 EventPropagators.accumulateTwoPhaseDispatches(event);
15233
15234 // If change and propertychange bubbled, we'd just bind to it like all the
15235 // other events and have it go through ReactBrowserEventEmitter. Since it
15236 // doesn't, we manually listen for the events and so we have to enqueue and
15237 // process the abstract event manually.
15238 //
15239 // Batching is necessary here in order to ensure that all event handlers run
15240 // before the next rerender (including event handlers attached to ancestor
15241 // elements instead of directly on the input). Without this, controlled
15242 // components don't work properly in conjunction with event bubbling because
15243 // the component is rerendered and the value reverted before all the event
15244 // handlers can run. See https://github.com/facebook/react/issues/708.
15245 ReactUpdates.batchedUpdates(runEventInBatch, event);
15246}
15247
15248function runEventInBatch(event) {
15249 EventPluginHub.enqueueEvents(event);
15250 EventPluginHub.processEventQueue(false);
15251}
15252
15253function startWatchingForChangeEventIE8(target, targetInst) {
15254 activeElement = target;
15255 activeElementInst = targetInst;
15256 activeElement.attachEvent('onchange', manualDispatchChangeEvent);
15257}
15258
15259function stopWatchingForChangeEventIE8() {
15260 if (!activeElement) {
15261 return;
15262 }
15263 activeElement.detachEvent('onchange', manualDispatchChangeEvent);
15264 activeElement = null;
15265 activeElementInst = null;
15266}
15267
15268function getTargetInstForChangeEvent(topLevelType, targetInst) {
15269 if (topLevelType === topLevelTypes.topChange) {
15270 return targetInst;
15271 }
15272}
15273function handleEventsForChangeEventIE8(topLevelType, target, targetInst) {
15274 if (topLevelType === topLevelTypes.topFocus) {
15275 // stopWatching() should be a noop here but we call it just in case we
15276 // missed a blur event somehow.
15277 stopWatchingForChangeEventIE8();
15278 startWatchingForChangeEventIE8(target, targetInst);
15279 } else if (topLevelType === topLevelTypes.topBlur) {
15280 stopWatchingForChangeEventIE8();
15281 }
15282}
15283
15284/**
15285 * SECTION: handle `input` event
15286 */
15287var isInputEventSupported = false;
15288if (ExecutionEnvironment.canUseDOM) {
15289 // IE9 claims to support the input event but fails to trigger it when
15290 // deleting text, so we ignore its input events.
15291 // IE10+ fire input events to often, such when a placeholder
15292 // changes or when an input with a placeholder is focused.
15293 isInputEventSupported = isEventSupported('input') && (!('documentMode' in document) || document.documentMode > 11);
15294}
15295
15296/**
15297 * (For IE <=11) Replacement getter/setter for the `value` property that gets
15298 * set on the active element.
15299 */
15300var newValueProp = {
15301 get: function () {
15302 return activeElementValueProp.get.call(this);
15303 },
15304 set: function (val) {
15305 // Cast to a string so we can do equality checks.
15306 activeElementValue = '' + val;
15307 activeElementValueProp.set.call(this, val);
15308 }
15309};
15310
15311/**
15312 * (For IE <=11) Starts tracking propertychange events on the passed-in element
15313 * and override the value property so that we can distinguish user events from
15314 * value changes in JS.
15315 */
15316function startWatchingForValueChange(target, targetInst) {
15317 activeElement = target;
15318 activeElementInst = targetInst;
15319 activeElementValue = target.value;
15320 activeElementValueProp = Object.getOwnPropertyDescriptor(target.constructor.prototype, 'value');
15321
15322 // Not guarded in a canDefineProperty check: IE8 supports defineProperty only
15323 // on DOM elements
15324 Object.defineProperty(activeElement, 'value', newValueProp);
15325 if (activeElement.attachEvent) {
15326 activeElement.attachEvent('onpropertychange', handlePropertyChange);
15327 } else {
15328 activeElement.addEventListener('propertychange', handlePropertyChange, false);
15329 }
15330}
15331
15332/**
15333 * (For IE <=11) Removes the event listeners from the currently-tracked element,
15334 * if any exists.
15335 */
15336function stopWatchingForValueChange() {
15337 if (!activeElement) {
15338 return;
15339 }
15340
15341 // delete restores the original property definition
15342 delete activeElement.value;
15343
15344 if (activeElement.detachEvent) {
15345 activeElement.detachEvent('onpropertychange', handlePropertyChange);
15346 } else {
15347 activeElement.removeEventListener('propertychange', handlePropertyChange, false);
15348 }
15349
15350 activeElement = null;
15351 activeElementInst = null;
15352 activeElementValue = null;
15353 activeElementValueProp = null;
15354}
15355
15356/**
15357 * (For IE <=11) Handles a propertychange event, sending a `change` event if
15358 * the value of the active element has changed.
15359 */
15360function handlePropertyChange(nativeEvent) {
15361 if (nativeEvent.propertyName !== 'value') {
15362 return;
15363 }
15364 var value = nativeEvent.srcElement.value;
15365 if (value === activeElementValue) {
15366 return;
15367 }
15368 activeElementValue = value;
15369
15370 manualDispatchChangeEvent(nativeEvent);
15371}
15372
15373/**
15374 * If a `change` event should be fired, returns the target's ID.
15375 */
15376function getTargetInstForInputEvent(topLevelType, targetInst) {
15377 if (topLevelType === topLevelTypes.topInput) {
15378 // In modern browsers (i.e., not IE8 or IE9), the input event is exactly
15379 // what we want so fall through here and trigger an abstract event
15380 return targetInst;
15381 }
15382}
15383
15384function handleEventsForInputEventIE(topLevelType, target, targetInst) {
15385 if (topLevelType === topLevelTypes.topFocus) {
15386 // In IE8, we can capture almost all .value changes by adding a
15387 // propertychange handler and looking for events with propertyName
15388 // equal to 'value'
15389 // In IE9-11, propertychange fires for most input events but is buggy and
15390 // doesn't fire when text is deleted, but conveniently, selectionchange
15391 // appears to fire in all of the remaining cases so we catch those and
15392 // forward the event if the value has changed
15393 // In either case, we don't want to call the event handler if the value
15394 // is changed from JS so we redefine a setter for `.value` that updates
15395 // our activeElementValue variable, allowing us to ignore those changes
15396 //
15397 // stopWatching() should be a noop here but we call it just in case we
15398 // missed a blur event somehow.
15399 stopWatchingForValueChange();
15400 startWatchingForValueChange(target, targetInst);
15401 } else if (topLevelType === topLevelTypes.topBlur) {
15402 stopWatchingForValueChange();
15403 }
15404}
15405
15406// For IE8 and IE9.
15407function getTargetInstForInputEventIE(topLevelType, targetInst) {
15408 if (topLevelType === topLevelTypes.topSelectionChange || topLevelType === topLevelTypes.topKeyUp || topLevelType === topLevelTypes.topKeyDown) {
15409 // On the selectionchange event, the target is just document which isn't
15410 // helpful for us so just check activeElement instead.
15411 //
15412 // 99% of the time, keydown and keyup aren't necessary. IE8 fails to fire
15413 // propertychange on the first input event after setting `value` from a
15414 // script and fires only keydown, keypress, keyup. Catching keyup usually
15415 // gets it and catching keydown lets us fire an event for the first
15416 // keystroke if user does a key repeat (it'll be a little delayed: right
15417 // before the second keystroke). Other input methods (e.g., paste) seem to
15418 // fire selectionchange normally.
15419 if (activeElement && activeElement.value !== activeElementValue) {
15420 activeElementValue = activeElement.value;
15421 return activeElementInst;
15422 }
15423 }
15424}
15425
15426/**
15427 * SECTION: handle `click` event
15428 */
15429function shouldUseClickEvent(elem) {
15430 // Use the `click` event to detect changes to checkbox and radio inputs.
15431 // This approach works across all browsers, whereas `change` does not fire
15432 // until `blur` in IE8.
15433 return elem.nodeName && elem.nodeName.toLowerCase() === 'input' && (elem.type === 'checkbox' || elem.type === 'radio');
15434}
15435
15436function getTargetInstForClickEvent(topLevelType, targetInst) {
15437 if (topLevelType === topLevelTypes.topClick) {
15438 return targetInst;
15439 }
15440}
15441
15442/**
15443 * This plugin creates an `onChange` event that normalizes change events
15444 * across form elements. This event fires at a time when it's possible to
15445 * change the element's value without seeing a flicker.
15446 *
15447 * Supported elements are:
15448 * - input (see `isTextInputElement`)
15449 * - textarea
15450 * - select
15451 */
15452var ChangeEventPlugin = {
15453
15454 eventTypes: eventTypes,
15455
15456 extractEvents: function (topLevelType, targetInst, nativeEvent, nativeEventTarget) {
15457 var targetNode = targetInst ? ReactDOMComponentTree.getNodeFromInstance(targetInst) : window;
15458
15459 var getTargetInstFunc, handleEventFunc;
15460 if (shouldUseChangeEvent(targetNode)) {
15461 if (doesChangeEventBubble) {
15462 getTargetInstFunc = getTargetInstForChangeEvent;
15463 } else {
15464 handleEventFunc = handleEventsForChangeEventIE8;
15465 }
15466 } else if (isTextInputElement(targetNode)) {
15467 if (isInputEventSupported) {
15468 getTargetInstFunc = getTargetInstForInputEvent;
15469 } else {
15470 getTargetInstFunc = getTargetInstForInputEventIE;
15471 handleEventFunc = handleEventsForInputEventIE;
15472 }
15473 } else if (shouldUseClickEvent(targetNode)) {
15474 getTargetInstFunc = getTargetInstForClickEvent;
15475 }
15476
15477 if (getTargetInstFunc) {
15478 var inst = getTargetInstFunc(topLevelType, targetInst);
15479 if (inst) {
15480 var event = SyntheticEvent.getPooled(eventTypes.change, inst, nativeEvent, nativeEventTarget);
15481 event.type = 'change';
15482 EventPropagators.accumulateTwoPhaseDispatches(event);
15483 return event;
15484 }
15485 }
15486
15487 if (handleEventFunc) {
15488 handleEventFunc(topLevelType, targetNode, targetInst);
15489 }
15490 }
15491
15492};
15493
15494module.exports = ChangeEventPlugin;
15495},{"174":174,"175":175,"178":178,"199":199,"247":247,"256":256,"279":279,"286":286,"287":287,"31":31,"49":49}],165:[function(require,module,exports){
15496(function (process){
15497/**
15498 * Copyright 2013-present, Facebook, Inc.
15499 * All rights reserved.
15500 *
15501 * This source code is licensed under the BSD-style license found in the
15502 * LICENSE file in the root directory of this source tree. An additional grant
15503 * of patent rights can be found in the PATENTS file in the same directory.
15504 *
15505 * @providesModule DOMChildrenOperations
15506 */
15507
15508'use strict';
15509
15510var DOMLazyTree = require(166);
15511var Danger = require(170);
15512var ReactMultiChildUpdateTypes = require(233);
15513var ReactDOMComponentTree = require(199);
15514var ReactInstrumentation = require(228);
15515
15516var createMicrosoftUnsafeLocalFunction = require(270);
15517var setInnerHTML = require(291);
15518var setTextContent = require(292);
15519
15520function getNodeAfter(parentNode, node) {
15521 // Special case for text components, which return [open, close] comments
15522 // from getNativeNode.
15523 if (Array.isArray(node)) {
15524 node = node[1];
15525 }
15526 return node ? node.nextSibling : parentNode.firstChild;
15527}
15528
15529/**
15530 * Inserts `childNode` as a child of `parentNode` at the `index`.
15531 *
15532 * @param {DOMElement} parentNode Parent node in which to insert.
15533 * @param {DOMElement} childNode Child node to insert.
15534 * @param {number} index Index at which to insert the child.
15535 * @internal
15536 */
15537var insertChildAt = createMicrosoftUnsafeLocalFunction(function (parentNode, childNode, referenceNode) {
15538 // We rely exclusively on `insertBefore(node, null)` instead of also using
15539 // `appendChild(node)`. (Using `undefined` is not allowed by all browsers so
15540 // we are careful to use `null`.)
15541 parentNode.insertBefore(childNode, referenceNode);
15542});
15543
15544function insertLazyTreeChildAt(parentNode, childTree, referenceNode) {
15545 DOMLazyTree.insertTreeBefore(parentNode, childTree, referenceNode);
15546}
15547
15548function moveChild(parentNode, childNode, referenceNode) {
15549 if (Array.isArray(childNode)) {
15550 moveDelimitedText(parentNode, childNode[0], childNode[1], referenceNode);
15551 } else {
15552 insertChildAt(parentNode, childNode, referenceNode);
15553 }
15554}
15555
15556function removeChild(parentNode, childNode) {
15557 if (Array.isArray(childNode)) {
15558 var closingComment = childNode[1];
15559 childNode = childNode[0];
15560 removeDelimitedText(parentNode, childNode, closingComment);
15561 parentNode.removeChild(closingComment);
15562 }
15563 parentNode.removeChild(childNode);
15564}
15565
15566function moveDelimitedText(parentNode, openingComment, closingComment, referenceNode) {
15567 var node = openingComment;
15568 while (true) {
15569 var nextNode = node.nextSibling;
15570 insertChildAt(parentNode, node, referenceNode);
15571 if (node === closingComment) {
15572 break;
15573 }
15574 node = nextNode;
15575 }
15576}
15577
15578function removeDelimitedText(parentNode, startNode, closingComment) {
15579 while (true) {
15580 var node = startNode.nextSibling;
15581 if (node === closingComment) {
15582 // The closing comment is removed by ReactMultiChild.
15583 break;
15584 } else {
15585 parentNode.removeChild(node);
15586 }
15587 }
15588}
15589
15590function replaceDelimitedText(openingComment, closingComment, stringText) {
15591 var parentNode = openingComment.parentNode;
15592 var nodeAfterComment = openingComment.nextSibling;
15593 if (nodeAfterComment === closingComment) {
15594 // There are no text nodes between the opening and closing comments; insert
15595 // a new one if stringText isn't empty.
15596 if (stringText) {
15597 insertChildAt(parentNode, document.createTextNode(stringText), nodeAfterComment);
15598 }
15599 } else {
15600 if (stringText) {
15601 // Set the text content of the first node after the opening comment, and
15602 // remove all following nodes up until the closing comment.
15603 setTextContent(nodeAfterComment, stringText);
15604 removeDelimitedText(parentNode, nodeAfterComment, closingComment);
15605 } else {
15606 removeDelimitedText(parentNode, openingComment, closingComment);
15607 }
15608 }
15609
15610 if (process.env.NODE_ENV !== 'production') {
15611 ReactInstrumentation.debugTool.onNativeOperation(ReactDOMComponentTree.getInstanceFromNode(openingComment)._debugID, 'replace text', stringText);
15612 }
15613}
15614
15615var dangerouslyReplaceNodeWithMarkup = Danger.dangerouslyReplaceNodeWithMarkup;
15616if (process.env.NODE_ENV !== 'production') {
15617 dangerouslyReplaceNodeWithMarkup = function (oldChild, markup, prevInstance) {
15618 Danger.dangerouslyReplaceNodeWithMarkup(oldChild, markup);
15619 if (prevInstance._debugID !== 0) {
15620 ReactInstrumentation.debugTool.onNativeOperation(prevInstance._debugID, 'replace with', markup.toString());
15621 } else {
15622 var nextInstance = ReactDOMComponentTree.getInstanceFromNode(markup.node);
15623 if (nextInstance._debugID !== 0) {
15624 ReactInstrumentation.debugTool.onNativeOperation(nextInstance._debugID, 'mount', markup.toString());
15625 }
15626 }
15627 };
15628}
15629
15630/**
15631 * Operations for updating with DOM children.
15632 */
15633var DOMChildrenOperations = {
15634
15635 dangerouslyReplaceNodeWithMarkup: dangerouslyReplaceNodeWithMarkup,
15636
15637 replaceDelimitedText: replaceDelimitedText,
15638
15639 /**
15640 * Updates a component's children by processing a series of updates. The
15641 * update configurations are each expected to have a `parentNode` property.
15642 *
15643 * @param {array<object>} updates List of update configurations.
15644 * @internal
15645 */
15646 processUpdates: function (parentNode, updates) {
15647 if (process.env.NODE_ENV !== 'production') {
15648 var parentNodeDebugID = ReactDOMComponentTree.getInstanceFromNode(parentNode)._debugID;
15649 }
15650
15651 for (var k = 0; k < updates.length; k++) {
15652 var update = updates[k];
15653 switch (update.type) {
15654 case ReactMultiChildUpdateTypes.INSERT_MARKUP:
15655 insertLazyTreeChildAt(parentNode, update.content, getNodeAfter(parentNode, update.afterNode));
15656 if (process.env.NODE_ENV !== 'production') {
15657 ReactInstrumentation.debugTool.onNativeOperation(parentNodeDebugID, 'insert child', { toIndex: update.toIndex, content: update.content.toString() });
15658 }
15659 break;
15660 case ReactMultiChildUpdateTypes.MOVE_EXISTING:
15661 moveChild(parentNode, update.fromNode, getNodeAfter(parentNode, update.afterNode));
15662 if (process.env.NODE_ENV !== 'production') {
15663 ReactInstrumentation.debugTool.onNativeOperation(parentNodeDebugID, 'move child', { fromIndex: update.fromIndex, toIndex: update.toIndex });
15664 }
15665 break;
15666 case ReactMultiChildUpdateTypes.SET_MARKUP:
15667 setInnerHTML(parentNode, update.content);
15668 if (process.env.NODE_ENV !== 'production') {
15669 ReactInstrumentation.debugTool.onNativeOperation(parentNodeDebugID, 'replace children', update.content.toString());
15670 }
15671 break;
15672 case ReactMultiChildUpdateTypes.TEXT_CONTENT:
15673 setTextContent(parentNode, update.content);
15674 if (process.env.NODE_ENV !== 'production') {
15675 ReactInstrumentation.debugTool.onNativeOperation(parentNodeDebugID, 'replace text', update.content.toString());
15676 }
15677 break;
15678 case ReactMultiChildUpdateTypes.REMOVE_NODE:
15679 removeChild(parentNode, update.fromNode);
15680 if (process.env.NODE_ENV !== 'production') {
15681 ReactInstrumentation.debugTool.onNativeOperation(parentNodeDebugID, 'remove child', { fromIndex: update.fromIndex });
15682 }
15683 break;
15684 }
15685 }
15686 }
15687
15688};
15689
15690module.exports = DOMChildrenOperations;
15691}).call(this,require(91))
15692},{"166":166,"170":170,"199":199,"228":228,"233":233,"270":270,"291":291,"292":292,"91":91}],166:[function(require,module,exports){
15693/**
15694 * Copyright 2015-present, Facebook, Inc.
15695 * All rights reserved.
15696 *
15697 * This source code is licensed under the BSD-style license found in the
15698 * LICENSE file in the root directory of this source tree. An additional grant
15699 * of patent rights can be found in the PATENTS file in the same directory.
15700 *
15701 * @providesModule DOMLazyTree
15702 */
15703
15704'use strict';
15705
15706var DOMNamespaces = require(167);
15707
15708var createMicrosoftUnsafeLocalFunction = require(270);
15709var setTextContent = require(292);
15710
15711var ELEMENT_NODE_TYPE = 1;
15712var DOCUMENT_FRAGMENT_NODE_TYPE = 11;
15713
15714/**
15715 * In IE (8-11) and Edge, appending nodes with no children is dramatically
15716 * faster than appending a full subtree, so we essentially queue up the
15717 * .appendChild calls here and apply them so each node is added to its parent
15718 * before any children are added.
15719 *
15720 * In other browsers, doing so is slower or neutral compared to the other order
15721 * (in Firefox, twice as slow) so we only do this inversion in IE.
15722 *
15723 * See https://github.com/spicyj/innerhtml-vs-createelement-vs-clonenode.
15724 */
15725var enableLazy = typeof document !== 'undefined' && typeof document.documentMode === 'number' || typeof navigator !== 'undefined' && typeof navigator.userAgent === 'string' && /\bEdge\/\d/.test(navigator.userAgent);
15726
15727function insertTreeChildren(tree) {
15728 if (!enableLazy) {
15729 return;
15730 }
15731 var node = tree.node;
15732 var children = tree.children;
15733 if (children.length) {
15734 for (var i = 0; i < children.length; i++) {
15735 insertTreeBefore(node, children[i], null);
15736 }
15737 } else if (tree.html != null) {
15738 node.innerHTML = tree.html;
15739 } else if (tree.text != null) {
15740 setTextContent(node, tree.text);
15741 }
15742}
15743
15744var insertTreeBefore = createMicrosoftUnsafeLocalFunction(function (parentNode, tree, referenceNode) {
15745 // DocumentFragments aren't actually part of the DOM after insertion so
15746 // appending children won't update the DOM. We need to ensure the fragment
15747 // is properly populated first, breaking out of our lazy approach for just
15748 // this level. Also, some <object> plugins (like Flash Player) will read
15749 // <param> nodes immediately upon insertion into the DOM, so <object>
15750 // must also be populated prior to insertion into the DOM.
15751 if (tree.node.nodeType === DOCUMENT_FRAGMENT_NODE_TYPE || tree.node.nodeType === ELEMENT_NODE_TYPE && tree.node.nodeName.toLowerCase() === 'object' && (tree.node.namespaceURI == null || tree.node.namespaceURI === DOMNamespaces.html)) {
15752 insertTreeChildren(tree);
15753 parentNode.insertBefore(tree.node, referenceNode);
15754 } else {
15755 parentNode.insertBefore(tree.node, referenceNode);
15756 insertTreeChildren(tree);
15757 }
15758});
15759
15760function replaceChildWithTree(oldNode, newTree) {
15761 oldNode.parentNode.replaceChild(newTree.node, oldNode);
15762 insertTreeChildren(newTree);
15763}
15764
15765function queueChild(parentTree, childTree) {
15766 if (enableLazy) {
15767 parentTree.children.push(childTree);
15768 } else {
15769 parentTree.node.appendChild(childTree.node);
15770 }
15771}
15772
15773function queueHTML(tree, html) {
15774 if (enableLazy) {
15775 tree.html = html;
15776 } else {
15777 tree.node.innerHTML = html;
15778 }
15779}
15780
15781function queueText(tree, text) {
15782 if (enableLazy) {
15783 tree.text = text;
15784 } else {
15785 setTextContent(tree.node, text);
15786 }
15787}
15788
15789function toString() {
15790 return this.node.nodeName;
15791}
15792
15793function DOMLazyTree(node) {
15794 return {
15795 node: node,
15796 children: [],
15797 html: null,
15798 text: null,
15799 toString: toString
15800 };
15801}
15802
15803DOMLazyTree.insertTreeBefore = insertTreeBefore;
15804DOMLazyTree.replaceChildWithTree = replaceChildWithTree;
15805DOMLazyTree.queueChild = queueChild;
15806DOMLazyTree.queueHTML = queueHTML;
15807DOMLazyTree.queueText = queueText;
15808
15809module.exports = DOMLazyTree;
15810},{"167":167,"270":270,"292":292}],167:[function(require,module,exports){
15811/**
15812 * Copyright 2013-present, Facebook, Inc.
15813 * All rights reserved.
15814 *
15815 * This source code is licensed under the BSD-style license found in the
15816 * LICENSE file in the root directory of this source tree. An additional grant
15817 * of patent rights can be found in the PATENTS file in the same directory.
15818 *
15819 * @providesModule DOMNamespaces
15820 */
15821
15822'use strict';
15823
15824var DOMNamespaces = {
15825 html: 'http://www.w3.org/1999/xhtml',
15826 mathml: 'http://www.w3.org/1998/Math/MathML',
15827 svg: 'http://www.w3.org/2000/svg'
15828};
15829
15830module.exports = DOMNamespaces;
15831},{}],168:[function(require,module,exports){
15832(function (process){
15833/**
15834 * Copyright 2013-present, Facebook, Inc.
15835 * All rights reserved.
15836 *
15837 * This source code is licensed under the BSD-style license found in the
15838 * LICENSE file in the root directory of this source tree. An additional grant
15839 * of patent rights can be found in the PATENTS file in the same directory.
15840 *
15841 * @providesModule DOMProperty
15842 */
15843
15844'use strict';
15845
15846var invariant = require(45);
15847
15848function checkMask(value, bitmask) {
15849 return (value & bitmask) === bitmask;
15850}
15851
15852var DOMPropertyInjection = {
15853 /**
15854 * Mapping from normalized, camelcased property names to a configuration that
15855 * specifies how the associated DOM property should be accessed or rendered.
15856 */
15857 MUST_USE_PROPERTY: 0x1,
15858 HAS_SIDE_EFFECTS: 0x2,
15859 HAS_BOOLEAN_VALUE: 0x4,
15860 HAS_NUMERIC_VALUE: 0x8,
15861 HAS_POSITIVE_NUMERIC_VALUE: 0x10 | 0x8,
15862 HAS_OVERLOADED_BOOLEAN_VALUE: 0x20,
15863
15864 /**
15865 * Inject some specialized knowledge about the DOM. This takes a config object
15866 * with the following properties:
15867 *
15868 * isCustomAttribute: function that given an attribute name will return true
15869 * if it can be inserted into the DOM verbatim. Useful for data-* or aria-*
15870 * attributes where it's impossible to enumerate all of the possible
15871 * attribute names,
15872 *
15873 * Properties: object mapping DOM property name to one of the
15874 * DOMPropertyInjection constants or null. If your attribute isn't in here,
15875 * it won't get written to the DOM.
15876 *
15877 * DOMAttributeNames: object mapping React attribute name to the DOM
15878 * attribute name. Attribute names not specified use the **lowercase**
15879 * normalized name.
15880 *
15881 * DOMAttributeNamespaces: object mapping React attribute name to the DOM
15882 * attribute namespace URL. (Attribute names not specified use no namespace.)
15883 *
15884 * DOMPropertyNames: similar to DOMAttributeNames but for DOM properties.
15885 * Property names not specified use the normalized name.
15886 *
15887 * DOMMutationMethods: Properties that require special mutation methods. If
15888 * `value` is undefined, the mutation method should unset the property.
15889 *
15890 * @param {object} domPropertyConfig the config as described above.
15891 */
15892 injectDOMPropertyConfig: function (domPropertyConfig) {
15893 var Injection = DOMPropertyInjection;
15894 var Properties = domPropertyConfig.Properties || {};
15895 var DOMAttributeNamespaces = domPropertyConfig.DOMAttributeNamespaces || {};
15896 var DOMAttributeNames = domPropertyConfig.DOMAttributeNames || {};
15897 var DOMPropertyNames = domPropertyConfig.DOMPropertyNames || {};
15898 var DOMMutationMethods = domPropertyConfig.DOMMutationMethods || {};
15899
15900 if (domPropertyConfig.isCustomAttribute) {
15901 DOMProperty._isCustomAttributeFunctions.push(domPropertyConfig.isCustomAttribute);
15902 }
15903
15904 for (var propName in Properties) {
15905 !!DOMProperty.properties.hasOwnProperty(propName) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'injectDOMPropertyConfig(...): You\'re trying to inject DOM property ' + '\'%s\' which has already been injected. You may be accidentally ' + 'injecting the same DOM property config twice, or you may be ' + 'injecting two configs that have conflicting property names.', propName) : invariant(false) : void 0;
15906
15907 var lowerCased = propName.toLowerCase();
15908 var propConfig = Properties[propName];
15909
15910 var propertyInfo = {
15911 attributeName: lowerCased,
15912 attributeNamespace: null,
15913 propertyName: propName,
15914 mutationMethod: null,
15915
15916 mustUseProperty: checkMask(propConfig, Injection.MUST_USE_PROPERTY),
15917 hasSideEffects: checkMask(propConfig, Injection.HAS_SIDE_EFFECTS),
15918 hasBooleanValue: checkMask(propConfig, Injection.HAS_BOOLEAN_VALUE),
15919 hasNumericValue: checkMask(propConfig, Injection.HAS_NUMERIC_VALUE),
15920 hasPositiveNumericValue: checkMask(propConfig, Injection.HAS_POSITIVE_NUMERIC_VALUE),
15921 hasOverloadedBooleanValue: checkMask(propConfig, Injection.HAS_OVERLOADED_BOOLEAN_VALUE)
15922 };
15923
15924 !(propertyInfo.mustUseProperty || !propertyInfo.hasSideEffects) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'DOMProperty: Properties that have side effects must use property: %s', propName) : invariant(false) : void 0;
15925 !(propertyInfo.hasBooleanValue + propertyInfo.hasNumericValue + propertyInfo.hasOverloadedBooleanValue <= 1) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'DOMProperty: Value can be one of boolean, overloaded boolean, or ' + 'numeric value, but not a combination: %s', propName) : invariant(false) : void 0;
15926
15927 if (process.env.NODE_ENV !== 'production') {
15928 DOMProperty.getPossibleStandardName[lowerCased] = propName;
15929 }
15930
15931 if (DOMAttributeNames.hasOwnProperty(propName)) {
15932 var attributeName = DOMAttributeNames[propName];
15933 propertyInfo.attributeName = attributeName;
15934 if (process.env.NODE_ENV !== 'production') {
15935 DOMProperty.getPossibleStandardName[attributeName] = propName;
15936 }
15937 }
15938
15939 if (DOMAttributeNamespaces.hasOwnProperty(propName)) {
15940 propertyInfo.attributeNamespace = DOMAttributeNamespaces[propName];
15941 }
15942
15943 if (DOMPropertyNames.hasOwnProperty(propName)) {
15944 propertyInfo.propertyName = DOMPropertyNames[propName];
15945 }
15946
15947 if (DOMMutationMethods.hasOwnProperty(propName)) {
15948 propertyInfo.mutationMethod = DOMMutationMethods[propName];
15949 }
15950
15951 DOMProperty.properties[propName] = propertyInfo;
15952 }
15953 }
15954};
15955
15956/* eslint-disable max-len */
15957var ATTRIBUTE_NAME_START_CHAR = ':A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD';
15958/* eslint-enable max-len */
15959
15960/**
15961 * DOMProperty exports lookup objects that can be used like functions:
15962 *
15963 * > DOMProperty.isValid['id']
15964 * true
15965 * > DOMProperty.isValid['foobar']
15966 * undefined
15967 *
15968 * Although this may be confusing, it performs better in general.
15969 *
15970 * @see http://jsperf.com/key-exists
15971 * @see http://jsperf.com/key-missing
15972 */
15973var DOMProperty = {
15974
15975 ID_ATTRIBUTE_NAME: 'data-reactid',
15976 ROOT_ATTRIBUTE_NAME: 'data-reactroot',
15977
15978 ATTRIBUTE_NAME_START_CHAR: ATTRIBUTE_NAME_START_CHAR,
15979 ATTRIBUTE_NAME_CHAR: ATTRIBUTE_NAME_START_CHAR + '\\-.0-9\\uB7\\u0300-\\u036F\\u203F-\\u2040',
15980
15981 /**
15982 * Map from property "standard name" to an object with info about how to set
15983 * the property in the DOM. Each object contains:
15984 *
15985 * attributeName:
15986 * Used when rendering markup or with `*Attribute()`.
15987 * attributeNamespace
15988 * propertyName:
15989 * Used on DOM node instances. (This includes properties that mutate due to
15990 * external factors.)
15991 * mutationMethod:
15992 * If non-null, used instead of the property or `setAttribute()` after
15993 * initial render.
15994 * mustUseProperty:
15995 * Whether the property must be accessed and mutated as an object property.
15996 * hasSideEffects:
15997 * Whether or not setting a value causes side effects such as triggering
15998 * resources to be loaded or text selection changes. If true, we read from
15999 * the DOM before updating to ensure that the value is only set if it has
16000 * changed.
16001 * hasBooleanValue:
16002 * Whether the property should be removed when set to a falsey value.
16003 * hasNumericValue:
16004 * Whether the property must be numeric or parse as a numeric and should be
16005 * removed when set to a falsey value.
16006 * hasPositiveNumericValue:
16007 * Whether the property must be positive numeric or parse as a positive
16008 * numeric and should be removed when set to a falsey value.
16009 * hasOverloadedBooleanValue:
16010 * Whether the property can be used as a flag as well as with a value.
16011 * Removed when strictly equal to false; present without a value when
16012 * strictly equal to true; present with a value otherwise.
16013 */
16014 properties: {},
16015
16016 /**
16017 * Mapping from lowercase property names to the properly cased version, used
16018 * to warn in the case of missing properties. Available only in __DEV__.
16019 * @type {Object}
16020 */
16021 getPossibleStandardName: process.env.NODE_ENV !== 'production' ? {} : null,
16022
16023 /**
16024 * All of the isCustomAttribute() functions that have been injected.
16025 */
16026 _isCustomAttributeFunctions: [],
16027
16028 /**
16029 * Checks whether a property name is a custom attribute.
16030 * @method
16031 */
16032 isCustomAttribute: function (attributeName) {
16033 for (var i = 0; i < DOMProperty._isCustomAttributeFunctions.length; i++) {
16034 var isCustomAttributeFn = DOMProperty._isCustomAttributeFunctions[i];
16035 if (isCustomAttributeFn(attributeName)) {
16036 return true;
16037 }
16038 }
16039 return false;
16040 },
16041
16042 injection: DOMPropertyInjection
16043};
16044
16045module.exports = DOMProperty;
16046}).call(this,require(91))
16047},{"45":45,"91":91}],169:[function(require,module,exports){
16048(function (process){
16049/**
16050 * Copyright 2013-present, Facebook, Inc.
16051 * All rights reserved.
16052 *
16053 * This source code is licensed under the BSD-style license found in the
16054 * LICENSE file in the root directory of this source tree. An additional grant
16055 * of patent rights can be found in the PATENTS file in the same directory.
16056 *
16057 * @providesModule DOMPropertyOperations
16058 */
16059
16060'use strict';
16061
16062var DOMProperty = require(168);
16063var ReactDOMComponentTree = require(199);
16064var ReactDOMInstrumentation = require(207);
16065var ReactInstrumentation = require(228);
16066
16067var quoteAttributeValueForBrowser = require(289);
16068var warning = require(55);
16069
16070var VALID_ATTRIBUTE_NAME_REGEX = new RegExp('^[' + DOMProperty.ATTRIBUTE_NAME_START_CHAR + '][' + DOMProperty.ATTRIBUTE_NAME_CHAR + ']*$');
16071var illegalAttributeNameCache = {};
16072var validatedAttributeNameCache = {};
16073
16074function isAttributeNameSafe(attributeName) {
16075 if (validatedAttributeNameCache.hasOwnProperty(attributeName)) {
16076 return true;
16077 }
16078 if (illegalAttributeNameCache.hasOwnProperty(attributeName)) {
16079 return false;
16080 }
16081 if (VALID_ATTRIBUTE_NAME_REGEX.test(attributeName)) {
16082 validatedAttributeNameCache[attributeName] = true;
16083 return true;
16084 }
16085 illegalAttributeNameCache[attributeName] = true;
16086 process.env.NODE_ENV !== 'production' ? warning(false, 'Invalid attribute name: `%s`', attributeName) : void 0;
16087 return false;
16088}
16089
16090function shouldIgnoreValue(propertyInfo, value) {
16091 return value == null || propertyInfo.hasBooleanValue && !value || propertyInfo.hasNumericValue && isNaN(value) || propertyInfo.hasPositiveNumericValue && value < 1 || propertyInfo.hasOverloadedBooleanValue && value === false;
16092}
16093
16094/**
16095 * Operations for dealing with DOM properties.
16096 */
16097var DOMPropertyOperations = {
16098
16099 /**
16100 * Creates markup for the ID property.
16101 *
16102 * @param {string} id Unescaped ID.
16103 * @return {string} Markup string.
16104 */
16105 createMarkupForID: function (id) {
16106 return DOMProperty.ID_ATTRIBUTE_NAME + '=' + quoteAttributeValueForBrowser(id);
16107 },
16108
16109 setAttributeForID: function (node, id) {
16110 node.setAttribute(DOMProperty.ID_ATTRIBUTE_NAME, id);
16111 },
16112
16113 createMarkupForRoot: function () {
16114 return DOMProperty.ROOT_ATTRIBUTE_NAME + '=""';
16115 },
16116
16117 setAttributeForRoot: function (node) {
16118 node.setAttribute(DOMProperty.ROOT_ATTRIBUTE_NAME, '');
16119 },
16120
16121 /**
16122 * Creates markup for a property.
16123 *
16124 * @param {string} name
16125 * @param {*} value
16126 * @return {?string} Markup string, or null if the property was invalid.
16127 */
16128 createMarkupForProperty: function (name, value) {
16129 if (process.env.NODE_ENV !== 'production') {
16130 ReactDOMInstrumentation.debugTool.onCreateMarkupForProperty(name, value);
16131 }
16132 var propertyInfo = DOMProperty.properties.hasOwnProperty(name) ? DOMProperty.properties[name] : null;
16133 if (propertyInfo) {
16134 if (shouldIgnoreValue(propertyInfo, value)) {
16135 return '';
16136 }
16137 var attributeName = propertyInfo.attributeName;
16138 if (propertyInfo.hasBooleanValue || propertyInfo.hasOverloadedBooleanValue && value === true) {
16139 return attributeName + '=""';
16140 }
16141 return attributeName + '=' + quoteAttributeValueForBrowser(value);
16142 } else if (DOMProperty.isCustomAttribute(name)) {
16143 if (value == null) {
16144 return '';
16145 }
16146 return name + '=' + quoteAttributeValueForBrowser(value);
16147 }
16148 return null;
16149 },
16150
16151 /**
16152 * Creates markup for a custom property.
16153 *
16154 * @param {string} name
16155 * @param {*} value
16156 * @return {string} Markup string, or empty string if the property was invalid.
16157 */
16158 createMarkupForCustomAttribute: function (name, value) {
16159 if (!isAttributeNameSafe(name) || value == null) {
16160 return '';
16161 }
16162 return name + '=' + quoteAttributeValueForBrowser(value);
16163 },
16164
16165 /**
16166 * Sets the value for a property on a node.
16167 *
16168 * @param {DOMElement} node
16169 * @param {string} name
16170 * @param {*} value
16171 */
16172 setValueForProperty: function (node, name, value) {
16173 var propertyInfo = DOMProperty.properties.hasOwnProperty(name) ? DOMProperty.properties[name] : null;
16174 if (propertyInfo) {
16175 var mutationMethod = propertyInfo.mutationMethod;
16176 if (mutationMethod) {
16177 mutationMethod(node, value);
16178 } else if (shouldIgnoreValue(propertyInfo, value)) {
16179 this.deleteValueForProperty(node, name);
16180 return;
16181 } else if (propertyInfo.mustUseProperty) {
16182 var propName = propertyInfo.propertyName;
16183 // Must explicitly cast values for HAS_SIDE_EFFECTS-properties to the
16184 // property type before comparing; only `value` does and is string.
16185 if (!propertyInfo.hasSideEffects || '' + node[propName] !== '' + value) {
16186 // Contrary to `setAttribute`, object properties are properly
16187 // `toString`ed by IE8/9.
16188 node[propName] = value;
16189 }
16190 } else {
16191 var attributeName = propertyInfo.attributeName;
16192 var namespace = propertyInfo.attributeNamespace;
16193 // `setAttribute` with objects becomes only `[object]` in IE8/9,
16194 // ('' + value) makes it output the correct toString()-value.
16195 if (namespace) {
16196 node.setAttributeNS(namespace, attributeName, '' + value);
16197 } else if (propertyInfo.hasBooleanValue || propertyInfo.hasOverloadedBooleanValue && value === true) {
16198 node.setAttribute(attributeName, '');
16199 } else {
16200 node.setAttribute(attributeName, '' + value);
16201 }
16202 }
16203 } else if (DOMProperty.isCustomAttribute(name)) {
16204 DOMPropertyOperations.setValueForAttribute(node, name, value);
16205 return;
16206 }
16207
16208 if (process.env.NODE_ENV !== 'production') {
16209 ReactDOMInstrumentation.debugTool.onSetValueForProperty(node, name, value);
16210 var payload = {};
16211 payload[name] = value;
16212 ReactInstrumentation.debugTool.onNativeOperation(ReactDOMComponentTree.getInstanceFromNode(node)._debugID, 'update attribute', payload);
16213 }
16214 },
16215
16216 setValueForAttribute: function (node, name, value) {
16217 if (!isAttributeNameSafe(name)) {
16218 return;
16219 }
16220 if (value == null) {
16221 node.removeAttribute(name);
16222 } else {
16223 node.setAttribute(name, '' + value);
16224 }
16225
16226 if (process.env.NODE_ENV !== 'production') {
16227 var payload = {};
16228 payload[name] = value;
16229 ReactInstrumentation.debugTool.onNativeOperation(ReactDOMComponentTree.getInstanceFromNode(node)._debugID, 'update attribute', payload);
16230 }
16231 },
16232
16233 /**
16234 * Deletes the value for a property on a node.
16235 *
16236 * @param {DOMElement} node
16237 * @param {string} name
16238 */
16239 deleteValueForProperty: function (node, name) {
16240 var propertyInfo = DOMProperty.properties.hasOwnProperty(name) ? DOMProperty.properties[name] : null;
16241 if (propertyInfo) {
16242 var mutationMethod = propertyInfo.mutationMethod;
16243 if (mutationMethod) {
16244 mutationMethod(node, undefined);
16245 } else if (propertyInfo.mustUseProperty) {
16246 var propName = propertyInfo.propertyName;
16247 if (propertyInfo.hasBooleanValue) {
16248 // No HAS_SIDE_EFFECTS logic here, only `value` has it and is string.
16249 node[propName] = false;
16250 } else {
16251 if (!propertyInfo.hasSideEffects || '' + node[propName] !== '') {
16252 node[propName] = '';
16253 }
16254 }
16255 } else {
16256 node.removeAttribute(propertyInfo.attributeName);
16257 }
16258 } else if (DOMProperty.isCustomAttribute(name)) {
16259 node.removeAttribute(name);
16260 }
16261
16262 if (process.env.NODE_ENV !== 'production') {
16263 ReactDOMInstrumentation.debugTool.onDeleteValueForProperty(node, name);
16264 ReactInstrumentation.debugTool.onNativeOperation(ReactDOMComponentTree.getInstanceFromNode(node)._debugID, 'remove attribute', name);
16265 }
16266 }
16267
16268};
16269
16270module.exports = DOMPropertyOperations;
16271}).call(this,require(91))
16272},{"168":168,"199":199,"207":207,"228":228,"289":289,"55":55,"91":91}],170:[function(require,module,exports){
16273(function (process){
16274/**
16275 * Copyright 2013-present, Facebook, Inc.
16276 * All rights reserved.
16277 *
16278 * This source code is licensed under the BSD-style license found in the
16279 * LICENSE file in the root directory of this source tree. An additional grant
16280 * of patent rights can be found in the PATENTS file in the same directory.
16281 *
16282 * @providesModule Danger
16283 */
16284
16285'use strict';
16286
16287var DOMLazyTree = require(166);
16288var ExecutionEnvironment = require(31);
16289
16290var createNodesFromMarkup = require(36);
16291var emptyFunction = require(37);
16292var getMarkupWrap = require(41);
16293var invariant = require(45);
16294
16295var OPEN_TAG_NAME_EXP = /^(<[^ \/>]+)/;
16296var RESULT_INDEX_ATTR = 'data-danger-index';
16297
16298/**
16299 * Extracts the `nodeName` from a string of markup.
16300 *
16301 * NOTE: Extracting the `nodeName` does not require a regular expression match
16302 * because we make assumptions about React-generated markup (i.e. there are no
16303 * spaces surrounding the opening tag and there is at least one attribute).
16304 *
16305 * @param {string} markup String of markup.
16306 * @return {string} Node name of the supplied markup.
16307 * @see http://jsperf.com/extract-nodename
16308 */
16309function getNodeName(markup) {
16310 return markup.substring(1, markup.indexOf(' '));
16311}
16312
16313var Danger = {
16314
16315 /**
16316 * Renders markup into an array of nodes. The markup is expected to render
16317 * into a list of root nodes. Also, the length of `resultList` and
16318 * `markupList` should be the same.
16319 *
16320 * @param {array<string>} markupList List of markup strings to render.
16321 * @return {array<DOMElement>} List of rendered nodes.
16322 * @internal
16323 */
16324 dangerouslyRenderMarkup: function (markupList) {
16325 !ExecutionEnvironment.canUseDOM ? process.env.NODE_ENV !== 'production' ? invariant(false, 'dangerouslyRenderMarkup(...): Cannot render markup in a worker ' + 'thread. Make sure `window` and `document` are available globally ' + 'before requiring React when unit testing or use ' + 'ReactDOMServer.renderToString for server rendering.') : invariant(false) : void 0;
16326 var nodeName;
16327 var markupByNodeName = {};
16328 // Group markup by `nodeName` if a wrap is necessary, else by '*'.
16329 for (var i = 0; i < markupList.length; i++) {
16330 !markupList[i] ? process.env.NODE_ENV !== 'production' ? invariant(false, 'dangerouslyRenderMarkup(...): Missing markup.') : invariant(false) : void 0;
16331 nodeName = getNodeName(markupList[i]);
16332 nodeName = getMarkupWrap(nodeName) ? nodeName : '*';
16333 markupByNodeName[nodeName] = markupByNodeName[nodeName] || [];
16334 markupByNodeName[nodeName][i] = markupList[i];
16335 }
16336 var resultList = [];
16337 var resultListAssignmentCount = 0;
16338 for (nodeName in markupByNodeName) {
16339 if (!markupByNodeName.hasOwnProperty(nodeName)) {
16340 continue;
16341 }
16342 var markupListByNodeName = markupByNodeName[nodeName];
16343
16344 // This for-in loop skips the holes of the sparse array. The order of
16345 // iteration should follow the order of assignment, which happens to match
16346 // numerical index order, but we don't rely on that.
16347 var resultIndex;
16348 for (resultIndex in markupListByNodeName) {
16349 if (markupListByNodeName.hasOwnProperty(resultIndex)) {
16350 var markup = markupListByNodeName[resultIndex];
16351
16352 // Push the requested markup with an additional RESULT_INDEX_ATTR
16353 // attribute. If the markup does not start with a < character, it
16354 // will be discarded below (with an appropriate console.error).
16355 markupListByNodeName[resultIndex] = markup.replace(OPEN_TAG_NAME_EXP,
16356 // This index will be parsed back out below.
16357 '$1 ' + RESULT_INDEX_ATTR + '="' + resultIndex + '" ');
16358 }
16359 }
16360
16361 // Render each group of markup with similar wrapping `nodeName`.
16362 var renderNodes = createNodesFromMarkup(markupListByNodeName.join(''), emptyFunction // Do nothing special with <script> tags.
16363 );
16364
16365 for (var j = 0; j < renderNodes.length; ++j) {
16366 var renderNode = renderNodes[j];
16367 if (renderNode.hasAttribute && renderNode.hasAttribute(RESULT_INDEX_ATTR)) {
16368
16369 resultIndex = +renderNode.getAttribute(RESULT_INDEX_ATTR);
16370 renderNode.removeAttribute(RESULT_INDEX_ATTR);
16371
16372 !!resultList.hasOwnProperty(resultIndex) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Danger: Assigning to an already-occupied result index.') : invariant(false) : void 0;
16373
16374 resultList[resultIndex] = renderNode;
16375
16376 // This should match resultList.length and markupList.length when
16377 // we're done.
16378 resultListAssignmentCount += 1;
16379 } else if (process.env.NODE_ENV !== 'production') {
16380 console.error('Danger: Discarding unexpected node:', renderNode);
16381 }
16382 }
16383 }
16384
16385 // Although resultList was populated out of order, it should now be a dense
16386 // array.
16387 !(resultListAssignmentCount === resultList.length) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Danger: Did not assign to every index of resultList.') : invariant(false) : void 0;
16388
16389 !(resultList.length === markupList.length) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Danger: Expected markup to render %s nodes, but rendered %s.', markupList.length, resultList.length) : invariant(false) : void 0;
16390
16391 return resultList;
16392 },
16393
16394 /**
16395 * Replaces a node with a string of markup at its current position within its
16396 * parent. The markup must render into a single root node.
16397 *
16398 * @param {DOMElement} oldChild Child node to replace.
16399 * @param {string} markup Markup to render in place of the child node.
16400 * @internal
16401 */
16402 dangerouslyReplaceNodeWithMarkup: function (oldChild, markup) {
16403 !ExecutionEnvironment.canUseDOM ? process.env.NODE_ENV !== 'production' ? invariant(false, 'dangerouslyReplaceNodeWithMarkup(...): Cannot render markup in a ' + 'worker thread. Make sure `window` and `document` are available ' + 'globally before requiring React when unit testing or use ' + 'ReactDOMServer.renderToString() for server rendering.') : invariant(false) : void 0;
16404 !markup ? process.env.NODE_ENV !== 'production' ? invariant(false, 'dangerouslyReplaceNodeWithMarkup(...): Missing markup.') : invariant(false) : void 0;
16405 !(oldChild.nodeName !== 'HTML') ? process.env.NODE_ENV !== 'production' ? invariant(false, 'dangerouslyReplaceNodeWithMarkup(...): Cannot replace markup of the ' + '<html> node. This is because browser quirks make this unreliable ' + 'and/or slow. If you want to render to the root you must use ' + 'server rendering. See ReactDOMServer.renderToString().') : invariant(false) : void 0;
16406
16407 if (typeof markup === 'string') {
16408 var newChild = createNodesFromMarkup(markup, emptyFunction)[0];
16409 oldChild.parentNode.replaceChild(newChild, oldChild);
16410 } else {
16411 DOMLazyTree.replaceChildWithTree(oldChild, markup);
16412 }
16413 }
16414
16415};
16416
16417module.exports = Danger;
16418}).call(this,require(91))
16419},{"166":166,"31":31,"36":36,"37":37,"41":41,"45":45,"91":91}],171:[function(require,module,exports){
16420/**
16421 * Copyright 2013-present, Facebook, Inc.
16422 * All rights reserved.
16423 *
16424 * This source code is licensed under the BSD-style license found in the
16425 * LICENSE file in the root directory of this source tree. An additional grant
16426 * of patent rights can be found in the PATENTS file in the same directory.
16427 *
16428 * @providesModule DefaultEventPluginOrder
16429 */
16430
16431'use strict';
16432
16433var keyOf = require(49);
16434
16435/**
16436 * Module that is injectable into `EventPluginHub`, that specifies a
16437 * deterministic ordering of `EventPlugin`s. A convenient way to reason about
16438 * plugins, without having to package every one of them. This is better than
16439 * having plugins be ordered in the same order that they are injected because
16440 * that ordering would be influenced by the packaging order.
16441 * `ResponderEventPlugin` must occur before `SimpleEventPlugin` so that
16442 * preventing default on events is convenient in `SimpleEventPlugin` handlers.
16443 */
16444var DefaultEventPluginOrder = [keyOf({ ResponderEventPlugin: null }), keyOf({ SimpleEventPlugin: null }), keyOf({ TapEventPlugin: null }), keyOf({ EnterLeaveEventPlugin: null }), keyOf({ ChangeEventPlugin: null }), keyOf({ SelectEventPlugin: null }), keyOf({ BeforeInputEventPlugin: null })];
16445
16446module.exports = DefaultEventPluginOrder;
16447},{"49":49}],172:[function(require,module,exports){
16448/**
16449 * Copyright 2013-present, Facebook, Inc.
16450 * All rights reserved.
16451 *
16452 * This source code is licensed under the BSD-style license found in the
16453 * LICENSE file in the root directory of this source tree. An additional grant
16454 * of patent rights can be found in the PATENTS file in the same directory.
16455 *
16456 * @providesModule DisabledInputUtils
16457 */
16458
16459'use strict';
16460
16461var disableableMouseListenerNames = {
16462 onClick: true,
16463 onDoubleClick: true,
16464 onMouseDown: true,
16465 onMouseMove: true,
16466 onMouseUp: true,
16467
16468 onClickCapture: true,
16469 onDoubleClickCapture: true,
16470 onMouseDownCapture: true,
16471 onMouseMoveCapture: true,
16472 onMouseUpCapture: true
16473};
16474
16475/**
16476 * Implements a native component that does not receive mouse events
16477 * when `disabled` is set.
16478 */
16479var DisabledInputUtils = {
16480 getNativeProps: function (inst, props) {
16481 if (!props.disabled) {
16482 return props;
16483 }
16484
16485 // Copy the props, except the mouse listeners
16486 var nativeProps = {};
16487 for (var key in props) {
16488 if (!disableableMouseListenerNames[key] && props.hasOwnProperty(key)) {
16489 nativeProps[key] = props[key];
16490 }
16491 }
16492
16493 return nativeProps;
16494 }
16495};
16496
16497module.exports = DisabledInputUtils;
16498},{}],173:[function(require,module,exports){
16499/**
16500 * Copyright 2013-present, Facebook, Inc.
16501 * All rights reserved.
16502 *
16503 * This source code is licensed under the BSD-style license found in the
16504 * LICENSE file in the root directory of this source tree. An additional grant
16505 * of patent rights can be found in the PATENTS file in the same directory.
16506 *
16507 * @providesModule EnterLeaveEventPlugin
16508 */
16509
16510'use strict';
16511
16512var EventConstants = require(174);
16513var EventPropagators = require(178);
16514var ReactDOMComponentTree = require(199);
16515var SyntheticMouseEvent = require(260);
16516
16517var keyOf = require(49);
16518
16519var topLevelTypes = EventConstants.topLevelTypes;
16520
16521var eventTypes = {
16522 mouseEnter: {
16523 registrationName: keyOf({ onMouseEnter: null }),
16524 dependencies: [topLevelTypes.topMouseOut, topLevelTypes.topMouseOver]
16525 },
16526 mouseLeave: {
16527 registrationName: keyOf({ onMouseLeave: null }),
16528 dependencies: [topLevelTypes.topMouseOut, topLevelTypes.topMouseOver]
16529 }
16530};
16531
16532var EnterLeaveEventPlugin = {
16533
16534 eventTypes: eventTypes,
16535
16536 /**
16537 * For almost every interaction we care about, there will be both a top-level
16538 * `mouseover` and `mouseout` event that occurs. Only use `mouseout` so that
16539 * we do not extract duplicate events. However, moving the mouse into the
16540 * browser from outside will not fire a `mouseout` event. In this case, we use
16541 * the `mouseover` top-level event.
16542 */
16543 extractEvents: function (topLevelType, targetInst, nativeEvent, nativeEventTarget) {
16544 if (topLevelType === topLevelTypes.topMouseOver && (nativeEvent.relatedTarget || nativeEvent.fromElement)) {
16545 return null;
16546 }
16547 if (topLevelType !== topLevelTypes.topMouseOut && topLevelType !== topLevelTypes.topMouseOver) {
16548 // Must not be a mouse in or mouse out - ignoring.
16549 return null;
16550 }
16551
16552 var win;
16553 if (nativeEventTarget.window === nativeEventTarget) {
16554 // `nativeEventTarget` is probably a window object.
16555 win = nativeEventTarget;
16556 } else {
16557 // TODO: Figure out why `ownerDocument` is sometimes undefined in IE8.
16558 var doc = nativeEventTarget.ownerDocument;
16559 if (doc) {
16560 win = doc.defaultView || doc.parentWindow;
16561 } else {
16562 win = window;
16563 }
16564 }
16565
16566 var from;
16567 var to;
16568 if (topLevelType === topLevelTypes.topMouseOut) {
16569 from = targetInst;
16570 var related = nativeEvent.relatedTarget || nativeEvent.toElement;
16571 to = related ? ReactDOMComponentTree.getClosestInstanceFromNode(related) : null;
16572 } else {
16573 // Moving to a node from outside the window.
16574 from = null;
16575 to = targetInst;
16576 }
16577
16578 if (from === to) {
16579 // Nothing pertains to our managed components.
16580 return null;
16581 }
16582
16583 var fromNode = from == null ? win : ReactDOMComponentTree.getNodeFromInstance(from);
16584 var toNode = to == null ? win : ReactDOMComponentTree.getNodeFromInstance(to);
16585
16586 var leave = SyntheticMouseEvent.getPooled(eventTypes.mouseLeave, from, nativeEvent, nativeEventTarget);
16587 leave.type = 'mouseleave';
16588 leave.target = fromNode;
16589 leave.relatedTarget = toNode;
16590
16591 var enter = SyntheticMouseEvent.getPooled(eventTypes.mouseEnter, to, nativeEvent, nativeEventTarget);
16592 enter.type = 'mouseenter';
16593 enter.target = toNode;
16594 enter.relatedTarget = fromNode;
16595
16596 EventPropagators.accumulateEnterLeaveDispatches(leave, enter, from, to);
16597
16598 return [leave, enter];
16599 }
16600
16601};
16602
16603module.exports = EnterLeaveEventPlugin;
16604},{"174":174,"178":178,"199":199,"260":260,"49":49}],174:[function(require,module,exports){
16605/**
16606 * Copyright 2013-present, Facebook, Inc.
16607 * All rights reserved.
16608 *
16609 * This source code is licensed under the BSD-style license found in the
16610 * LICENSE file in the root directory of this source tree. An additional grant
16611 * of patent rights can be found in the PATENTS file in the same directory.
16612 *
16613 * @providesModule EventConstants
16614 */
16615
16616'use strict';
16617
16618var keyMirror = require(48);
16619
16620var PropagationPhases = keyMirror({ bubbled: null, captured: null });
16621
16622/**
16623 * Types of raw signals from the browser caught at the top level.
16624 */
16625var topLevelTypes = keyMirror({
16626 topAbort: null,
16627 topAnimationEnd: null,
16628 topAnimationIteration: null,
16629 topAnimationStart: null,
16630 topBlur: null,
16631 topCanPlay: null,
16632 topCanPlayThrough: null,
16633 topChange: null,
16634 topClick: null,
16635 topCompositionEnd: null,
16636 topCompositionStart: null,
16637 topCompositionUpdate: null,
16638 topContextMenu: null,
16639 topCopy: null,
16640 topCut: null,
16641 topDoubleClick: null,
16642 topDrag: null,
16643 topDragEnd: null,
16644 topDragEnter: null,
16645 topDragExit: null,
16646 topDragLeave: null,
16647 topDragOver: null,
16648 topDragStart: null,
16649 topDrop: null,
16650 topDurationChange: null,
16651 topEmptied: null,
16652 topEncrypted: null,
16653 topEnded: null,
16654 topError: null,
16655 topFocus: null,
16656 topInput: null,
16657 topInvalid: null,
16658 topKeyDown: null,
16659 topKeyPress: null,
16660 topKeyUp: null,
16661 topLoad: null,
16662 topLoadedData: null,
16663 topLoadedMetadata: null,
16664 topLoadStart: null,
16665 topMouseDown: null,
16666 topMouseMove: null,
16667 topMouseOut: null,
16668 topMouseOver: null,
16669 topMouseUp: null,
16670 topPaste: null,
16671 topPause: null,
16672 topPlay: null,
16673 topPlaying: null,
16674 topProgress: null,
16675 topRateChange: null,
16676 topReset: null,
16677 topScroll: null,
16678 topSeeked: null,
16679 topSeeking: null,
16680 topSelectionChange: null,
16681 topStalled: null,
16682 topSubmit: null,
16683 topSuspend: null,
16684 topTextInput: null,
16685 topTimeUpdate: null,
16686 topTouchCancel: null,
16687 topTouchEnd: null,
16688 topTouchMove: null,
16689 topTouchStart: null,
16690 topTransitionEnd: null,
16691 topVolumeChange: null,
16692 topWaiting: null,
16693 topWheel: null
16694});
16695
16696var EventConstants = {
16697 topLevelTypes: topLevelTypes,
16698 PropagationPhases: PropagationPhases
16699};
16700
16701module.exports = EventConstants;
16702},{"48":48}],175:[function(require,module,exports){
16703(function (process){
16704/**
16705 * Copyright 2013-present, Facebook, Inc.
16706 * All rights reserved.
16707 *
16708 * This source code is licensed under the BSD-style license found in the
16709 * LICENSE file in the root directory of this source tree. An additional grant
16710 * of patent rights can be found in the PATENTS file in the same directory.
16711 *
16712 * @providesModule EventPluginHub
16713 */
16714
16715'use strict';
16716
16717var EventPluginRegistry = require(176);
16718var EventPluginUtils = require(177);
16719var ReactErrorUtils = require(221);
16720
16721var accumulateInto = require(267);
16722var forEachAccumulated = require(275);
16723var invariant = require(45);
16724
16725/**
16726 * Internal store for event listeners
16727 */
16728var listenerBank = {};
16729
16730/**
16731 * Internal queue of events that have accumulated their dispatches and are
16732 * waiting to have their dispatches executed.
16733 */
16734var eventQueue = null;
16735
16736/**
16737 * Dispatches an event and releases it back into the pool, unless persistent.
16738 *
16739 * @param {?object} event Synthetic event to be dispatched.
16740 * @param {boolean} simulated If the event is simulated (changes exn behavior)
16741 * @private
16742 */
16743var executeDispatchesAndRelease = function (event, simulated) {
16744 if (event) {
16745 EventPluginUtils.executeDispatchesInOrder(event, simulated);
16746
16747 if (!event.isPersistent()) {
16748 event.constructor.release(event);
16749 }
16750 }
16751};
16752var executeDispatchesAndReleaseSimulated = function (e) {
16753 return executeDispatchesAndRelease(e, true);
16754};
16755var executeDispatchesAndReleaseTopLevel = function (e) {
16756 return executeDispatchesAndRelease(e, false);
16757};
16758
16759/**
16760 * This is a unified interface for event plugins to be installed and configured.
16761 *
16762 * Event plugins can implement the following properties:
16763 *
16764 * `extractEvents` {function(string, DOMEventTarget, string, object): *}
16765 * Required. When a top-level event is fired, this method is expected to
16766 * extract synthetic events that will in turn be queued and dispatched.
16767 *
16768 * `eventTypes` {object}
16769 * Optional, plugins that fire events must publish a mapping of registration
16770 * names that are used to register listeners. Values of this mapping must
16771 * be objects that contain `registrationName` or `phasedRegistrationNames`.
16772 *
16773 * `executeDispatch` {function(object, function, string)}
16774 * Optional, allows plugins to override how an event gets dispatched. By
16775 * default, the listener is simply invoked.
16776 *
16777 * Each plugin that is injected into `EventsPluginHub` is immediately operable.
16778 *
16779 * @public
16780 */
16781var EventPluginHub = {
16782
16783 /**
16784 * Methods for injecting dependencies.
16785 */
16786 injection: {
16787
16788 /**
16789 * @param {array} InjectedEventPluginOrder
16790 * @public
16791 */
16792 injectEventPluginOrder: EventPluginRegistry.injectEventPluginOrder,
16793
16794 /**
16795 * @param {object} injectedNamesToPlugins Map from names to plugin modules.
16796 */
16797 injectEventPluginsByName: EventPluginRegistry.injectEventPluginsByName
16798
16799 },
16800
16801 /**
16802 * Stores `listener` at `listenerBank[registrationName][id]`. Is idempotent.
16803 *
16804 * @param {object} inst The instance, which is the source of events.
16805 * @param {string} registrationName Name of listener (e.g. `onClick`).
16806 * @param {function} listener The callback to store.
16807 */
16808 putListener: function (inst, registrationName, listener) {
16809 !(typeof listener === 'function') ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Expected %s listener to be a function, instead got type %s', registrationName, typeof listener) : invariant(false) : void 0;
16810
16811 var bankForRegistrationName = listenerBank[registrationName] || (listenerBank[registrationName] = {});
16812 bankForRegistrationName[inst._rootNodeID] = listener;
16813
16814 var PluginModule = EventPluginRegistry.registrationNameModules[registrationName];
16815 if (PluginModule && PluginModule.didPutListener) {
16816 PluginModule.didPutListener(inst, registrationName, listener);
16817 }
16818 },
16819
16820 /**
16821 * @param {object} inst The instance, which is the source of events.
16822 * @param {string} registrationName Name of listener (e.g. `onClick`).
16823 * @return {?function} The stored callback.
16824 */
16825 getListener: function (inst, registrationName) {
16826 var bankForRegistrationName = listenerBank[registrationName];
16827 return bankForRegistrationName && bankForRegistrationName[inst._rootNodeID];
16828 },
16829
16830 /**
16831 * Deletes a listener from the registration bank.
16832 *
16833 * @param {object} inst The instance, which is the source of events.
16834 * @param {string} registrationName Name of listener (e.g. `onClick`).
16835 */
16836 deleteListener: function (inst, registrationName) {
16837 var PluginModule = EventPluginRegistry.registrationNameModules[registrationName];
16838 if (PluginModule && PluginModule.willDeleteListener) {
16839 PluginModule.willDeleteListener(inst, registrationName);
16840 }
16841
16842 var bankForRegistrationName = listenerBank[registrationName];
16843 // TODO: This should never be null -- when is it?
16844 if (bankForRegistrationName) {
16845 delete bankForRegistrationName[inst._rootNodeID];
16846 }
16847 },
16848
16849 /**
16850 * Deletes all listeners for the DOM element with the supplied ID.
16851 *
16852 * @param {object} inst The instance, which is the source of events.
16853 */
16854 deleteAllListeners: function (inst) {
16855 for (var registrationName in listenerBank) {
16856 if (!listenerBank[registrationName][inst._rootNodeID]) {
16857 continue;
16858 }
16859
16860 var PluginModule = EventPluginRegistry.registrationNameModules[registrationName];
16861 if (PluginModule && PluginModule.willDeleteListener) {
16862 PluginModule.willDeleteListener(inst, registrationName);
16863 }
16864
16865 delete listenerBank[registrationName][inst._rootNodeID];
16866 }
16867 },
16868
16869 /**
16870 * Allows registered plugins an opportunity to extract events from top-level
16871 * native browser events.
16872 *
16873 * @return {*} An accumulation of synthetic events.
16874 * @internal
16875 */
16876 extractEvents: function (topLevelType, targetInst, nativeEvent, nativeEventTarget) {
16877 var events;
16878 var plugins = EventPluginRegistry.plugins;
16879 for (var i = 0; i < plugins.length; i++) {
16880 // Not every plugin in the ordering may be loaded at runtime.
16881 var possiblePlugin = plugins[i];
16882 if (possiblePlugin) {
16883 var extractedEvents = possiblePlugin.extractEvents(topLevelType, targetInst, nativeEvent, nativeEventTarget);
16884 if (extractedEvents) {
16885 events = accumulateInto(events, extractedEvents);
16886 }
16887 }
16888 }
16889 return events;
16890 },
16891
16892 /**
16893 * Enqueues a synthetic event that should be dispatched when
16894 * `processEventQueue` is invoked.
16895 *
16896 * @param {*} events An accumulation of synthetic events.
16897 * @internal
16898 */
16899 enqueueEvents: function (events) {
16900 if (events) {
16901 eventQueue = accumulateInto(eventQueue, events);
16902 }
16903 },
16904
16905 /**
16906 * Dispatches all synthetic events on the event queue.
16907 *
16908 * @internal
16909 */
16910 processEventQueue: function (simulated) {
16911 // Set `eventQueue` to null before processing it so that we can tell if more
16912 // events get enqueued while processing.
16913 var processingEventQueue = eventQueue;
16914 eventQueue = null;
16915 if (simulated) {
16916 forEachAccumulated(processingEventQueue, executeDispatchesAndReleaseSimulated);
16917 } else {
16918 forEachAccumulated(processingEventQueue, executeDispatchesAndReleaseTopLevel);
16919 }
16920 !!eventQueue ? process.env.NODE_ENV !== 'production' ? invariant(false, 'processEventQueue(): Additional events were enqueued while processing ' + 'an event queue. Support for this has not yet been implemented.') : invariant(false) : void 0;
16921 // This would be a good time to rethrow if any of the event handlers threw.
16922 ReactErrorUtils.rethrowCaughtError();
16923 },
16924
16925 /**
16926 * These are needed for tests only. Do not use!
16927 */
16928 __purge: function () {
16929 listenerBank = {};
16930 },
16931
16932 __getListenerBank: function () {
16933 return listenerBank;
16934 }
16935
16936};
16937
16938module.exports = EventPluginHub;
16939}).call(this,require(91))
16940},{"176":176,"177":177,"221":221,"267":267,"275":275,"45":45,"91":91}],176:[function(require,module,exports){
16941(function (process){
16942/**
16943 * Copyright 2013-present, Facebook, Inc.
16944 * All rights reserved.
16945 *
16946 * This source code is licensed under the BSD-style license found in the
16947 * LICENSE file in the root directory of this source tree. An additional grant
16948 * of patent rights can be found in the PATENTS file in the same directory.
16949 *
16950 * @providesModule EventPluginRegistry
16951 */
16952
16953'use strict';
16954
16955var invariant = require(45);
16956
16957/**
16958 * Injectable ordering of event plugins.
16959 */
16960var EventPluginOrder = null;
16961
16962/**
16963 * Injectable mapping from names to event plugin modules.
16964 */
16965var namesToPlugins = {};
16966
16967/**
16968 * Recomputes the plugin list using the injected plugins and plugin ordering.
16969 *
16970 * @private
16971 */
16972function recomputePluginOrdering() {
16973 if (!EventPluginOrder) {
16974 // Wait until an `EventPluginOrder` is injected.
16975 return;
16976 }
16977 for (var pluginName in namesToPlugins) {
16978 var PluginModule = namesToPlugins[pluginName];
16979 var pluginIndex = EventPluginOrder.indexOf(pluginName);
16980 !(pluginIndex > -1) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'EventPluginRegistry: Cannot inject event plugins that do not exist in ' + 'the plugin ordering, `%s`.', pluginName) : invariant(false) : void 0;
16981 if (EventPluginRegistry.plugins[pluginIndex]) {
16982 continue;
16983 }
16984 !PluginModule.extractEvents ? process.env.NODE_ENV !== 'production' ? invariant(false, 'EventPluginRegistry: Event plugins must implement an `extractEvents` ' + 'method, but `%s` does not.', pluginName) : invariant(false) : void 0;
16985 EventPluginRegistry.plugins[pluginIndex] = PluginModule;
16986 var publishedEvents = PluginModule.eventTypes;
16987 for (var eventName in publishedEvents) {
16988 !publishEventForPlugin(publishedEvents[eventName], PluginModule, eventName) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'EventPluginRegistry: Failed to publish event `%s` for plugin `%s`.', eventName, pluginName) : invariant(false) : void 0;
16989 }
16990 }
16991}
16992
16993/**
16994 * Publishes an event so that it can be dispatched by the supplied plugin.
16995 *
16996 * @param {object} dispatchConfig Dispatch configuration for the event.
16997 * @param {object} PluginModule Plugin publishing the event.
16998 * @return {boolean} True if the event was successfully published.
16999 * @private
17000 */
17001function publishEventForPlugin(dispatchConfig, PluginModule, eventName) {
17002 !!EventPluginRegistry.eventNameDispatchConfigs.hasOwnProperty(eventName) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'EventPluginHub: More than one plugin attempted to publish the same ' + 'event name, `%s`.', eventName) : invariant(false) : void 0;
17003 EventPluginRegistry.eventNameDispatchConfigs[eventName] = dispatchConfig;
17004
17005 var phasedRegistrationNames = dispatchConfig.phasedRegistrationNames;
17006 if (phasedRegistrationNames) {
17007 for (var phaseName in phasedRegistrationNames) {
17008 if (phasedRegistrationNames.hasOwnProperty(phaseName)) {
17009 var phasedRegistrationName = phasedRegistrationNames[phaseName];
17010 publishRegistrationName(phasedRegistrationName, PluginModule, eventName);
17011 }
17012 }
17013 return true;
17014 } else if (dispatchConfig.registrationName) {
17015 publishRegistrationName(dispatchConfig.registrationName, PluginModule, eventName);
17016 return true;
17017 }
17018 return false;
17019}
17020
17021/**
17022 * Publishes a registration name that is used to identify dispatched events and
17023 * can be used with `EventPluginHub.putListener` to register listeners.
17024 *
17025 * @param {string} registrationName Registration name to add.
17026 * @param {object} PluginModule Plugin publishing the event.
17027 * @private
17028 */
17029function publishRegistrationName(registrationName, PluginModule, eventName) {
17030 !!EventPluginRegistry.registrationNameModules[registrationName] ? process.env.NODE_ENV !== 'production' ? invariant(false, 'EventPluginHub: More than one plugin attempted to publish the same ' + 'registration name, `%s`.', registrationName) : invariant(false) : void 0;
17031 EventPluginRegistry.registrationNameModules[registrationName] = PluginModule;
17032 EventPluginRegistry.registrationNameDependencies[registrationName] = PluginModule.eventTypes[eventName].dependencies;
17033
17034 if (process.env.NODE_ENV !== 'production') {
17035 var lowerCasedName = registrationName.toLowerCase();
17036 EventPluginRegistry.possibleRegistrationNames[lowerCasedName] = registrationName;
17037 }
17038}
17039
17040/**
17041 * Registers plugins so that they can extract and dispatch events.
17042 *
17043 * @see {EventPluginHub}
17044 */
17045var EventPluginRegistry = {
17046
17047 /**
17048 * Ordered list of injected plugins.
17049 */
17050 plugins: [],
17051
17052 /**
17053 * Mapping from event name to dispatch config
17054 */
17055 eventNameDispatchConfigs: {},
17056
17057 /**
17058 * Mapping from registration name to plugin module
17059 */
17060 registrationNameModules: {},
17061
17062 /**
17063 * Mapping from registration name to event name
17064 */
17065 registrationNameDependencies: {},
17066
17067 /**
17068 * Mapping from lowercase registration names to the properly cased version,
17069 * used to warn in the case of missing event handlers. Available
17070 * only in __DEV__.
17071 * @type {Object}
17072 */
17073 possibleRegistrationNames: process.env.NODE_ENV !== 'production' ? {} : null,
17074
17075 /**
17076 * Injects an ordering of plugins (by plugin name). This allows the ordering
17077 * to be decoupled from injection of the actual plugins so that ordering is
17078 * always deterministic regardless of packaging, on-the-fly injection, etc.
17079 *
17080 * @param {array} InjectedEventPluginOrder
17081 * @internal
17082 * @see {EventPluginHub.injection.injectEventPluginOrder}
17083 */
17084 injectEventPluginOrder: function (InjectedEventPluginOrder) {
17085 !!EventPluginOrder ? process.env.NODE_ENV !== 'production' ? invariant(false, 'EventPluginRegistry: Cannot inject event plugin ordering more than ' + 'once. You are likely trying to load more than one copy of React.') : invariant(false) : void 0;
17086 // Clone the ordering so it cannot be dynamically mutated.
17087 EventPluginOrder = Array.prototype.slice.call(InjectedEventPluginOrder);
17088 recomputePluginOrdering();
17089 },
17090
17091 /**
17092 * Injects plugins to be used by `EventPluginHub`. The plugin names must be
17093 * in the ordering injected by `injectEventPluginOrder`.
17094 *
17095 * Plugins can be injected as part of page initialization or on-the-fly.
17096 *
17097 * @param {object} injectedNamesToPlugins Map from names to plugin modules.
17098 * @internal
17099 * @see {EventPluginHub.injection.injectEventPluginsByName}
17100 */
17101 injectEventPluginsByName: function (injectedNamesToPlugins) {
17102 var isOrderingDirty = false;
17103 for (var pluginName in injectedNamesToPlugins) {
17104 if (!injectedNamesToPlugins.hasOwnProperty(pluginName)) {
17105 continue;
17106 }
17107 var PluginModule = injectedNamesToPlugins[pluginName];
17108 if (!namesToPlugins.hasOwnProperty(pluginName) || namesToPlugins[pluginName] !== PluginModule) {
17109 !!namesToPlugins[pluginName] ? process.env.NODE_ENV !== 'production' ? invariant(false, 'EventPluginRegistry: Cannot inject two different event plugins ' + 'using the same name, `%s`.', pluginName) : invariant(false) : void 0;
17110 namesToPlugins[pluginName] = PluginModule;
17111 isOrderingDirty = true;
17112 }
17113 }
17114 if (isOrderingDirty) {
17115 recomputePluginOrdering();
17116 }
17117 },
17118
17119 /**
17120 * Looks up the plugin for the supplied event.
17121 *
17122 * @param {object} event A synthetic event.
17123 * @return {?object} The plugin that created the supplied event.
17124 * @internal
17125 */
17126 getPluginModuleForEvent: function (event) {
17127 var dispatchConfig = event.dispatchConfig;
17128 if (dispatchConfig.registrationName) {
17129 return EventPluginRegistry.registrationNameModules[dispatchConfig.registrationName] || null;
17130 }
17131 for (var phase in dispatchConfig.phasedRegistrationNames) {
17132 if (!dispatchConfig.phasedRegistrationNames.hasOwnProperty(phase)) {
17133 continue;
17134 }
17135 var PluginModule = EventPluginRegistry.registrationNameModules[dispatchConfig.phasedRegistrationNames[phase]];
17136 if (PluginModule) {
17137 return PluginModule;
17138 }
17139 }
17140 return null;
17141 },
17142
17143 /**
17144 * Exposed for unit testing.
17145 * @private
17146 */
17147 _resetEventPlugins: function () {
17148 EventPluginOrder = null;
17149 for (var pluginName in namesToPlugins) {
17150 if (namesToPlugins.hasOwnProperty(pluginName)) {
17151 delete namesToPlugins[pluginName];
17152 }
17153 }
17154 EventPluginRegistry.plugins.length = 0;
17155
17156 var eventNameDispatchConfigs = EventPluginRegistry.eventNameDispatchConfigs;
17157 for (var eventName in eventNameDispatchConfigs) {
17158 if (eventNameDispatchConfigs.hasOwnProperty(eventName)) {
17159 delete eventNameDispatchConfigs[eventName];
17160 }
17161 }
17162
17163 var registrationNameModules = EventPluginRegistry.registrationNameModules;
17164 for (var registrationName in registrationNameModules) {
17165 if (registrationNameModules.hasOwnProperty(registrationName)) {
17166 delete registrationNameModules[registrationName];
17167 }
17168 }
17169
17170 if (process.env.NODE_ENV !== 'production') {
17171 var possibleRegistrationNames = EventPluginRegistry.possibleRegistrationNames;
17172 for (var lowerCasedName in possibleRegistrationNames) {
17173 if (possibleRegistrationNames.hasOwnProperty(lowerCasedName)) {
17174 delete possibleRegistrationNames[lowerCasedName];
17175 }
17176 }
17177 }
17178 }
17179
17180};
17181
17182module.exports = EventPluginRegistry;
17183}).call(this,require(91))
17184},{"45":45,"91":91}],177:[function(require,module,exports){
17185(function (process){
17186/**
17187 * Copyright 2013-present, Facebook, Inc.
17188 * All rights reserved.
17189 *
17190 * This source code is licensed under the BSD-style license found in the
17191 * LICENSE file in the root directory of this source tree. An additional grant
17192 * of patent rights can be found in the PATENTS file in the same directory.
17193 *
17194 * @providesModule EventPluginUtils
17195 */
17196
17197'use strict';
17198
17199var EventConstants = require(174);
17200var ReactErrorUtils = require(221);
17201
17202var invariant = require(45);
17203var warning = require(55);
17204
17205/**
17206 * Injected dependencies:
17207 */
17208
17209/**
17210 * - `ComponentTree`: [required] Module that can convert between React instances
17211 * and actual node references.
17212 */
17213var ComponentTree;
17214var TreeTraversal;
17215var injection = {
17216 injectComponentTree: function (Injected) {
17217 ComponentTree = Injected;
17218 if (process.env.NODE_ENV !== 'production') {
17219 process.env.NODE_ENV !== 'production' ? warning(Injected && Injected.getNodeFromInstance && Injected.getInstanceFromNode, 'EventPluginUtils.injection.injectComponentTree(...): Injected ' + 'module is missing getNodeFromInstance or getInstanceFromNode.') : void 0;
17220 }
17221 },
17222 injectTreeTraversal: function (Injected) {
17223 TreeTraversal = Injected;
17224 if (process.env.NODE_ENV !== 'production') {
17225 process.env.NODE_ENV !== 'production' ? warning(Injected && Injected.isAncestor && Injected.getLowestCommonAncestor, 'EventPluginUtils.injection.injectTreeTraversal(...): Injected ' + 'module is missing isAncestor or getLowestCommonAncestor.') : void 0;
17226 }
17227 }
17228};
17229
17230var topLevelTypes = EventConstants.topLevelTypes;
17231
17232function isEndish(topLevelType) {
17233 return topLevelType === topLevelTypes.topMouseUp || topLevelType === topLevelTypes.topTouchEnd || topLevelType === topLevelTypes.topTouchCancel;
17234}
17235
17236function isMoveish(topLevelType) {
17237 return topLevelType === topLevelTypes.topMouseMove || topLevelType === topLevelTypes.topTouchMove;
17238}
17239function isStartish(topLevelType) {
17240 return topLevelType === topLevelTypes.topMouseDown || topLevelType === topLevelTypes.topTouchStart;
17241}
17242
17243var validateEventDispatches;
17244if (process.env.NODE_ENV !== 'production') {
17245 validateEventDispatches = function (event) {
17246 var dispatchListeners = event._dispatchListeners;
17247 var dispatchInstances = event._dispatchInstances;
17248
17249 var listenersIsArr = Array.isArray(dispatchListeners);
17250 var listenersLen = listenersIsArr ? dispatchListeners.length : dispatchListeners ? 1 : 0;
17251
17252 var instancesIsArr = Array.isArray(dispatchInstances);
17253 var instancesLen = instancesIsArr ? dispatchInstances.length : dispatchInstances ? 1 : 0;
17254
17255 process.env.NODE_ENV !== 'production' ? warning(instancesIsArr === listenersIsArr && instancesLen === listenersLen, 'EventPluginUtils: Invalid `event`.') : void 0;
17256 };
17257}
17258
17259/**
17260 * Dispatch the event to the listener.
17261 * @param {SyntheticEvent} event SyntheticEvent to handle
17262 * @param {boolean} simulated If the event is simulated (changes exn behavior)
17263 * @param {function} listener Application-level callback
17264 * @param {*} inst Internal component instance
17265 */
17266function executeDispatch(event, simulated, listener, inst) {
17267 var type = event.type || 'unknown-event';
17268 event.currentTarget = EventPluginUtils.getNodeFromInstance(inst);
17269 if (simulated) {
17270 ReactErrorUtils.invokeGuardedCallbackWithCatch(type, listener, event);
17271 } else {
17272 ReactErrorUtils.invokeGuardedCallback(type, listener, event);
17273 }
17274 event.currentTarget = null;
17275}
17276
17277/**
17278 * Standard/simple iteration through an event's collected dispatches.
17279 */
17280function executeDispatchesInOrder(event, simulated) {
17281 var dispatchListeners = event._dispatchListeners;
17282 var dispatchInstances = event._dispatchInstances;
17283 if (process.env.NODE_ENV !== 'production') {
17284 validateEventDispatches(event);
17285 }
17286 if (Array.isArray(dispatchListeners)) {
17287 for (var i = 0; i < dispatchListeners.length; i++) {
17288 if (event.isPropagationStopped()) {
17289 break;
17290 }
17291 // Listeners and Instances are two parallel arrays that are always in sync.
17292 executeDispatch(event, simulated, dispatchListeners[i], dispatchInstances[i]);
17293 }
17294 } else if (dispatchListeners) {
17295 executeDispatch(event, simulated, dispatchListeners, dispatchInstances);
17296 }
17297 event._dispatchListeners = null;
17298 event._dispatchInstances = null;
17299}
17300
17301/**
17302 * Standard/simple iteration through an event's collected dispatches, but stops
17303 * at the first dispatch execution returning true, and returns that id.
17304 *
17305 * @return {?string} id of the first dispatch execution who's listener returns
17306 * true, or null if no listener returned true.
17307 */
17308function executeDispatchesInOrderStopAtTrueImpl(event) {
17309 var dispatchListeners = event._dispatchListeners;
17310 var dispatchInstances = event._dispatchInstances;
17311 if (process.env.NODE_ENV !== 'production') {
17312 validateEventDispatches(event);
17313 }
17314 if (Array.isArray(dispatchListeners)) {
17315 for (var i = 0; i < dispatchListeners.length; i++) {
17316 if (event.isPropagationStopped()) {
17317 break;
17318 }
17319 // Listeners and Instances are two parallel arrays that are always in sync.
17320 if (dispatchListeners[i](event, dispatchInstances[i])) {
17321 return dispatchInstances[i];
17322 }
17323 }
17324 } else if (dispatchListeners) {
17325 if (dispatchListeners(event, dispatchInstances)) {
17326 return dispatchInstances;
17327 }
17328 }
17329 return null;
17330}
17331
17332/**
17333 * @see executeDispatchesInOrderStopAtTrueImpl
17334 */
17335function executeDispatchesInOrderStopAtTrue(event) {
17336 var ret = executeDispatchesInOrderStopAtTrueImpl(event);
17337 event._dispatchInstances = null;
17338 event._dispatchListeners = null;
17339 return ret;
17340}
17341
17342/**
17343 * Execution of a "direct" dispatch - there must be at most one dispatch
17344 * accumulated on the event or it is considered an error. It doesn't really make
17345 * sense for an event with multiple dispatches (bubbled) to keep track of the
17346 * return values at each dispatch execution, but it does tend to make sense when
17347 * dealing with "direct" dispatches.
17348 *
17349 * @return {*} The return value of executing the single dispatch.
17350 */
17351function executeDirectDispatch(event) {
17352 if (process.env.NODE_ENV !== 'production') {
17353 validateEventDispatches(event);
17354 }
17355 var dispatchListener = event._dispatchListeners;
17356 var dispatchInstance = event._dispatchInstances;
17357 !!Array.isArray(dispatchListener) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'executeDirectDispatch(...): Invalid `event`.') : invariant(false) : void 0;
17358 event.currentTarget = dispatchListener ? EventPluginUtils.getNodeFromInstance(dispatchInstance) : null;
17359 var res = dispatchListener ? dispatchListener(event) : null;
17360 event.currentTarget = null;
17361 event._dispatchListeners = null;
17362 event._dispatchInstances = null;
17363 return res;
17364}
17365
17366/**
17367 * @param {SyntheticEvent} event
17368 * @return {boolean} True iff number of dispatches accumulated is greater than 0.
17369 */
17370function hasDispatches(event) {
17371 return !!event._dispatchListeners;
17372}
17373
17374/**
17375 * General utilities that are useful in creating custom Event Plugins.
17376 */
17377var EventPluginUtils = {
17378 isEndish: isEndish,
17379 isMoveish: isMoveish,
17380 isStartish: isStartish,
17381
17382 executeDirectDispatch: executeDirectDispatch,
17383 executeDispatchesInOrder: executeDispatchesInOrder,
17384 executeDispatchesInOrderStopAtTrue: executeDispatchesInOrderStopAtTrue,
17385 hasDispatches: hasDispatches,
17386
17387 getInstanceFromNode: function (node) {
17388 return ComponentTree.getInstanceFromNode(node);
17389 },
17390 getNodeFromInstance: function (node) {
17391 return ComponentTree.getNodeFromInstance(node);
17392 },
17393 isAncestor: function (a, b) {
17394 return TreeTraversal.isAncestor(a, b);
17395 },
17396 getLowestCommonAncestor: function (a, b) {
17397 return TreeTraversal.getLowestCommonAncestor(a, b);
17398 },
17399 getParentInstance: function (inst) {
17400 return TreeTraversal.getParentInstance(inst);
17401 },
17402 traverseTwoPhase: function (target, fn, arg) {
17403 return TreeTraversal.traverseTwoPhase(target, fn, arg);
17404 },
17405 traverseEnterLeave: function (from, to, fn, argFrom, argTo) {
17406 return TreeTraversal.traverseEnterLeave(from, to, fn, argFrom, argTo);
17407 },
17408
17409 injection: injection
17410};
17411
17412module.exports = EventPluginUtils;
17413}).call(this,require(91))
17414},{"174":174,"221":221,"45":45,"55":55,"91":91}],178:[function(require,module,exports){
17415(function (process){
17416/**
17417 * Copyright 2013-present, Facebook, Inc.
17418 * All rights reserved.
17419 *
17420 * This source code is licensed under the BSD-style license found in the
17421 * LICENSE file in the root directory of this source tree. An additional grant
17422 * of patent rights can be found in the PATENTS file in the same directory.
17423 *
17424 * @providesModule EventPropagators
17425 */
17426
17427'use strict';
17428
17429var EventConstants = require(174);
17430var EventPluginHub = require(175);
17431var EventPluginUtils = require(177);
17432
17433var accumulateInto = require(267);
17434var forEachAccumulated = require(275);
17435var warning = require(55);
17436
17437var PropagationPhases = EventConstants.PropagationPhases;
17438var getListener = EventPluginHub.getListener;
17439
17440/**
17441 * Some event types have a notion of different registration names for different
17442 * "phases" of propagation. This finds listeners by a given phase.
17443 */
17444function listenerAtPhase(inst, event, propagationPhase) {
17445 var registrationName = event.dispatchConfig.phasedRegistrationNames[propagationPhase];
17446 return getListener(inst, registrationName);
17447}
17448
17449/**
17450 * Tags a `SyntheticEvent` with dispatched listeners. Creating this function
17451 * here, allows us to not have to bind or create functions for each event.
17452 * Mutating the event's members allows us to not have to create a wrapping
17453 * "dispatch" object that pairs the event with the listener.
17454 */
17455function accumulateDirectionalDispatches(inst, upwards, event) {
17456 if (process.env.NODE_ENV !== 'production') {
17457 process.env.NODE_ENV !== 'production' ? warning(inst, 'Dispatching inst must not be null') : void 0;
17458 }
17459 var phase = upwards ? PropagationPhases.bubbled : PropagationPhases.captured;
17460 var listener = listenerAtPhase(inst, event, phase);
17461 if (listener) {
17462 event._dispatchListeners = accumulateInto(event._dispatchListeners, listener);
17463 event._dispatchInstances = accumulateInto(event._dispatchInstances, inst);
17464 }
17465}
17466
17467/**
17468 * Collect dispatches (must be entirely collected before dispatching - see unit
17469 * tests). Lazily allocate the array to conserve memory. We must loop through
17470 * each event and perform the traversal for each one. We cannot perform a
17471 * single traversal for the entire collection of events because each event may
17472 * have a different target.
17473 */
17474function accumulateTwoPhaseDispatchesSingle(event) {
17475 if (event && event.dispatchConfig.phasedRegistrationNames) {
17476 EventPluginUtils.traverseTwoPhase(event._targetInst, accumulateDirectionalDispatches, event);
17477 }
17478}
17479
17480/**
17481 * Same as `accumulateTwoPhaseDispatchesSingle`, but skips over the targetID.
17482 */
17483function accumulateTwoPhaseDispatchesSingleSkipTarget(event) {
17484 if (event && event.dispatchConfig.phasedRegistrationNames) {
17485 var targetInst = event._targetInst;
17486 var parentInst = targetInst ? EventPluginUtils.getParentInstance(targetInst) : null;
17487 EventPluginUtils.traverseTwoPhase(parentInst, accumulateDirectionalDispatches, event);
17488 }
17489}
17490
17491/**
17492 * Accumulates without regard to direction, does not look for phased
17493 * registration names. Same as `accumulateDirectDispatchesSingle` but without
17494 * requiring that the `dispatchMarker` be the same as the dispatched ID.
17495 */
17496function accumulateDispatches(inst, ignoredDirection, event) {
17497 if (event && event.dispatchConfig.registrationName) {
17498 var registrationName = event.dispatchConfig.registrationName;
17499 var listener = getListener(inst, registrationName);
17500 if (listener) {
17501 event._dispatchListeners = accumulateInto(event._dispatchListeners, listener);
17502 event._dispatchInstances = accumulateInto(event._dispatchInstances, inst);
17503 }
17504 }
17505}
17506
17507/**
17508 * Accumulates dispatches on an `SyntheticEvent`, but only for the
17509 * `dispatchMarker`.
17510 * @param {SyntheticEvent} event
17511 */
17512function accumulateDirectDispatchesSingle(event) {
17513 if (event && event.dispatchConfig.registrationName) {
17514 accumulateDispatches(event._targetInst, null, event);
17515 }
17516}
17517
17518function accumulateTwoPhaseDispatches(events) {
17519 forEachAccumulated(events, accumulateTwoPhaseDispatchesSingle);
17520}
17521
17522function accumulateTwoPhaseDispatchesSkipTarget(events) {
17523 forEachAccumulated(events, accumulateTwoPhaseDispatchesSingleSkipTarget);
17524}
17525
17526function accumulateEnterLeaveDispatches(leave, enter, from, to) {
17527 EventPluginUtils.traverseEnterLeave(from, to, accumulateDispatches, leave, enter);
17528}
17529
17530function accumulateDirectDispatches(events) {
17531 forEachAccumulated(events, accumulateDirectDispatchesSingle);
17532}
17533
17534/**
17535 * A small set of propagation patterns, each of which will accept a small amount
17536 * of information, and generate a set of "dispatch ready event objects" - which
17537 * are sets of events that have already been annotated with a set of dispatched
17538 * listener functions/ids. The API is designed this way to discourage these
17539 * propagation strategies from actually executing the dispatches, since we
17540 * always want to collect the entire set of dispatches before executing event a
17541 * single one.
17542 *
17543 * @constructor EventPropagators
17544 */
17545var EventPropagators = {
17546 accumulateTwoPhaseDispatches: accumulateTwoPhaseDispatches,
17547 accumulateTwoPhaseDispatchesSkipTarget: accumulateTwoPhaseDispatchesSkipTarget,
17548 accumulateDirectDispatches: accumulateDirectDispatches,
17549 accumulateEnterLeaveDispatches: accumulateEnterLeaveDispatches
17550};
17551
17552module.exports = EventPropagators;
17553}).call(this,require(91))
17554},{"174":174,"175":175,"177":177,"267":267,"275":275,"55":55,"91":91}],179:[function(require,module,exports){
17555/**
17556 * Copyright 2013-present, Facebook, Inc.
17557 * All rights reserved.
17558 *
17559 * This source code is licensed under the BSD-style license found in the
17560 * LICENSE file in the root directory of this source tree. An additional grant
17561 * of patent rights can be found in the PATENTS file in the same directory.
17562 *
17563 * @providesModule FallbackCompositionState
17564 */
17565
17566'use strict';
17567
17568var _assign = require(296);
17569
17570var PooledClass = require(183);
17571
17572var getTextContentAccessor = require(283);
17573
17574/**
17575 * This helper class stores information about text content of a target node,
17576 * allowing comparison of content before and after a given event.
17577 *
17578 * Identify the node where selection currently begins, then observe
17579 * both its text content and its current position in the DOM. Since the
17580 * browser may natively replace the target node during composition, we can
17581 * use its position to find its replacement.
17582 *
17583 * @param {DOMEventTarget} root
17584 */
17585function FallbackCompositionState(root) {
17586 this._root = root;
17587 this._startText = this.getText();
17588 this._fallbackText = null;
17589}
17590
17591_assign(FallbackCompositionState.prototype, {
17592 destructor: function () {
17593 this._root = null;
17594 this._startText = null;
17595 this._fallbackText = null;
17596 },
17597
17598 /**
17599 * Get current text of input.
17600 *
17601 * @return {string}
17602 */
17603 getText: function () {
17604 if ('value' in this._root) {
17605 return this._root.value;
17606 }
17607 return this._root[getTextContentAccessor()];
17608 },
17609
17610 /**
17611 * Determine the differing substring between the initially stored
17612 * text content and the current content.
17613 *
17614 * @return {string}
17615 */
17616 getData: function () {
17617 if (this._fallbackText) {
17618 return this._fallbackText;
17619 }
17620
17621 var start;
17622 var startValue = this._startText;
17623 var startLength = startValue.length;
17624 var end;
17625 var endValue = this.getText();
17626 var endLength = endValue.length;
17627
17628 for (start = 0; start < startLength; start++) {
17629 if (startValue[start] !== endValue[start]) {
17630 break;
17631 }
17632 }
17633
17634 var minEnd = startLength - start;
17635 for (end = 1; end <= minEnd; end++) {
17636 if (startValue[startLength - end] !== endValue[endLength - end]) {
17637 break;
17638 }
17639 }
17640
17641 var sliceTail = end > 1 ? 1 - end : undefined;
17642 this._fallbackText = endValue.slice(start, sliceTail);
17643 return this._fallbackText;
17644 }
17645});
17646
17647PooledClass.addPoolingTo(FallbackCompositionState);
17648
17649module.exports = FallbackCompositionState;
17650},{"183":183,"283":283,"296":296}],180:[function(require,module,exports){
17651/**
17652 * Copyright 2013-present, Facebook, Inc.
17653 * All rights reserved.
17654 *
17655 * This source code is licensed under the BSD-style license found in the
17656 * LICENSE file in the root directory of this source tree. An additional grant
17657 * of patent rights can be found in the PATENTS file in the same directory.
17658 *
17659 * @providesModule HTMLDOMPropertyConfig
17660 */
17661
17662'use strict';
17663
17664var DOMProperty = require(168);
17665
17666var MUST_USE_PROPERTY = DOMProperty.injection.MUST_USE_PROPERTY;
17667var HAS_BOOLEAN_VALUE = DOMProperty.injection.HAS_BOOLEAN_VALUE;
17668var HAS_SIDE_EFFECTS = DOMProperty.injection.HAS_SIDE_EFFECTS;
17669var HAS_NUMERIC_VALUE = DOMProperty.injection.HAS_NUMERIC_VALUE;
17670var HAS_POSITIVE_NUMERIC_VALUE = DOMProperty.injection.HAS_POSITIVE_NUMERIC_VALUE;
17671var HAS_OVERLOADED_BOOLEAN_VALUE = DOMProperty.injection.HAS_OVERLOADED_BOOLEAN_VALUE;
17672
17673var HTMLDOMPropertyConfig = {
17674 isCustomAttribute: RegExp.prototype.test.bind(new RegExp('^(data|aria)-[' + DOMProperty.ATTRIBUTE_NAME_CHAR + ']*$')),
17675 Properties: {
17676 /**
17677 * Standard Properties
17678 */
17679 accept: 0,
17680 acceptCharset: 0,
17681 accessKey: 0,
17682 action: 0,
17683 allowFullScreen: HAS_BOOLEAN_VALUE,
17684 allowTransparency: 0,
17685 alt: 0,
17686 async: HAS_BOOLEAN_VALUE,
17687 autoComplete: 0,
17688 // autoFocus is polyfilled/normalized by AutoFocusUtils
17689 // autoFocus: HAS_BOOLEAN_VALUE,
17690 autoPlay: HAS_BOOLEAN_VALUE,
17691 capture: HAS_BOOLEAN_VALUE,
17692 cellPadding: 0,
17693 cellSpacing: 0,
17694 charSet: 0,
17695 challenge: 0,
17696 checked: MUST_USE_PROPERTY | HAS_BOOLEAN_VALUE,
17697 cite: 0,
17698 classID: 0,
17699 className: 0,
17700 cols: HAS_POSITIVE_NUMERIC_VALUE,
17701 colSpan: 0,
17702 content: 0,
17703 contentEditable: 0,
17704 contextMenu: 0,
17705 controls: HAS_BOOLEAN_VALUE,
17706 coords: 0,
17707 crossOrigin: 0,
17708 data: 0, // For `<object />` acts as `src`.
17709 dateTime: 0,
17710 'default': HAS_BOOLEAN_VALUE,
17711 defer: HAS_BOOLEAN_VALUE,
17712 dir: 0,
17713 disabled: HAS_BOOLEAN_VALUE,
17714 download: HAS_OVERLOADED_BOOLEAN_VALUE,
17715 draggable: 0,
17716 encType: 0,
17717 form: 0,
17718 formAction: 0,
17719 formEncType: 0,
17720 formMethod: 0,
17721 formNoValidate: HAS_BOOLEAN_VALUE,
17722 formTarget: 0,
17723 frameBorder: 0,
17724 headers: 0,
17725 height: 0,
17726 hidden: HAS_BOOLEAN_VALUE,
17727 high: 0,
17728 href: 0,
17729 hrefLang: 0,
17730 htmlFor: 0,
17731 httpEquiv: 0,
17732 icon: 0,
17733 id: 0,
17734 inputMode: 0,
17735 integrity: 0,
17736 is: 0,
17737 keyParams: 0,
17738 keyType: 0,
17739 kind: 0,
17740 label: 0,
17741 lang: 0,
17742 list: 0,
17743 loop: HAS_BOOLEAN_VALUE,
17744 low: 0,
17745 manifest: 0,
17746 marginHeight: 0,
17747 marginWidth: 0,
17748 max: 0,
17749 maxLength: 0,
17750 media: 0,
17751 mediaGroup: 0,
17752 method: 0,
17753 min: 0,
17754 minLength: 0,
17755 // Caution; `option.selected` is not updated if `select.multiple` is
17756 // disabled with `removeAttribute`.
17757 multiple: MUST_USE_PROPERTY | HAS_BOOLEAN_VALUE,
17758 muted: MUST_USE_PROPERTY | HAS_BOOLEAN_VALUE,
17759 name: 0,
17760 nonce: 0,
17761 noValidate: HAS_BOOLEAN_VALUE,
17762 open: HAS_BOOLEAN_VALUE,
17763 optimum: 0,
17764 pattern: 0,
17765 placeholder: 0,
17766 poster: 0,
17767 preload: 0,
17768 profile: 0,
17769 radioGroup: 0,
17770 readOnly: HAS_BOOLEAN_VALUE,
17771 rel: 0,
17772 required: HAS_BOOLEAN_VALUE,
17773 reversed: HAS_BOOLEAN_VALUE,
17774 role: 0,
17775 rows: HAS_POSITIVE_NUMERIC_VALUE,
17776 rowSpan: HAS_NUMERIC_VALUE,
17777 sandbox: 0,
17778 scope: 0,
17779 scoped: HAS_BOOLEAN_VALUE,
17780 scrolling: 0,
17781 seamless: HAS_BOOLEAN_VALUE,
17782 selected: MUST_USE_PROPERTY | HAS_BOOLEAN_VALUE,
17783 shape: 0,
17784 size: HAS_POSITIVE_NUMERIC_VALUE,
17785 sizes: 0,
17786 span: HAS_POSITIVE_NUMERIC_VALUE,
17787 spellCheck: 0,
17788 src: 0,
17789 srcDoc: 0,
17790 srcLang: 0,
17791 srcSet: 0,
17792 start: HAS_NUMERIC_VALUE,
17793 step: 0,
17794 style: 0,
17795 summary: 0,
17796 tabIndex: 0,
17797 target: 0,
17798 title: 0,
17799 // Setting .type throws on non-<input> tags
17800 type: 0,
17801 useMap: 0,
17802 value: MUST_USE_PROPERTY | HAS_SIDE_EFFECTS,
17803 width: 0,
17804 wmode: 0,
17805 wrap: 0,
17806
17807 /**
17808 * RDFa Properties
17809 */
17810 about: 0,
17811 datatype: 0,
17812 inlist: 0,
17813 prefix: 0,
17814 // property is also supported for OpenGraph in meta tags.
17815 property: 0,
17816 resource: 0,
17817 'typeof': 0,
17818 vocab: 0,
17819
17820 /**
17821 * Non-standard Properties
17822 */
17823 // autoCapitalize and autoCorrect are supported in Mobile Safari for
17824 // keyboard hints.
17825 autoCapitalize: 0,
17826 autoCorrect: 0,
17827 // autoSave allows WebKit/Blink to persist values of input fields on page reloads
17828 autoSave: 0,
17829 // color is for Safari mask-icon link
17830 color: 0,
17831 // itemProp, itemScope, itemType are for
17832 // Microdata support. See http://schema.org/docs/gs.html
17833 itemProp: 0,
17834 itemScope: HAS_BOOLEAN_VALUE,
17835 itemType: 0,
17836 // itemID and itemRef are for Microdata support as well but
17837 // only specified in the WHATWG spec document. See
17838 // https://html.spec.whatwg.org/multipage/microdata.html#microdata-dom-api
17839 itemID: 0,
17840 itemRef: 0,
17841 // results show looking glass icon and recent searches on input
17842 // search fields in WebKit/Blink
17843 results: 0,
17844 // IE-only attribute that specifies security restrictions on an iframe
17845 // as an alternative to the sandbox attribute on IE<10
17846 security: 0,
17847 // IE-only attribute that controls focus behavior
17848 unselectable: 0
17849 },
17850 DOMAttributeNames: {
17851 acceptCharset: 'accept-charset',
17852 className: 'class',
17853 htmlFor: 'for',
17854 httpEquiv: 'http-equiv'
17855 },
17856 DOMPropertyNames: {}
17857};
17858
17859module.exports = HTMLDOMPropertyConfig;
17860},{"168":168}],181:[function(require,module,exports){
17861/**
17862 * Copyright 2013-present, Facebook, Inc.
17863 * All rights reserved.
17864 *
17865 * This source code is licensed under the BSD-style license found in the
17866 * LICENSE file in the root directory of this source tree. An additional grant
17867 * of patent rights can be found in the PATENTS file in the same directory.
17868 *
17869 * @providesModule KeyEscapeUtils
17870 */
17871
17872'use strict';
17873
17874/**
17875 * Escape and wrap key so it is safe to use as a reactid
17876 *
17877 * @param {*} key to be escaped.
17878 * @return {string} the escaped key.
17879 */
17880
17881function escape(key) {
17882 var escapeRegex = /[=:]/g;
17883 var escaperLookup = {
17884 '=': '=0',
17885 ':': '=2'
17886 };
17887 var escapedString = ('' + key).replace(escapeRegex, function (match) {
17888 return escaperLookup[match];
17889 });
17890
17891 return '$' + escapedString;
17892}
17893
17894/**
17895 * Unescape and unwrap key for human-readable display
17896 *
17897 * @param {string} key to unescape.
17898 * @return {string} the unescaped key.
17899 */
17900function unescape(key) {
17901 var unescapeRegex = /(=0|=2)/g;
17902 var unescaperLookup = {
17903 '=0': '=',
17904 '=2': ':'
17905 };
17906 var keySubstring = key[0] === '.' && key[1] === '$' ? key.substring(2) : key.substring(1);
17907
17908 return ('' + keySubstring).replace(unescapeRegex, function (match) {
17909 return unescaperLookup[match];
17910 });
17911}
17912
17913var KeyEscapeUtils = {
17914 escape: escape,
17915 unescape: unescape
17916};
17917
17918module.exports = KeyEscapeUtils;
17919},{}],182:[function(require,module,exports){
17920(function (process){
17921/**
17922 * Copyright 2013-present, Facebook, Inc.
17923 * All rights reserved.
17924 *
17925 * This source code is licensed under the BSD-style license found in the
17926 * LICENSE file in the root directory of this source tree. An additional grant
17927 * of patent rights can be found in the PATENTS file in the same directory.
17928 *
17929 * @providesModule LinkedValueUtils
17930 */
17931
17932'use strict';
17933
17934var ReactPropTypes = require(241);
17935var ReactPropTypeLocations = require(240);
17936
17937var invariant = require(45);
17938var warning = require(55);
17939
17940var hasReadOnlyValue = {
17941 'button': true,
17942 'checkbox': true,
17943 'image': true,
17944 'hidden': true,
17945 'radio': true,
17946 'reset': true,
17947 'submit': true
17948};
17949
17950function _assertSingleLink(inputProps) {
17951 !(inputProps.checkedLink == null || inputProps.valueLink == null) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Cannot provide a checkedLink and a valueLink. If you want to use ' + 'checkedLink, you probably don\'t want to use valueLink and vice versa.') : invariant(false) : void 0;
17952}
17953function _assertValueLink(inputProps) {
17954 _assertSingleLink(inputProps);
17955 !(inputProps.value == null && inputProps.onChange == null) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Cannot provide a valueLink and a value or onChange event. If you want ' + 'to use value or onChange, you probably don\'t want to use valueLink.') : invariant(false) : void 0;
17956}
17957
17958function _assertCheckedLink(inputProps) {
17959 _assertSingleLink(inputProps);
17960 !(inputProps.checked == null && inputProps.onChange == null) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Cannot provide a checkedLink and a checked property or onChange event. ' + 'If you want to use checked or onChange, you probably don\'t want to ' + 'use checkedLink') : invariant(false) : void 0;
17961}
17962
17963var propTypes = {
17964 value: function (props, propName, componentName) {
17965 if (!props[propName] || hasReadOnlyValue[props.type] || props.onChange || props.readOnly || props.disabled) {
17966 return null;
17967 }
17968 return new Error('You provided a `value` prop to a form field without an ' + '`onChange` handler. This will render a read-only field. If ' + 'the field should be mutable use `defaultValue`. Otherwise, ' + 'set either `onChange` or `readOnly`.');
17969 },
17970 checked: function (props, propName, componentName) {
17971 if (!props[propName] || props.onChange || props.readOnly || props.disabled) {
17972 return null;
17973 }
17974 return new Error('You provided a `checked` prop to a form field without an ' + '`onChange` handler. This will render a read-only field. If ' + 'the field should be mutable use `defaultChecked`. Otherwise, ' + 'set either `onChange` or `readOnly`.');
17975 },
17976 onChange: ReactPropTypes.func
17977};
17978
17979var loggedTypeFailures = {};
17980function getDeclarationErrorAddendum(owner) {
17981 if (owner) {
17982 var name = owner.getName();
17983 if (name) {
17984 return ' Check the render method of `' + name + '`.';
17985 }
17986 }
17987 return '';
17988}
17989
17990/**
17991 * Provide a linked `value` attribute for controlled forms. You should not use
17992 * this outside of the ReactDOM controlled form components.
17993 */
17994var LinkedValueUtils = {
17995 checkPropTypes: function (tagName, props, owner) {
17996 for (var propName in propTypes) {
17997 if (propTypes.hasOwnProperty(propName)) {
17998 var error = propTypes[propName](props, propName, tagName, ReactPropTypeLocations.prop);
17999 }
18000 if (error instanceof Error && !(error.message in loggedTypeFailures)) {
18001 // Only monitor this failure once because there tends to be a lot of the
18002 // same error.
18003 loggedTypeFailures[error.message] = true;
18004
18005 var addendum = getDeclarationErrorAddendum(owner);
18006 process.env.NODE_ENV !== 'production' ? warning(false, 'Failed form propType: %s%s', error.message, addendum) : void 0;
18007 }
18008 }
18009 },
18010
18011 /**
18012 * @param {object} inputProps Props for form component
18013 * @return {*} current value of the input either from value prop or link.
18014 */
18015 getValue: function (inputProps) {
18016 if (inputProps.valueLink) {
18017 _assertValueLink(inputProps);
18018 return inputProps.valueLink.value;
18019 }
18020 return inputProps.value;
18021 },
18022
18023 /**
18024 * @param {object} inputProps Props for form component
18025 * @return {*} current checked status of the input either from checked prop
18026 * or link.
18027 */
18028 getChecked: function (inputProps) {
18029 if (inputProps.checkedLink) {
18030 _assertCheckedLink(inputProps);
18031 return inputProps.checkedLink.value;
18032 }
18033 return inputProps.checked;
18034 },
18035
18036 /**
18037 * @param {object} inputProps Props for form component
18038 * @param {SyntheticEvent} event change event to handle
18039 */
18040 executeOnChange: function (inputProps, event) {
18041 if (inputProps.valueLink) {
18042 _assertValueLink(inputProps);
18043 return inputProps.valueLink.requestChange(event.target.value);
18044 } else if (inputProps.checkedLink) {
18045 _assertCheckedLink(inputProps);
18046 return inputProps.checkedLink.requestChange(event.target.checked);
18047 } else if (inputProps.onChange) {
18048 return inputProps.onChange.call(undefined, event);
18049 }
18050 }
18051};
18052
18053module.exports = LinkedValueUtils;
18054}).call(this,require(91))
18055},{"240":240,"241":241,"45":45,"55":55,"91":91}],183:[function(require,module,exports){
18056(function (process){
18057/**
18058 * Copyright 2013-present, Facebook, Inc.
18059 * All rights reserved.
18060 *
18061 * This source code is licensed under the BSD-style license found in the
18062 * LICENSE file in the root directory of this source tree. An additional grant
18063 * of patent rights can be found in the PATENTS file in the same directory.
18064 *
18065 * @providesModule PooledClass
18066 */
18067
18068'use strict';
18069
18070var invariant = require(45);
18071
18072/**
18073 * Static poolers. Several custom versions for each potential number of
18074 * arguments. A completely generic pooler is easy to implement, but would
18075 * require accessing the `arguments` object. In each of these, `this` refers to
18076 * the Class itself, not an instance. If any others are needed, simply add them
18077 * here, or in their own files.
18078 */
18079var oneArgumentPooler = function (copyFieldsFrom) {
18080 var Klass = this;
18081 if (Klass.instancePool.length) {
18082 var instance = Klass.instancePool.pop();
18083 Klass.call(instance, copyFieldsFrom);
18084 return instance;
18085 } else {
18086 return new Klass(copyFieldsFrom);
18087 }
18088};
18089
18090var twoArgumentPooler = function (a1, a2) {
18091 var Klass = this;
18092 if (Klass.instancePool.length) {
18093 var instance = Klass.instancePool.pop();
18094 Klass.call(instance, a1, a2);
18095 return instance;
18096 } else {
18097 return new Klass(a1, a2);
18098 }
18099};
18100
18101var threeArgumentPooler = function (a1, a2, a3) {
18102 var Klass = this;
18103 if (Klass.instancePool.length) {
18104 var instance = Klass.instancePool.pop();
18105 Klass.call(instance, a1, a2, a3);
18106 return instance;
18107 } else {
18108 return new Klass(a1, a2, a3);
18109 }
18110};
18111
18112var fourArgumentPooler = function (a1, a2, a3, a4) {
18113 var Klass = this;
18114 if (Klass.instancePool.length) {
18115 var instance = Klass.instancePool.pop();
18116 Klass.call(instance, a1, a2, a3, a4);
18117 return instance;
18118 } else {
18119 return new Klass(a1, a2, a3, a4);
18120 }
18121};
18122
18123var fiveArgumentPooler = function (a1, a2, a3, a4, a5) {
18124 var Klass = this;
18125 if (Klass.instancePool.length) {
18126 var instance = Klass.instancePool.pop();
18127 Klass.call(instance, a1, a2, a3, a4, a5);
18128 return instance;
18129 } else {
18130 return new Klass(a1, a2, a3, a4, a5);
18131 }
18132};
18133
18134var standardReleaser = function (instance) {
18135 var Klass = this;
18136 !(instance instanceof Klass) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Trying to release an instance into a pool of a different type.') : invariant(false) : void 0;
18137 instance.destructor();
18138 if (Klass.instancePool.length < Klass.poolSize) {
18139 Klass.instancePool.push(instance);
18140 }
18141};
18142
18143var DEFAULT_POOL_SIZE = 10;
18144var DEFAULT_POOLER = oneArgumentPooler;
18145
18146/**
18147 * Augments `CopyConstructor` to be a poolable class, augmenting only the class
18148 * itself (statically) not adding any prototypical fields. Any CopyConstructor
18149 * you give this may have a `poolSize` property, and will look for a
18150 * prototypical `destructor` on instances (optional).
18151 *
18152 * @param {Function} CopyConstructor Constructor that can be used to reset.
18153 * @param {Function} pooler Customizable pooler.
18154 */
18155var addPoolingTo = function (CopyConstructor, pooler) {
18156 var NewKlass = CopyConstructor;
18157 NewKlass.instancePool = [];
18158 NewKlass.getPooled = pooler || DEFAULT_POOLER;
18159 if (!NewKlass.poolSize) {
18160 NewKlass.poolSize = DEFAULT_POOL_SIZE;
18161 }
18162 NewKlass.release = standardReleaser;
18163 return NewKlass;
18164};
18165
18166var PooledClass = {
18167 addPoolingTo: addPoolingTo,
18168 oneArgumentPooler: oneArgumentPooler,
18169 twoArgumentPooler: twoArgumentPooler,
18170 threeArgumentPooler: threeArgumentPooler,
18171 fourArgumentPooler: fourArgumentPooler,
18172 fiveArgumentPooler: fiveArgumentPooler
18173};
18174
18175module.exports = PooledClass;
18176}).call(this,require(91))
18177},{"45":45,"91":91}],184:[function(require,module,exports){
18178(function (process){
18179/**
18180 * Copyright 2013-present, Facebook, Inc.
18181 * All rights reserved.
18182 *
18183 * This source code is licensed under the BSD-style license found in the
18184 * LICENSE file in the root directory of this source tree. An additional grant
18185 * of patent rights can be found in the PATENTS file in the same directory.
18186 *
18187 * @providesModule React
18188 */
18189
18190'use strict';
18191
18192var _assign = require(296);
18193
18194var ReactChildren = require(187);
18195var ReactComponent = require(189);
18196var ReactClass = require(188);
18197var ReactDOMFactories = require(203);
18198var ReactElement = require(218);
18199var ReactElementValidator = require(219);
18200var ReactPropTypes = require(241);
18201var ReactVersion = require(248);
18202
18203var onlyChild = require(288);
18204var warning = require(55);
18205
18206var createElement = ReactElement.createElement;
18207var createFactory = ReactElement.createFactory;
18208var cloneElement = ReactElement.cloneElement;
18209
18210if (process.env.NODE_ENV !== 'production') {
18211 createElement = ReactElementValidator.createElement;
18212 createFactory = ReactElementValidator.createFactory;
18213 cloneElement = ReactElementValidator.cloneElement;
18214}
18215
18216var __spread = _assign;
18217
18218if (process.env.NODE_ENV !== 'production') {
18219 var warned = false;
18220 __spread = function () {
18221 process.env.NODE_ENV !== 'production' ? warning(warned, 'React.__spread is deprecated and should not be used. Use ' + 'Object.assign directly or another helper function with similar ' + 'semantics. You may be seeing this warning due to your compiler. ' + 'See https://fb.me/react-spread-deprecation for more details.') : void 0;
18222 warned = true;
18223 return _assign.apply(null, arguments);
18224 };
18225}
18226
18227var React = {
18228
18229 // Modern
18230
18231 Children: {
18232 map: ReactChildren.map,
18233 forEach: ReactChildren.forEach,
18234 count: ReactChildren.count,
18235 toArray: ReactChildren.toArray,
18236 only: onlyChild
18237 },
18238
18239 Component: ReactComponent,
18240
18241 createElement: createElement,
18242 cloneElement: cloneElement,
18243 isValidElement: ReactElement.isValidElement,
18244
18245 // Classic
18246
18247 PropTypes: ReactPropTypes,
18248 createClass: ReactClass.createClass,
18249 createFactory: createFactory,
18250 createMixin: function (mixin) {
18251 // Currently a noop. Will be used to validate and trace mixins.
18252 return mixin;
18253 },
18254
18255 // This looks DOM specific but these are actually isomorphic helpers
18256 // since they are just generating DOM strings.
18257 DOM: ReactDOMFactories,
18258
18259 version: ReactVersion,
18260
18261 // Deprecated hook for JSX spread, don't use this for anything.
18262 __spread: __spread
18263};
18264
18265module.exports = React;
18266}).call(this,require(91))
18267},{"187":187,"188":188,"189":189,"203":203,"218":218,"219":219,"241":241,"248":248,"288":288,"296":296,"55":55,"91":91}],185:[function(require,module,exports){
18268/**
18269 * Copyright 2013-present, Facebook, Inc.
18270 * All rights reserved.
18271 *
18272 * This source code is licensed under the BSD-style license found in the
18273 * LICENSE file in the root directory of this source tree. An additional grant
18274 * of patent rights can be found in the PATENTS file in the same directory.
18275 *
18276 * @providesModule ReactBrowserEventEmitter
18277 */
18278
18279'use strict';
18280
18281var _assign = require(296);
18282
18283var EventConstants = require(174);
18284var EventPluginRegistry = require(176);
18285var ReactEventEmitterMixin = require(222);
18286var ViewportMetrics = require(266);
18287
18288var getVendorPrefixedEventName = require(284);
18289var isEventSupported = require(286);
18290
18291/**
18292 * Summary of `ReactBrowserEventEmitter` event handling:
18293 *
18294 * - Top-level delegation is used to trap most native browser events. This
18295 * may only occur in the main thread and is the responsibility of
18296 * ReactEventListener, which is injected and can therefore support pluggable
18297 * event sources. This is the only work that occurs in the main thread.
18298 *
18299 * - We normalize and de-duplicate events to account for browser quirks. This
18300 * may be done in the worker thread.
18301 *
18302 * - Forward these native events (with the associated top-level type used to
18303 * trap it) to `EventPluginHub`, which in turn will ask plugins if they want
18304 * to extract any synthetic events.
18305 *
18306 * - The `EventPluginHub` will then process each event by annotating them with
18307 * "dispatches", a sequence of listeners and IDs that care about that event.
18308 *
18309 * - The `EventPluginHub` then dispatches the events.
18310 *
18311 * Overview of React and the event system:
18312 *
18313 * +------------+ .
18314 * | DOM | .
18315 * +------------+ .
18316 * | .
18317 * v .
18318 * +------------+ .
18319 * | ReactEvent | .
18320 * | Listener | .
18321 * +------------+ . +-----------+
18322 * | . +--------+|SimpleEvent|
18323 * | . | |Plugin |
18324 * +-----|------+ . v +-----------+
18325 * | | | . +--------------+ +------------+
18326 * | +-----------.--->|EventPluginHub| | Event |
18327 * | | . | | +-----------+ | Propagators|
18328 * | ReactEvent | . | | |TapEvent | |------------|
18329 * | Emitter | . | |<---+|Plugin | |other plugin|
18330 * | | . | | +-----------+ | utilities |
18331 * | +-----------.--->| | +------------+
18332 * | | | . +--------------+
18333 * +-----|------+ . ^ +-----------+
18334 * | . | |Enter/Leave|
18335 * + . +-------+|Plugin |
18336 * +-------------+ . +-----------+
18337 * | application | .
18338 * |-------------| .
18339 * | | .
18340 * | | .
18341 * +-------------+ .
18342 * .
18343 * React Core . General Purpose Event Plugin System
18344 */
18345
18346var hasEventPageXY;
18347var alreadyListeningTo = {};
18348var isMonitoringScrollValue = false;
18349var reactTopListenersCounter = 0;
18350
18351// For events like 'submit' which don't consistently bubble (which we trap at a
18352// lower node than `document`), binding at `document` would cause duplicate
18353// events so we don't include them here
18354var topEventMapping = {
18355 topAbort: 'abort',
18356 topAnimationEnd: getVendorPrefixedEventName('animationend') || 'animationend',
18357 topAnimationIteration: getVendorPrefixedEventName('animationiteration') || 'animationiteration',
18358 topAnimationStart: getVendorPrefixedEventName('animationstart') || 'animationstart',
18359 topBlur: 'blur',
18360 topCanPlay: 'canplay',
18361 topCanPlayThrough: 'canplaythrough',
18362 topChange: 'change',
18363 topClick: 'click',
18364 topCompositionEnd: 'compositionend',
18365 topCompositionStart: 'compositionstart',
18366 topCompositionUpdate: 'compositionupdate',
18367 topContextMenu: 'contextmenu',
18368 topCopy: 'copy',
18369 topCut: 'cut',
18370 topDoubleClick: 'dblclick',
18371 topDrag: 'drag',
18372 topDragEnd: 'dragend',
18373 topDragEnter: 'dragenter',
18374 topDragExit: 'dragexit',
18375 topDragLeave: 'dragleave',
18376 topDragOver: 'dragover',
18377 topDragStart: 'dragstart',
18378 topDrop: 'drop',
18379 topDurationChange: 'durationchange',
18380 topEmptied: 'emptied',
18381 topEncrypted: 'encrypted',
18382 topEnded: 'ended',
18383 topError: 'error',
18384 topFocus: 'focus',
18385 topInput: 'input',
18386 topKeyDown: 'keydown',
18387 topKeyPress: 'keypress',
18388 topKeyUp: 'keyup',
18389 topLoadedData: 'loadeddata',
18390 topLoadedMetadata: 'loadedmetadata',
18391 topLoadStart: 'loadstart',
18392 topMouseDown: 'mousedown',
18393 topMouseMove: 'mousemove',
18394 topMouseOut: 'mouseout',
18395 topMouseOver: 'mouseover',
18396 topMouseUp: 'mouseup',
18397 topPaste: 'paste',
18398 topPause: 'pause',
18399 topPlay: 'play',
18400 topPlaying: 'playing',
18401 topProgress: 'progress',
18402 topRateChange: 'ratechange',
18403 topScroll: 'scroll',
18404 topSeeked: 'seeked',
18405 topSeeking: 'seeking',
18406 topSelectionChange: 'selectionchange',
18407 topStalled: 'stalled',
18408 topSuspend: 'suspend',
18409 topTextInput: 'textInput',
18410 topTimeUpdate: 'timeupdate',
18411 topTouchCancel: 'touchcancel',
18412 topTouchEnd: 'touchend',
18413 topTouchMove: 'touchmove',
18414 topTouchStart: 'touchstart',
18415 topTransitionEnd: getVendorPrefixedEventName('transitionend') || 'transitionend',
18416 topVolumeChange: 'volumechange',
18417 topWaiting: 'waiting',
18418 topWheel: 'wheel'
18419};
18420
18421/**
18422 * To ensure no conflicts with other potential React instances on the page
18423 */
18424var topListenersIDKey = '_reactListenersID' + String(Math.random()).slice(2);
18425
18426function getListeningForDocument(mountAt) {
18427 // In IE8, `mountAt` is a host object and doesn't have `hasOwnProperty`
18428 // directly.
18429 if (!Object.prototype.hasOwnProperty.call(mountAt, topListenersIDKey)) {
18430 mountAt[topListenersIDKey] = reactTopListenersCounter++;
18431 alreadyListeningTo[mountAt[topListenersIDKey]] = {};
18432 }
18433 return alreadyListeningTo[mountAt[topListenersIDKey]];
18434}
18435
18436/**
18437 * `ReactBrowserEventEmitter` is used to attach top-level event listeners. For
18438 * example:
18439 *
18440 * EventPluginHub.putListener('myID', 'onClick', myFunction);
18441 *
18442 * This would allocate a "registration" of `('onClick', myFunction)` on 'myID'.
18443 *
18444 * @internal
18445 */
18446var ReactBrowserEventEmitter = _assign({}, ReactEventEmitterMixin, {
18447
18448 /**
18449 * Injectable event backend
18450 */
18451 ReactEventListener: null,
18452
18453 injection: {
18454 /**
18455 * @param {object} ReactEventListener
18456 */
18457 injectReactEventListener: function (ReactEventListener) {
18458 ReactEventListener.setHandleTopLevel(ReactBrowserEventEmitter.handleTopLevel);
18459 ReactBrowserEventEmitter.ReactEventListener = ReactEventListener;
18460 }
18461 },
18462
18463 /**
18464 * Sets whether or not any created callbacks should be enabled.
18465 *
18466 * @param {boolean} enabled True if callbacks should be enabled.
18467 */
18468 setEnabled: function (enabled) {
18469 if (ReactBrowserEventEmitter.ReactEventListener) {
18470 ReactBrowserEventEmitter.ReactEventListener.setEnabled(enabled);
18471 }
18472 },
18473
18474 /**
18475 * @return {boolean} True if callbacks are enabled.
18476 */
18477 isEnabled: function () {
18478 return !!(ReactBrowserEventEmitter.ReactEventListener && ReactBrowserEventEmitter.ReactEventListener.isEnabled());
18479 },
18480
18481 /**
18482 * We listen for bubbled touch events on the document object.
18483 *
18484 * Firefox v8.01 (and possibly others) exhibited strange behavior when
18485 * mounting `onmousemove` events at some node that was not the document
18486 * element. The symptoms were that if your mouse is not moving over something
18487 * contained within that mount point (for example on the background) the
18488 * top-level listeners for `onmousemove` won't be called. However, if you
18489 * register the `mousemove` on the document object, then it will of course
18490 * catch all `mousemove`s. This along with iOS quirks, justifies restricting
18491 * top-level listeners to the document object only, at least for these
18492 * movement types of events and possibly all events.
18493 *
18494 * @see http://www.quirksmode.org/blog/archives/2010/09/click_event_del.html
18495 *
18496 * Also, `keyup`/`keypress`/`keydown` do not bubble to the window on IE, but
18497 * they bubble to document.
18498 *
18499 * @param {string} registrationName Name of listener (e.g. `onClick`).
18500 * @param {object} contentDocumentHandle Document which owns the container
18501 */
18502 listenTo: function (registrationName, contentDocumentHandle) {
18503 var mountAt = contentDocumentHandle;
18504 var isListening = getListeningForDocument(mountAt);
18505 var dependencies = EventPluginRegistry.registrationNameDependencies[registrationName];
18506
18507 var topLevelTypes = EventConstants.topLevelTypes;
18508 for (var i = 0; i < dependencies.length; i++) {
18509 var dependency = dependencies[i];
18510 if (!(isListening.hasOwnProperty(dependency) && isListening[dependency])) {
18511 if (dependency === topLevelTypes.topWheel) {
18512 if (isEventSupported('wheel')) {
18513 ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent(topLevelTypes.topWheel, 'wheel', mountAt);
18514 } else if (isEventSupported('mousewheel')) {
18515 ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent(topLevelTypes.topWheel, 'mousewheel', mountAt);
18516 } else {
18517 // Firefox needs to capture a different mouse scroll event.
18518 // @see http://www.quirksmode.org/dom/events/tests/scroll.html
18519 ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent(topLevelTypes.topWheel, 'DOMMouseScroll', mountAt);
18520 }
18521 } else if (dependency === topLevelTypes.topScroll) {
18522
18523 if (isEventSupported('scroll', true)) {
18524 ReactBrowserEventEmitter.ReactEventListener.trapCapturedEvent(topLevelTypes.topScroll, 'scroll', mountAt);
18525 } else {
18526 ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent(topLevelTypes.topScroll, 'scroll', ReactBrowserEventEmitter.ReactEventListener.WINDOW_HANDLE);
18527 }
18528 } else if (dependency === topLevelTypes.topFocus || dependency === topLevelTypes.topBlur) {
18529
18530 if (isEventSupported('focus', true)) {
18531 ReactBrowserEventEmitter.ReactEventListener.trapCapturedEvent(topLevelTypes.topFocus, 'focus', mountAt);
18532 ReactBrowserEventEmitter.ReactEventListener.trapCapturedEvent(topLevelTypes.topBlur, 'blur', mountAt);
18533 } else if (isEventSupported('focusin')) {
18534 // IE has `focusin` and `focusout` events which bubble.
18535 // @see http://www.quirksmode.org/blog/archives/2008/04/delegating_the.html
18536 ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent(topLevelTypes.topFocus, 'focusin', mountAt);
18537 ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent(topLevelTypes.topBlur, 'focusout', mountAt);
18538 }
18539
18540 // to make sure blur and focus event listeners are only attached once
18541 isListening[topLevelTypes.topBlur] = true;
18542 isListening[topLevelTypes.topFocus] = true;
18543 } else if (topEventMapping.hasOwnProperty(dependency)) {
18544 ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent(dependency, topEventMapping[dependency], mountAt);
18545 }
18546
18547 isListening[dependency] = true;
18548 }
18549 }
18550 },
18551
18552 trapBubbledEvent: function (topLevelType, handlerBaseName, handle) {
18553 return ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent(topLevelType, handlerBaseName, handle);
18554 },
18555
18556 trapCapturedEvent: function (topLevelType, handlerBaseName, handle) {
18557 return ReactBrowserEventEmitter.ReactEventListener.trapCapturedEvent(topLevelType, handlerBaseName, handle);
18558 },
18559
18560 /**
18561 * Listens to window scroll and resize events. We cache scroll values so that
18562 * application code can access them without triggering reflows.
18563 *
18564 * ViewportMetrics is only used by SyntheticMouse/TouchEvent and only when
18565 * pageX/pageY isn't supported (legacy browsers).
18566 *
18567 * NOTE: Scroll events do not bubble.
18568 *
18569 * @see http://www.quirksmode.org/dom/events/scroll.html
18570 */
18571 ensureScrollValueMonitoring: function () {
18572 if (hasEventPageXY === undefined) {
18573 hasEventPageXY = document.createEvent && 'pageX' in document.createEvent('MouseEvent');
18574 }
18575 if (!hasEventPageXY && !isMonitoringScrollValue) {
18576 var refresh = ViewportMetrics.refreshScrollValues;
18577 ReactBrowserEventEmitter.ReactEventListener.monitorScrollValue(refresh);
18578 isMonitoringScrollValue = true;
18579 }
18580 }
18581
18582});
18583
18584module.exports = ReactBrowserEventEmitter;
18585},{"174":174,"176":176,"222":222,"266":266,"284":284,"286":286,"296":296}],186:[function(require,module,exports){
18586(function (process){
18587/**
18588 * Copyright 2014-present, Facebook, Inc.
18589 * All rights reserved.
18590 *
18591 * This source code is licensed under the BSD-style license found in the
18592 * LICENSE file in the root directory of this source tree. An additional grant
18593 * of patent rights can be found in the PATENTS file in the same directory.
18594 *
18595 * @providesModule ReactChildReconciler
18596 */
18597
18598'use strict';
18599
18600var ReactReconciler = require(243);
18601
18602var instantiateReactComponent = require(285);
18603var KeyEscapeUtils = require(181);
18604var shouldUpdateReactComponent = require(293);
18605var traverseAllChildren = require(294);
18606var warning = require(55);
18607
18608function instantiateChild(childInstances, child, name) {
18609 // We found a component instance.
18610 var keyUnique = childInstances[name] === undefined;
18611 if (process.env.NODE_ENV !== 'production') {
18612 process.env.NODE_ENV !== 'production' ? warning(keyUnique, 'flattenChildren(...): Encountered two children with the same key, ' + '`%s`. Child keys must be unique; when two children share a key, only ' + 'the first child will be used.', KeyEscapeUtils.unescape(name)) : void 0;
18613 }
18614 if (child != null && keyUnique) {
18615 childInstances[name] = instantiateReactComponent(child);
18616 }
18617}
18618
18619/**
18620 * ReactChildReconciler provides helpers for initializing or updating a set of
18621 * children. Its output is suitable for passing it onto ReactMultiChild which
18622 * does diffed reordering and insertion.
18623 */
18624var ReactChildReconciler = {
18625 /**
18626 * Generates a "mount image" for each of the supplied children. In the case
18627 * of `ReactDOMComponent`, a mount image is a string of markup.
18628 *
18629 * @param {?object} nestedChildNodes Nested child maps.
18630 * @return {?object} A set of child instances.
18631 * @internal
18632 */
18633 instantiateChildren: function (nestedChildNodes, transaction, context) {
18634 if (nestedChildNodes == null) {
18635 return null;
18636 }
18637 var childInstances = {};
18638 traverseAllChildren(nestedChildNodes, instantiateChild, childInstances);
18639 return childInstances;
18640 },
18641
18642 /**
18643 * Updates the rendered children and returns a new set of children.
18644 *
18645 * @param {?object} prevChildren Previously initialized set of children.
18646 * @param {?object} nextChildren Flat child element maps.
18647 * @param {ReactReconcileTransaction} transaction
18648 * @param {object} context
18649 * @return {?object} A new set of child instances.
18650 * @internal
18651 */
18652 updateChildren: function (prevChildren, nextChildren, removedNodes, transaction, context) {
18653 // We currently don't have a way to track moves here but if we use iterators
18654 // instead of for..in we can zip the iterators and check if an item has
18655 // moved.
18656 // TODO: If nothing has changed, return the prevChildren object so that we
18657 // can quickly bailout if nothing has changed.
18658 if (!nextChildren && !prevChildren) {
18659 return;
18660 }
18661 var name;
18662 var prevChild;
18663 for (name in nextChildren) {
18664 if (!nextChildren.hasOwnProperty(name)) {
18665 continue;
18666 }
18667 prevChild = prevChildren && prevChildren[name];
18668 var prevElement = prevChild && prevChild._currentElement;
18669 var nextElement = nextChildren[name];
18670 if (prevChild != null && shouldUpdateReactComponent(prevElement, nextElement)) {
18671 ReactReconciler.receiveComponent(prevChild, nextElement, transaction, context);
18672 nextChildren[name] = prevChild;
18673 } else {
18674 if (prevChild) {
18675 removedNodes[name] = ReactReconciler.getNativeNode(prevChild);
18676 ReactReconciler.unmountComponent(prevChild, false);
18677 }
18678 // The child must be instantiated before it's mounted.
18679 var nextChildInstance = instantiateReactComponent(nextElement);
18680 nextChildren[name] = nextChildInstance;
18681 }
18682 }
18683 // Unmount children that are no longer present.
18684 for (name in prevChildren) {
18685 if (prevChildren.hasOwnProperty(name) && !(nextChildren && nextChildren.hasOwnProperty(name))) {
18686 prevChild = prevChildren[name];
18687 removedNodes[name] = ReactReconciler.getNativeNode(prevChild);
18688 ReactReconciler.unmountComponent(prevChild, false);
18689 }
18690 }
18691 },
18692
18693 /**
18694 * Unmounts all rendered children. This should be used to clean up children
18695 * when this component is unmounted.
18696 *
18697 * @param {?object} renderedChildren Previously initialized set of children.
18698 * @internal
18699 */
18700 unmountChildren: function (renderedChildren, safely) {
18701 for (var name in renderedChildren) {
18702 if (renderedChildren.hasOwnProperty(name)) {
18703 var renderedChild = renderedChildren[name];
18704 ReactReconciler.unmountComponent(renderedChild, safely);
18705 }
18706 }
18707 }
18708
18709};
18710
18711module.exports = ReactChildReconciler;
18712}).call(this,require(91))
18713},{"181":181,"243":243,"285":285,"293":293,"294":294,"55":55,"91":91}],187:[function(require,module,exports){
18714/**
18715 * Copyright 2013-present, Facebook, Inc.
18716 * All rights reserved.
18717 *
18718 * This source code is licensed under the BSD-style license found in the
18719 * LICENSE file in the root directory of this source tree. An additional grant
18720 * of patent rights can be found in the PATENTS file in the same directory.
18721 *
18722 * @providesModule ReactChildren
18723 */
18724
18725'use strict';
18726
18727var PooledClass = require(183);
18728var ReactElement = require(218);
18729
18730var emptyFunction = require(37);
18731var traverseAllChildren = require(294);
18732
18733var twoArgumentPooler = PooledClass.twoArgumentPooler;
18734var fourArgumentPooler = PooledClass.fourArgumentPooler;
18735
18736var userProvidedKeyEscapeRegex = /\/+/g;
18737function escapeUserProvidedKey(text) {
18738 return ('' + text).replace(userProvidedKeyEscapeRegex, '$&/');
18739}
18740
18741/**
18742 * PooledClass representing the bookkeeping associated with performing a child
18743 * traversal. Allows avoiding binding callbacks.
18744 *
18745 * @constructor ForEachBookKeeping
18746 * @param {!function} forEachFunction Function to perform traversal with.
18747 * @param {?*} forEachContext Context to perform context with.
18748 */
18749function ForEachBookKeeping(forEachFunction, forEachContext) {
18750 this.func = forEachFunction;
18751 this.context = forEachContext;
18752 this.count = 0;
18753}
18754ForEachBookKeeping.prototype.destructor = function () {
18755 this.func = null;
18756 this.context = null;
18757 this.count = 0;
18758};
18759PooledClass.addPoolingTo(ForEachBookKeeping, twoArgumentPooler);
18760
18761function forEachSingleChild(bookKeeping, child, name) {
18762 var func = bookKeeping.func;
18763 var context = bookKeeping.context;
18764
18765 func.call(context, child, bookKeeping.count++);
18766}
18767
18768/**
18769 * Iterates through children that are typically specified as `props.children`.
18770 *
18771 * See https://facebook.github.io/react/docs/top-level-api.html#react.children.foreach
18772 *
18773 * The provided forEachFunc(child, index) will be called for each
18774 * leaf child.
18775 *
18776 * @param {?*} children Children tree container.
18777 * @param {function(*, int)} forEachFunc
18778 * @param {*} forEachContext Context for forEachContext.
18779 */
18780function forEachChildren(children, forEachFunc, forEachContext) {
18781 if (children == null) {
18782 return children;
18783 }
18784 var traverseContext = ForEachBookKeeping.getPooled(forEachFunc, forEachContext);
18785 traverseAllChildren(children, forEachSingleChild, traverseContext);
18786 ForEachBookKeeping.release(traverseContext);
18787}
18788
18789/**
18790 * PooledClass representing the bookkeeping associated with performing a child
18791 * mapping. Allows avoiding binding callbacks.
18792 *
18793 * @constructor MapBookKeeping
18794 * @param {!*} mapResult Object containing the ordered map of results.
18795 * @param {!function} mapFunction Function to perform mapping with.
18796 * @param {?*} mapContext Context to perform mapping with.
18797 */
18798function MapBookKeeping(mapResult, keyPrefix, mapFunction, mapContext) {
18799 this.result = mapResult;
18800 this.keyPrefix = keyPrefix;
18801 this.func = mapFunction;
18802 this.context = mapContext;
18803 this.count = 0;
18804}
18805MapBookKeeping.prototype.destructor = function () {
18806 this.result = null;
18807 this.keyPrefix = null;
18808 this.func = null;
18809 this.context = null;
18810 this.count = 0;
18811};
18812PooledClass.addPoolingTo(MapBookKeeping, fourArgumentPooler);
18813
18814function mapSingleChildIntoContext(bookKeeping, child, childKey) {
18815 var result = bookKeeping.result;
18816 var keyPrefix = bookKeeping.keyPrefix;
18817 var func = bookKeeping.func;
18818 var context = bookKeeping.context;
18819
18820
18821 var mappedChild = func.call(context, child, bookKeeping.count++);
18822 if (Array.isArray(mappedChild)) {
18823 mapIntoWithKeyPrefixInternal(mappedChild, result, childKey, emptyFunction.thatReturnsArgument);
18824 } else if (mappedChild != null) {
18825 if (ReactElement.isValidElement(mappedChild)) {
18826 mappedChild = ReactElement.cloneAndReplaceKey(mappedChild,
18827 // Keep both the (mapped) and old keys if they differ, just as
18828 // traverseAllChildren used to do for objects as children
18829 keyPrefix + (mappedChild.key && (!child || child.key !== mappedChild.key) ? escapeUserProvidedKey(mappedChild.key) + '/' : '') + childKey);
18830 }
18831 result.push(mappedChild);
18832 }
18833}
18834
18835function mapIntoWithKeyPrefixInternal(children, array, prefix, func, context) {
18836 var escapedPrefix = '';
18837 if (prefix != null) {
18838 escapedPrefix = escapeUserProvidedKey(prefix) + '/';
18839 }
18840 var traverseContext = MapBookKeeping.getPooled(array, escapedPrefix, func, context);
18841 traverseAllChildren(children, mapSingleChildIntoContext, traverseContext);
18842 MapBookKeeping.release(traverseContext);
18843}
18844
18845/**
18846 * Maps children that are typically specified as `props.children`.
18847 *
18848 * See https://facebook.github.io/react/docs/top-level-api.html#react.children.map
18849 *
18850 * The provided mapFunction(child, key, index) will be called for each
18851 * leaf child.
18852 *
18853 * @param {?*} children Children tree container.
18854 * @param {function(*, int)} func The map function.
18855 * @param {*} context Context for mapFunction.
18856 * @return {object} Object containing the ordered map of results.
18857 */
18858function mapChildren(children, func, context) {
18859 if (children == null) {
18860 return children;
18861 }
18862 var result = [];
18863 mapIntoWithKeyPrefixInternal(children, result, null, func, context);
18864 return result;
18865}
18866
18867function forEachSingleChildDummy(traverseContext, child, name) {
18868 return null;
18869}
18870
18871/**
18872 * Count the number of children that are typically specified as
18873 * `props.children`.
18874 *
18875 * See https://facebook.github.io/react/docs/top-level-api.html#react.children.count
18876 *
18877 * @param {?*} children Children tree container.
18878 * @return {number} The number of children.
18879 */
18880function countChildren(children, context) {
18881 return traverseAllChildren(children, forEachSingleChildDummy, null);
18882}
18883
18884/**
18885 * Flatten a children object (typically specified as `props.children`) and
18886 * return an array with appropriately re-keyed children.
18887 *
18888 * See https://facebook.github.io/react/docs/top-level-api.html#react.children.toarray
18889 */
18890function toArray(children) {
18891 var result = [];
18892 mapIntoWithKeyPrefixInternal(children, result, null, emptyFunction.thatReturnsArgument);
18893 return result;
18894}
18895
18896var ReactChildren = {
18897 forEach: forEachChildren,
18898 map: mapChildren,
18899 mapIntoWithKeyPrefixInternal: mapIntoWithKeyPrefixInternal,
18900 count: countChildren,
18901 toArray: toArray
18902};
18903
18904module.exports = ReactChildren;
18905},{"183":183,"218":218,"294":294,"37":37}],188:[function(require,module,exports){
18906(function (process){
18907/**
18908 * Copyright 2013-present, Facebook, Inc.
18909 * All rights reserved.
18910 *
18911 * This source code is licensed under the BSD-style license found in the
18912 * LICENSE file in the root directory of this source tree. An additional grant
18913 * of patent rights can be found in the PATENTS file in the same directory.
18914 *
18915 * @providesModule ReactClass
18916 */
18917
18918'use strict';
18919
18920var _assign = require(296);
18921
18922var ReactComponent = require(189);
18923var ReactElement = require(218);
18924var ReactPropTypeLocations = require(240);
18925var ReactPropTypeLocationNames = require(239);
18926var ReactNoopUpdateQueue = require(237);
18927
18928var emptyObject = require(38);
18929var invariant = require(45);
18930var keyMirror = require(48);
18931var keyOf = require(49);
18932var warning = require(55);
18933
18934var MIXINS_KEY = keyOf({ mixins: null });
18935
18936/**
18937 * Policies that describe methods in `ReactClassInterface`.
18938 */
18939var SpecPolicy = keyMirror({
18940 /**
18941 * These methods may be defined only once by the class specification or mixin.
18942 */
18943 DEFINE_ONCE: null,
18944 /**
18945 * These methods may be defined by both the class specification and mixins.
18946 * Subsequent definitions will be chained. These methods must return void.
18947 */
18948 DEFINE_MANY: null,
18949 /**
18950 * These methods are overriding the base class.
18951 */
18952 OVERRIDE_BASE: null,
18953 /**
18954 * These methods are similar to DEFINE_MANY, except we assume they return
18955 * objects. We try to merge the keys of the return values of all the mixed in
18956 * functions. If there is a key conflict we throw.
18957 */
18958 DEFINE_MANY_MERGED: null
18959});
18960
18961var injectedMixins = [];
18962
18963/**
18964 * Composite components are higher-level components that compose other composite
18965 * or native components.
18966 *
18967 * To create a new type of `ReactClass`, pass a specification of
18968 * your new class to `React.createClass`. The only requirement of your class
18969 * specification is that you implement a `render` method.
18970 *
18971 * var MyComponent = React.createClass({
18972 * render: function() {
18973 * return <div>Hello World</div>;
18974 * }
18975 * });
18976 *
18977 * The class specification supports a specific protocol of methods that have
18978 * special meaning (e.g. `render`). See `ReactClassInterface` for
18979 * more the comprehensive protocol. Any other properties and methods in the
18980 * class specification will be available on the prototype.
18981 *
18982 * @interface ReactClassInterface
18983 * @internal
18984 */
18985var ReactClassInterface = {
18986
18987 /**
18988 * An array of Mixin objects to include when defining your component.
18989 *
18990 * @type {array}
18991 * @optional
18992 */
18993 mixins: SpecPolicy.DEFINE_MANY,
18994
18995 /**
18996 * An object containing properties and methods that should be defined on
18997 * the component's constructor instead of its prototype (static methods).
18998 *
18999 * @type {object}
19000 * @optional
19001 */
19002 statics: SpecPolicy.DEFINE_MANY,
19003
19004 /**
19005 * Definition of prop types for this component.
19006 *
19007 * @type {object}
19008 * @optional
19009 */
19010 propTypes: SpecPolicy.DEFINE_MANY,
19011
19012 /**
19013 * Definition of context types for this component.
19014 *
19015 * @type {object}
19016 * @optional
19017 */
19018 contextTypes: SpecPolicy.DEFINE_MANY,
19019
19020 /**
19021 * Definition of context types this component sets for its children.
19022 *
19023 * @type {object}
19024 * @optional
19025 */
19026 childContextTypes: SpecPolicy.DEFINE_MANY,
19027
19028 // ==== Definition methods ====
19029
19030 /**
19031 * Invoked when the component is mounted. Values in the mapping will be set on
19032 * `this.props` if that prop is not specified (i.e. using an `in` check).
19033 *
19034 * This method is invoked before `getInitialState` and therefore cannot rely
19035 * on `this.state` or use `this.setState`.
19036 *
19037 * @return {object}
19038 * @optional
19039 */
19040 getDefaultProps: SpecPolicy.DEFINE_MANY_MERGED,
19041
19042 /**
19043 * Invoked once before the component is mounted. The return value will be used
19044 * as the initial value of `this.state`.
19045 *
19046 * getInitialState: function() {
19047 * return {
19048 * isOn: false,
19049 * fooBaz: new BazFoo()
19050 * }
19051 * }
19052 *
19053 * @return {object}
19054 * @optional
19055 */
19056 getInitialState: SpecPolicy.DEFINE_MANY_MERGED,
19057
19058 /**
19059 * @return {object}
19060 * @optional
19061 */
19062 getChildContext: SpecPolicy.DEFINE_MANY_MERGED,
19063
19064 /**
19065 * Uses props from `this.props` and state from `this.state` to render the
19066 * structure of the component.
19067 *
19068 * No guarantees are made about when or how often this method is invoked, so
19069 * it must not have side effects.
19070 *
19071 * render: function() {
19072 * var name = this.props.name;
19073 * return <div>Hello, {name}!</div>;
19074 * }
19075 *
19076 * @return {ReactComponent}
19077 * @nosideeffects
19078 * @required
19079 */
19080 render: SpecPolicy.DEFINE_ONCE,
19081
19082 // ==== Delegate methods ====
19083
19084 /**
19085 * Invoked when the component is initially created and about to be mounted.
19086 * This may have side effects, but any external subscriptions or data created
19087 * by this method must be cleaned up in `componentWillUnmount`.
19088 *
19089 * @optional
19090 */
19091 componentWillMount: SpecPolicy.DEFINE_MANY,
19092
19093 /**
19094 * Invoked when the component has been mounted and has a DOM representation.
19095 * However, there is no guarantee that the DOM node is in the document.
19096 *
19097 * Use this as an opportunity to operate on the DOM when the component has
19098 * been mounted (initialized and rendered) for the first time.
19099 *
19100 * @param {DOMElement} rootNode DOM element representing the component.
19101 * @optional
19102 */
19103 componentDidMount: SpecPolicy.DEFINE_MANY,
19104
19105 /**
19106 * Invoked before the component receives new props.
19107 *
19108 * Use this as an opportunity to react to a prop transition by updating the
19109 * state using `this.setState`. Current props are accessed via `this.props`.
19110 *
19111 * componentWillReceiveProps: function(nextProps, nextContext) {
19112 * this.setState({
19113 * likesIncreasing: nextProps.likeCount > this.props.likeCount
19114 * });
19115 * }
19116 *
19117 * NOTE: There is no equivalent `componentWillReceiveState`. An incoming prop
19118 * transition may cause a state change, but the opposite is not true. If you
19119 * need it, you are probably looking for `componentWillUpdate`.
19120 *
19121 * @param {object} nextProps
19122 * @optional
19123 */
19124 componentWillReceiveProps: SpecPolicy.DEFINE_MANY,
19125
19126 /**
19127 * Invoked while deciding if the component should be updated as a result of
19128 * receiving new props, state and/or context.
19129 *
19130 * Use this as an opportunity to `return false` when you're certain that the
19131 * transition to the new props/state/context will not require a component
19132 * update.
19133 *
19134 * shouldComponentUpdate: function(nextProps, nextState, nextContext) {
19135 * return !equal(nextProps, this.props) ||
19136 * !equal(nextState, this.state) ||
19137 * !equal(nextContext, this.context);
19138 * }
19139 *
19140 * @param {object} nextProps
19141 * @param {?object} nextState
19142 * @param {?object} nextContext
19143 * @return {boolean} True if the component should update.
19144 * @optional
19145 */
19146 shouldComponentUpdate: SpecPolicy.DEFINE_ONCE,
19147
19148 /**
19149 * Invoked when the component is about to update due to a transition from
19150 * `this.props`, `this.state` and `this.context` to `nextProps`, `nextState`
19151 * and `nextContext`.
19152 *
19153 * Use this as an opportunity to perform preparation before an update occurs.
19154 *
19155 * NOTE: You **cannot** use `this.setState()` in this method.
19156 *
19157 * @param {object} nextProps
19158 * @param {?object} nextState
19159 * @param {?object} nextContext
19160 * @param {ReactReconcileTransaction} transaction
19161 * @optional
19162 */
19163 componentWillUpdate: SpecPolicy.DEFINE_MANY,
19164
19165 /**
19166 * Invoked when the component's DOM representation has been updated.
19167 *
19168 * Use this as an opportunity to operate on the DOM when the component has
19169 * been updated.
19170 *
19171 * @param {object} prevProps
19172 * @param {?object} prevState
19173 * @param {?object} prevContext
19174 * @param {DOMElement} rootNode DOM element representing the component.
19175 * @optional
19176 */
19177 componentDidUpdate: SpecPolicy.DEFINE_MANY,
19178
19179 /**
19180 * Invoked when the component is about to be removed from its parent and have
19181 * its DOM representation destroyed.
19182 *
19183 * Use this as an opportunity to deallocate any external resources.
19184 *
19185 * NOTE: There is no `componentDidUnmount` since your component will have been
19186 * destroyed by that point.
19187 *
19188 * @optional
19189 */
19190 componentWillUnmount: SpecPolicy.DEFINE_MANY,
19191
19192 // ==== Advanced methods ====
19193
19194 /**
19195 * Updates the component's currently mounted DOM representation.
19196 *
19197 * By default, this implements React's rendering and reconciliation algorithm.
19198 * Sophisticated clients may wish to override this.
19199 *
19200 * @param {ReactReconcileTransaction} transaction
19201 * @internal
19202 * @overridable
19203 */
19204 updateComponent: SpecPolicy.OVERRIDE_BASE
19205
19206};
19207
19208/**
19209 * Mapping from class specification keys to special processing functions.
19210 *
19211 * Although these are declared like instance properties in the specification
19212 * when defining classes using `React.createClass`, they are actually static
19213 * and are accessible on the constructor instead of the prototype. Despite
19214 * being static, they must be defined outside of the "statics" key under
19215 * which all other static methods are defined.
19216 */
19217var RESERVED_SPEC_KEYS = {
19218 displayName: function (Constructor, displayName) {
19219 Constructor.displayName = displayName;
19220 },
19221 mixins: function (Constructor, mixins) {
19222 if (mixins) {
19223 for (var i = 0; i < mixins.length; i++) {
19224 mixSpecIntoComponent(Constructor, mixins[i]);
19225 }
19226 }
19227 },
19228 childContextTypes: function (Constructor, childContextTypes) {
19229 if (process.env.NODE_ENV !== 'production') {
19230 validateTypeDef(Constructor, childContextTypes, ReactPropTypeLocations.childContext);
19231 }
19232 Constructor.childContextTypes = _assign({}, Constructor.childContextTypes, childContextTypes);
19233 },
19234 contextTypes: function (Constructor, contextTypes) {
19235 if (process.env.NODE_ENV !== 'production') {
19236 validateTypeDef(Constructor, contextTypes, ReactPropTypeLocations.context);
19237 }
19238 Constructor.contextTypes = _assign({}, Constructor.contextTypes, contextTypes);
19239 },
19240 /**
19241 * Special case getDefaultProps which should move into statics but requires
19242 * automatic merging.
19243 */
19244 getDefaultProps: function (Constructor, getDefaultProps) {
19245 if (Constructor.getDefaultProps) {
19246 Constructor.getDefaultProps = createMergedResultFunction(Constructor.getDefaultProps, getDefaultProps);
19247 } else {
19248 Constructor.getDefaultProps = getDefaultProps;
19249 }
19250 },
19251 propTypes: function (Constructor, propTypes) {
19252 if (process.env.NODE_ENV !== 'production') {
19253 validateTypeDef(Constructor, propTypes, ReactPropTypeLocations.prop);
19254 }
19255 Constructor.propTypes = _assign({}, Constructor.propTypes, propTypes);
19256 },
19257 statics: function (Constructor, statics) {
19258 mixStaticSpecIntoComponent(Constructor, statics);
19259 },
19260 autobind: function () {} };
19261
19262// noop
19263function validateTypeDef(Constructor, typeDef, location) {
19264 for (var propName in typeDef) {
19265 if (typeDef.hasOwnProperty(propName)) {
19266 // use a warning instead of an invariant so components
19267 // don't show up in prod but only in __DEV__
19268 process.env.NODE_ENV !== 'production' ? warning(typeof typeDef[propName] === 'function', '%s: %s type `%s` is invalid; it must be a function, usually from ' + 'React.PropTypes.', Constructor.displayName || 'ReactClass', ReactPropTypeLocationNames[location], propName) : void 0;
19269 }
19270 }
19271}
19272
19273function validateMethodOverride(isAlreadyDefined, name) {
19274 var specPolicy = ReactClassInterface.hasOwnProperty(name) ? ReactClassInterface[name] : null;
19275
19276 // Disallow overriding of base class methods unless explicitly allowed.
19277 if (ReactClassMixin.hasOwnProperty(name)) {
19278 !(specPolicy === SpecPolicy.OVERRIDE_BASE) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactClassInterface: You are attempting to override ' + '`%s` from your class specification. Ensure that your method names ' + 'do not overlap with React methods.', name) : invariant(false) : void 0;
19279 }
19280
19281 // Disallow defining methods more than once unless explicitly allowed.
19282 if (isAlreadyDefined) {
19283 !(specPolicy === SpecPolicy.DEFINE_MANY || specPolicy === SpecPolicy.DEFINE_MANY_MERGED) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactClassInterface: You are attempting to define ' + '`%s` on your component more than once. This conflict may be due ' + 'to a mixin.', name) : invariant(false) : void 0;
19284 }
19285}
19286
19287/**
19288 * Mixin helper which handles policy validation and reserved
19289 * specification keys when building React classes.
19290 */
19291function mixSpecIntoComponent(Constructor, spec) {
19292 if (!spec) {
19293 return;
19294 }
19295
19296 !(typeof spec !== 'function') ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactClass: You\'re attempting to ' + 'use a component class or function as a mixin. Instead, just use a ' + 'regular object.') : invariant(false) : void 0;
19297 !!ReactElement.isValidElement(spec) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactClass: You\'re attempting to ' + 'use a component as a mixin. Instead, just use a regular object.') : invariant(false) : void 0;
19298
19299 var proto = Constructor.prototype;
19300 var autoBindPairs = proto.__reactAutoBindPairs;
19301
19302 // By handling mixins before any other properties, we ensure the same
19303 // chaining order is applied to methods with DEFINE_MANY policy, whether
19304 // mixins are listed before or after these methods in the spec.
19305 if (spec.hasOwnProperty(MIXINS_KEY)) {
19306 RESERVED_SPEC_KEYS.mixins(Constructor, spec.mixins);
19307 }
19308
19309 for (var name in spec) {
19310 if (!spec.hasOwnProperty(name)) {
19311 continue;
19312 }
19313
19314 if (name === MIXINS_KEY) {
19315 // We have already handled mixins in a special case above.
19316 continue;
19317 }
19318
19319 var property = spec[name];
19320 var isAlreadyDefined = proto.hasOwnProperty(name);
19321 validateMethodOverride(isAlreadyDefined, name);
19322
19323 if (RESERVED_SPEC_KEYS.hasOwnProperty(name)) {
19324 RESERVED_SPEC_KEYS[name](Constructor, property);
19325 } else {
19326 // Setup methods on prototype:
19327 // The following member methods should not be automatically bound:
19328 // 1. Expected ReactClass methods (in the "interface").
19329 // 2. Overridden methods (that were mixed in).
19330 var isReactClassMethod = ReactClassInterface.hasOwnProperty(name);
19331 var isFunction = typeof property === 'function';
19332 var shouldAutoBind = isFunction && !isReactClassMethod && !isAlreadyDefined && spec.autobind !== false;
19333
19334 if (shouldAutoBind) {
19335 autoBindPairs.push(name, property);
19336 proto[name] = property;
19337 } else {
19338 if (isAlreadyDefined) {
19339 var specPolicy = ReactClassInterface[name];
19340
19341 // These cases should already be caught by validateMethodOverride.
19342 !(isReactClassMethod && (specPolicy === SpecPolicy.DEFINE_MANY_MERGED || specPolicy === SpecPolicy.DEFINE_MANY)) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactClass: Unexpected spec policy %s for key %s ' + 'when mixing in component specs.', specPolicy, name) : invariant(false) : void 0;
19343
19344 // For methods which are defined more than once, call the existing
19345 // methods before calling the new property, merging if appropriate.
19346 if (specPolicy === SpecPolicy.DEFINE_MANY_MERGED) {
19347 proto[name] = createMergedResultFunction(proto[name], property);
19348 } else if (specPolicy === SpecPolicy.DEFINE_MANY) {
19349 proto[name] = createChainedFunction(proto[name], property);
19350 }
19351 } else {
19352 proto[name] = property;
19353 if (process.env.NODE_ENV !== 'production') {
19354 // Add verbose displayName to the function, which helps when looking
19355 // at profiling tools.
19356 if (typeof property === 'function' && spec.displayName) {
19357 proto[name].displayName = spec.displayName + '_' + name;
19358 }
19359 }
19360 }
19361 }
19362 }
19363 }
19364}
19365
19366function mixStaticSpecIntoComponent(Constructor, statics) {
19367 if (!statics) {
19368 return;
19369 }
19370 for (var name in statics) {
19371 var property = statics[name];
19372 if (!statics.hasOwnProperty(name)) {
19373 continue;
19374 }
19375
19376 var isReserved = name in RESERVED_SPEC_KEYS;
19377 !!isReserved ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactClass: You are attempting to define a reserved ' + 'property, `%s`, that shouldn\'t be on the "statics" key. Define it ' + 'as an instance property instead; it will still be accessible on the ' + 'constructor.', name) : invariant(false) : void 0;
19378
19379 var isInherited = name in Constructor;
19380 !!isInherited ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactClass: You are attempting to define ' + '`%s` on your component more than once. This conflict may be ' + 'due to a mixin.', name) : invariant(false) : void 0;
19381 Constructor[name] = property;
19382 }
19383}
19384
19385/**
19386 * Merge two objects, but throw if both contain the same key.
19387 *
19388 * @param {object} one The first object, which is mutated.
19389 * @param {object} two The second object
19390 * @return {object} one after it has been mutated to contain everything in two.
19391 */
19392function mergeIntoWithNoDuplicateKeys(one, two) {
19393 !(one && two && typeof one === 'object' && typeof two === 'object') ? process.env.NODE_ENV !== 'production' ? invariant(false, 'mergeIntoWithNoDuplicateKeys(): Cannot merge non-objects.') : invariant(false) : void 0;
19394
19395 for (var key in two) {
19396 if (two.hasOwnProperty(key)) {
19397 !(one[key] === undefined) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'mergeIntoWithNoDuplicateKeys(): ' + 'Tried to merge two objects with the same key: `%s`. This conflict ' + 'may be due to a mixin; in particular, this may be caused by two ' + 'getInitialState() or getDefaultProps() methods returning objects ' + 'with clashing keys.', key) : invariant(false) : void 0;
19398 one[key] = two[key];
19399 }
19400 }
19401 return one;
19402}
19403
19404/**
19405 * Creates a function that invokes two functions and merges their return values.
19406 *
19407 * @param {function} one Function to invoke first.
19408 * @param {function} two Function to invoke second.
19409 * @return {function} Function that invokes the two argument functions.
19410 * @private
19411 */
19412function createMergedResultFunction(one, two) {
19413 return function mergedResult() {
19414 var a = one.apply(this, arguments);
19415 var b = two.apply(this, arguments);
19416 if (a == null) {
19417 return b;
19418 } else if (b == null) {
19419 return a;
19420 }
19421 var c = {};
19422 mergeIntoWithNoDuplicateKeys(c, a);
19423 mergeIntoWithNoDuplicateKeys(c, b);
19424 return c;
19425 };
19426}
19427
19428/**
19429 * Creates a function that invokes two functions and ignores their return vales.
19430 *
19431 * @param {function} one Function to invoke first.
19432 * @param {function} two Function to invoke second.
19433 * @return {function} Function that invokes the two argument functions.
19434 * @private
19435 */
19436function createChainedFunction(one, two) {
19437 return function chainedFunction() {
19438 one.apply(this, arguments);
19439 two.apply(this, arguments);
19440 };
19441}
19442
19443/**
19444 * Binds a method to the component.
19445 *
19446 * @param {object} component Component whose method is going to be bound.
19447 * @param {function} method Method to be bound.
19448 * @return {function} The bound method.
19449 */
19450function bindAutoBindMethod(component, method) {
19451 var boundMethod = method.bind(component);
19452 if (process.env.NODE_ENV !== 'production') {
19453 boundMethod.__reactBoundContext = component;
19454 boundMethod.__reactBoundMethod = method;
19455 boundMethod.__reactBoundArguments = null;
19456 var componentName = component.constructor.displayName;
19457 var _bind = boundMethod.bind;
19458 boundMethod.bind = function (newThis) {
19459 for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
19460 args[_key - 1] = arguments[_key];
19461 }
19462
19463 // User is trying to bind() an autobound method; we effectively will
19464 // ignore the value of "this" that the user is trying to use, so
19465 // let's warn.
19466 if (newThis !== component && newThis !== null) {
19467 process.env.NODE_ENV !== 'production' ? warning(false, 'bind(): React component methods may only be bound to the ' + 'component instance. See %s', componentName) : void 0;
19468 } else if (!args.length) {
19469 process.env.NODE_ENV !== 'production' ? warning(false, 'bind(): You are binding a component method to the component. ' + 'React does this for you automatically in a high-performance ' + 'way, so you can safely remove this call. See %s', componentName) : void 0;
19470 return boundMethod;
19471 }
19472 var reboundMethod = _bind.apply(boundMethod, arguments);
19473 reboundMethod.__reactBoundContext = component;
19474 reboundMethod.__reactBoundMethod = method;
19475 reboundMethod.__reactBoundArguments = args;
19476 return reboundMethod;
19477 };
19478 }
19479 return boundMethod;
19480}
19481
19482/**
19483 * Binds all auto-bound methods in a component.
19484 *
19485 * @param {object} component Component whose method is going to be bound.
19486 */
19487function bindAutoBindMethods(component) {
19488 var pairs = component.__reactAutoBindPairs;
19489 for (var i = 0; i < pairs.length; i += 2) {
19490 var autoBindKey = pairs[i];
19491 var method = pairs[i + 1];
19492 component[autoBindKey] = bindAutoBindMethod(component, method);
19493 }
19494}
19495
19496/**
19497 * Add more to the ReactClass base class. These are all legacy features and
19498 * therefore not already part of the modern ReactComponent.
19499 */
19500var ReactClassMixin = {
19501
19502 /**
19503 * TODO: This will be deprecated because state should always keep a consistent
19504 * type signature and the only use case for this, is to avoid that.
19505 */
19506 replaceState: function (newState, callback) {
19507 this.updater.enqueueReplaceState(this, newState);
19508 if (callback) {
19509 this.updater.enqueueCallback(this, callback, 'replaceState');
19510 }
19511 },
19512
19513 /**
19514 * Checks whether or not this composite component is mounted.
19515 * @return {boolean} True if mounted, false otherwise.
19516 * @protected
19517 * @final
19518 */
19519 isMounted: function () {
19520 return this.updater.isMounted(this);
19521 }
19522};
19523
19524var ReactClassComponent = function () {};
19525_assign(ReactClassComponent.prototype, ReactComponent.prototype, ReactClassMixin);
19526
19527/**
19528 * Module for creating composite components.
19529 *
19530 * @class ReactClass
19531 */
19532var ReactClass = {
19533
19534 /**
19535 * Creates a composite component class given a class specification.
19536 * See https://facebook.github.io/react/docs/top-level-api.html#react.createclass
19537 *
19538 * @param {object} spec Class specification (which must define `render`).
19539 * @return {function} Component constructor function.
19540 * @public
19541 */
19542 createClass: function (spec) {
19543 var Constructor = function (props, context, updater) {
19544 // This constructor gets overridden by mocks. The argument is used
19545 // by mocks to assert on what gets mounted.
19546
19547 if (process.env.NODE_ENV !== 'production') {
19548 process.env.NODE_ENV !== 'production' ? warning(this instanceof Constructor, 'Something is calling a React component directly. Use a factory or ' + 'JSX instead. See: https://fb.me/react-legacyfactory') : void 0;
19549 }
19550
19551 // Wire up auto-binding
19552 if (this.__reactAutoBindPairs.length) {
19553 bindAutoBindMethods(this);
19554 }
19555
19556 this.props = props;
19557 this.context = context;
19558 this.refs = emptyObject;
19559 this.updater = updater || ReactNoopUpdateQueue;
19560
19561 this.state = null;
19562
19563 // ReactClasses doesn't have constructors. Instead, they use the
19564 // getInitialState and componentWillMount methods for initialization.
19565
19566 var initialState = this.getInitialState ? this.getInitialState() : null;
19567 if (process.env.NODE_ENV !== 'production') {
19568 // We allow auto-mocks to proceed as if they're returning null.
19569 if (initialState === undefined && this.getInitialState._isMockFunction) {
19570 // This is probably bad practice. Consider warning here and
19571 // deprecating this convenience.
19572 initialState = null;
19573 }
19574 }
19575 !(typeof initialState === 'object' && !Array.isArray(initialState)) ? process.env.NODE_ENV !== 'production' ? invariant(false, '%s.getInitialState(): must return an object or null', Constructor.displayName || 'ReactCompositeComponent') : invariant(false) : void 0;
19576
19577 this.state = initialState;
19578 };
19579 Constructor.prototype = new ReactClassComponent();
19580 Constructor.prototype.constructor = Constructor;
19581 Constructor.prototype.__reactAutoBindPairs = [];
19582
19583 injectedMixins.forEach(mixSpecIntoComponent.bind(null, Constructor));
19584
19585 mixSpecIntoComponent(Constructor, spec);
19586
19587 // Initialize the defaultProps property after all mixins have been merged.
19588 if (Constructor.getDefaultProps) {
19589 Constructor.defaultProps = Constructor.getDefaultProps();
19590 }
19591
19592 if (process.env.NODE_ENV !== 'production') {
19593 // This is a tag to indicate that the use of these method names is ok,
19594 // since it's used with createClass. If it's not, then it's likely a
19595 // mistake so we'll warn you to use the static property, property
19596 // initializer or constructor respectively.
19597 if (Constructor.getDefaultProps) {
19598 Constructor.getDefaultProps.isReactClassApproved = {};
19599 }
19600 if (Constructor.prototype.getInitialState) {
19601 Constructor.prototype.getInitialState.isReactClassApproved = {};
19602 }
19603 }
19604
19605 !Constructor.prototype.render ? process.env.NODE_ENV !== 'production' ? invariant(false, 'createClass(...): Class specification must implement a `render` method.') : invariant(false) : void 0;
19606
19607 if (process.env.NODE_ENV !== 'production') {
19608 process.env.NODE_ENV !== 'production' ? warning(!Constructor.prototype.componentShouldUpdate, '%s has a method called ' + 'componentShouldUpdate(). Did you mean shouldComponentUpdate()? ' + 'The name is phrased as a question because the function is ' + 'expected to return a value.', spec.displayName || 'A component') : void 0;
19609 process.env.NODE_ENV !== 'production' ? warning(!Constructor.prototype.componentWillRecieveProps, '%s has a method called ' + 'componentWillRecieveProps(). Did you mean componentWillReceiveProps()?', spec.displayName || 'A component') : void 0;
19610 }
19611
19612 // Reduce time spent doing lookups by setting these on the prototype.
19613 for (var methodName in ReactClassInterface) {
19614 if (!Constructor.prototype[methodName]) {
19615 Constructor.prototype[methodName] = null;
19616 }
19617 }
19618
19619 return Constructor;
19620 },
19621
19622 injection: {
19623 injectMixin: function (mixin) {
19624 injectedMixins.push(mixin);
19625 }
19626 }
19627
19628};
19629
19630module.exports = ReactClass;
19631}).call(this,require(91))
19632},{"189":189,"218":218,"237":237,"239":239,"240":240,"296":296,"38":38,"45":45,"48":48,"49":49,"55":55,"91":91}],189:[function(require,module,exports){
19633(function (process){
19634/**
19635 * Copyright 2013-present, Facebook, Inc.
19636 * All rights reserved.
19637 *
19638 * This source code is licensed under the BSD-style license found in the
19639 * LICENSE file in the root directory of this source tree. An additional grant
19640 * of patent rights can be found in the PATENTS file in the same directory.
19641 *
19642 * @providesModule ReactComponent
19643 */
19644
19645'use strict';
19646
19647var ReactNoopUpdateQueue = require(237);
19648var ReactInstrumentation = require(228);
19649
19650var canDefineProperty = require(269);
19651var emptyObject = require(38);
19652var invariant = require(45);
19653var warning = require(55);
19654
19655/**
19656 * Base class helpers for the updating state of a component.
19657 */
19658function ReactComponent(props, context, updater) {
19659 this.props = props;
19660 this.context = context;
19661 this.refs = emptyObject;
19662 // We initialize the default updater but the real one gets injected by the
19663 // renderer.
19664 this.updater = updater || ReactNoopUpdateQueue;
19665}
19666
19667ReactComponent.prototype.isReactComponent = {};
19668
19669/**
19670 * Sets a subset of the state. Always use this to mutate
19671 * state. You should treat `this.state` as immutable.
19672 *
19673 * There is no guarantee that `this.state` will be immediately updated, so
19674 * accessing `this.state` after calling this method may return the old value.
19675 *
19676 * There is no guarantee that calls to `setState` will run synchronously,
19677 * as they may eventually be batched together. You can provide an optional
19678 * callback that will be executed when the call to setState is actually
19679 * completed.
19680 *
19681 * When a function is provided to setState, it will be called at some point in
19682 * the future (not synchronously). It will be called with the up to date
19683 * component arguments (state, props, context). These values can be different
19684 * from this.* because your function may be called after receiveProps but before
19685 * shouldComponentUpdate, and this new state, props, and context will not yet be
19686 * assigned to this.
19687 *
19688 * @param {object|function} partialState Next partial state or function to
19689 * produce next partial state to be merged with current state.
19690 * @param {?function} callback Called after state is updated.
19691 * @final
19692 * @protected
19693 */
19694ReactComponent.prototype.setState = function (partialState, callback) {
19695 !(typeof partialState === 'object' || typeof partialState === 'function' || partialState == null) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'setState(...): takes an object of state variables to update or a ' + 'function which returns an object of state variables.') : invariant(false) : void 0;
19696 if (process.env.NODE_ENV !== 'production') {
19697 ReactInstrumentation.debugTool.onSetState();
19698 process.env.NODE_ENV !== 'production' ? warning(partialState != null, 'setState(...): You passed an undefined or null state object; ' + 'instead, use forceUpdate().') : void 0;
19699 }
19700 this.updater.enqueueSetState(this, partialState);
19701 if (callback) {
19702 this.updater.enqueueCallback(this, callback, 'setState');
19703 }
19704};
19705
19706/**
19707 * Forces an update. This should only be invoked when it is known with
19708 * certainty that we are **not** in a DOM transaction.
19709 *
19710 * You may want to call this when you know that some deeper aspect of the
19711 * component's state has changed but `setState` was not called.
19712 *
19713 * This will not invoke `shouldComponentUpdate`, but it will invoke
19714 * `componentWillUpdate` and `componentDidUpdate`.
19715 *
19716 * @param {?function} callback Called after update is complete.
19717 * @final
19718 * @protected
19719 */
19720ReactComponent.prototype.forceUpdate = function (callback) {
19721 this.updater.enqueueForceUpdate(this);
19722 if (callback) {
19723 this.updater.enqueueCallback(this, callback, 'forceUpdate');
19724 }
19725};
19726
19727/**
19728 * Deprecated APIs. These APIs used to exist on classic React classes but since
19729 * we would like to deprecate them, we're not going to move them over to this
19730 * modern base class. Instead, we define a getter that warns if it's accessed.
19731 */
19732if (process.env.NODE_ENV !== 'production') {
19733 var deprecatedAPIs = {
19734 isMounted: ['isMounted', 'Instead, make sure to clean up subscriptions and pending requests in ' + 'componentWillUnmount to prevent memory leaks.'],
19735 replaceState: ['replaceState', 'Refactor your code to use setState instead (see ' + 'https://github.com/facebook/react/issues/3236).']
19736 };
19737 var defineDeprecationWarning = function (methodName, info) {
19738 if (canDefineProperty) {
19739 Object.defineProperty(ReactComponent.prototype, methodName, {
19740 get: function () {
19741 process.env.NODE_ENV !== 'production' ? warning(false, '%s(...) is deprecated in plain JavaScript React classes. %s', info[0], info[1]) : void 0;
19742 return undefined;
19743 }
19744 });
19745 }
19746 };
19747 for (var fnName in deprecatedAPIs) {
19748 if (deprecatedAPIs.hasOwnProperty(fnName)) {
19749 defineDeprecationWarning(fnName, deprecatedAPIs[fnName]);
19750 }
19751 }
19752}
19753
19754module.exports = ReactComponent;
19755}).call(this,require(91))
19756},{"228":228,"237":237,"269":269,"38":38,"45":45,"55":55,"91":91}],190:[function(require,module,exports){
19757/**
19758 * Copyright 2013-present, Facebook, Inc.
19759 * All rights reserved.
19760 *
19761 * This source code is licensed under the BSD-style license found in the
19762 * LICENSE file in the root directory of this source tree. An additional grant
19763 * of patent rights can be found in the PATENTS file in the same directory.
19764 *
19765 * @providesModule ReactComponentBrowserEnvironment
19766 */
19767
19768'use strict';
19769
19770var DOMChildrenOperations = require(165);
19771var ReactDOMIDOperations = require(205);
19772
19773/**
19774 * Abstracts away all functionality of the reconciler that requires knowledge of
19775 * the browser context. TODO: These callers should be refactored to avoid the
19776 * need for this injection.
19777 */
19778var ReactComponentBrowserEnvironment = {
19779
19780 processChildrenUpdates: ReactDOMIDOperations.dangerouslyProcessChildrenUpdates,
19781
19782 replaceNodeWithMarkup: DOMChildrenOperations.dangerouslyReplaceNodeWithMarkup,
19783
19784 /**
19785 * If a particular environment requires that some resources be cleaned up,
19786 * specify this in the injected Mixin. In the DOM, we would likely want to
19787 * purge any cached node ID lookups.
19788 *
19789 * @private
19790 */
19791 unmountIDFromEnvironment: function (rootNodeID) {}
19792
19793};
19794
19795module.exports = ReactComponentBrowserEnvironment;
19796},{"165":165,"205":205}],191:[function(require,module,exports){
19797(function (process){
19798/**
19799 * Copyright 2014-present, Facebook, Inc.
19800 * All rights reserved.
19801 *
19802 * This source code is licensed under the BSD-style license found in the
19803 * LICENSE file in the root directory of this source tree. An additional grant
19804 * of patent rights can be found in the PATENTS file in the same directory.
19805 *
19806 * @providesModule ReactComponentEnvironment
19807 */
19808
19809'use strict';
19810
19811var invariant = require(45);
19812
19813var injected = false;
19814
19815var ReactComponentEnvironment = {
19816
19817 /**
19818 * Optionally injectable environment dependent cleanup hook. (server vs.
19819 * browser etc). Example: A browser system caches DOM nodes based on component
19820 * ID and must remove that cache entry when this instance is unmounted.
19821 */
19822 unmountIDFromEnvironment: null,
19823
19824 /**
19825 * Optionally injectable hook for swapping out mount images in the middle of
19826 * the tree.
19827 */
19828 replaceNodeWithMarkup: null,
19829
19830 /**
19831 * Optionally injectable hook for processing a queue of child updates. Will
19832 * later move into MultiChildComponents.
19833 */
19834 processChildrenUpdates: null,
19835
19836 injection: {
19837 injectEnvironment: function (environment) {
19838 !!injected ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactCompositeComponent: injectEnvironment() can only be called once.') : invariant(false) : void 0;
19839 ReactComponentEnvironment.unmountIDFromEnvironment = environment.unmountIDFromEnvironment;
19840 ReactComponentEnvironment.replaceNodeWithMarkup = environment.replaceNodeWithMarkup;
19841 ReactComponentEnvironment.processChildrenUpdates = environment.processChildrenUpdates;
19842 injected = true;
19843 }
19844 }
19845
19846};
19847
19848module.exports = ReactComponentEnvironment;
19849}).call(this,require(91))
19850},{"45":45,"91":91}],192:[function(require,module,exports){
19851(function (process){
19852/**
19853 * Copyright 2016-present, Facebook, Inc.
19854 * All rights reserved.
19855 *
19856 * This source code is licensed under the BSD-style license found in the
19857 * LICENSE file in the root directory of this source tree. An additional grant
19858 * of patent rights can be found in the PATENTS file in the same directory.
19859 *
19860 * @providesModule ReactComponentTreeDevtool
19861 */
19862
19863'use strict';
19864
19865var invariant = require(45);
19866
19867var tree = {};
19868var rootIDs = [];
19869
19870function updateTree(id, update) {
19871 if (!tree[id]) {
19872 tree[id] = {
19873 parentID: null,
19874 ownerID: null,
19875 text: null,
19876 childIDs: [],
19877 displayName: 'Unknown',
19878 isMounted: false,
19879 updateCount: 0
19880 };
19881 }
19882 update(tree[id]);
19883}
19884
19885function purgeDeep(id) {
19886 var item = tree[id];
19887 if (item) {
19888 var childIDs = item.childIDs;
19889
19890 delete tree[id];
19891 childIDs.forEach(purgeDeep);
19892 }
19893}
19894
19895var ReactComponentTreeDevtool = {
19896 onSetDisplayName: function (id, displayName) {
19897 updateTree(id, function (item) {
19898 return item.displayName = displayName;
19899 });
19900 },
19901 onSetChildren: function (id, nextChildIDs) {
19902 updateTree(id, function (item) {
19903 var prevChildIDs = item.childIDs;
19904 item.childIDs = nextChildIDs;
19905
19906 nextChildIDs.forEach(function (nextChildID) {
19907 var nextChild = tree[nextChildID];
19908 !nextChild ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Expected devtool events to fire for the child ' + 'before its parent includes it in onSetChildren().') : invariant(false) : void 0;
19909 !(nextChild.displayName != null) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Expected onSetDisplayName() to fire for the child ' + 'before its parent includes it in onSetChildren().') : invariant(false) : void 0;
19910 !(nextChild.childIDs != null || nextChild.text != null) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Expected onSetChildren() or onSetText() to fire for the child ' + 'before its parent includes it in onSetChildren().') : invariant(false) : void 0;
19911 !nextChild.isMounted ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Expected onMountComponent() to fire for the child ' + 'before its parent includes it in onSetChildren().') : invariant(false) : void 0;
19912
19913 if (prevChildIDs.indexOf(nextChildID) === -1) {
19914 nextChild.parentID = id;
19915 }
19916 });
19917 });
19918 },
19919 onSetOwner: function (id, ownerID) {
19920 updateTree(id, function (item) {
19921 return item.ownerID = ownerID;
19922 });
19923 },
19924 onSetText: function (id, text) {
19925 updateTree(id, function (item) {
19926 return item.text = text;
19927 });
19928 },
19929 onMountComponent: function (id) {
19930 updateTree(id, function (item) {
19931 return item.isMounted = true;
19932 });
19933 },
19934 onMountRootComponent: function (id) {
19935 rootIDs.push(id);
19936 },
19937 onUpdateComponent: function (id) {
19938 updateTree(id, function (item) {
19939 return item.updateCount++;
19940 });
19941 },
19942 onUnmountComponent: function (id) {
19943 updateTree(id, function (item) {
19944 return item.isMounted = false;
19945 });
19946 rootIDs = rootIDs.filter(function (rootID) {
19947 return rootID !== id;
19948 });
19949 },
19950 purgeUnmountedComponents: function () {
19951 if (ReactComponentTreeDevtool._preventPurging) {
19952 // Should only be used for testing.
19953 return;
19954 }
19955
19956 Object.keys(tree).filter(function (id) {
19957 return !tree[id].isMounted;
19958 }).forEach(purgeDeep);
19959 },
19960 isMounted: function (id) {
19961 var item = tree[id];
19962 return item ? item.isMounted : false;
19963 },
19964 getChildIDs: function (id) {
19965 var item = tree[id];
19966 return item ? item.childIDs : [];
19967 },
19968 getDisplayName: function (id) {
19969 var item = tree[id];
19970 return item ? item.displayName : 'Unknown';
19971 },
19972 getOwnerID: function (id) {
19973 var item = tree[id];
19974 return item ? item.ownerID : null;
19975 },
19976 getParentID: function (id) {
19977 var item = tree[id];
19978 return item ? item.parentID : null;
19979 },
19980 getText: function (id) {
19981 var item = tree[id];
19982 return item ? item.text : null;
19983 },
19984 getUpdateCount: function (id) {
19985 var item = tree[id];
19986 return item ? item.updateCount : 0;
19987 },
19988 getRootIDs: function () {
19989 return rootIDs;
19990 },
19991 getRegisteredIDs: function () {
19992 return Object.keys(tree);
19993 }
19994};
19995
19996module.exports = ReactComponentTreeDevtool;
19997}).call(this,require(91))
19998},{"45":45,"91":91}],193:[function(require,module,exports){
19999(function (process){
20000/**
20001 * Copyright 2013-present, Facebook, Inc.
20002 * All rights reserved.
20003 *
20004 * This source code is licensed under the BSD-style license found in the
20005 * LICENSE file in the root directory of this source tree. An additional grant
20006 * of patent rights can be found in the PATENTS file in the same directory.
20007 *
20008 * @providesModule ReactCompositeComponent
20009 */
20010
20011'use strict';
20012
20013var _assign = require(296);
20014
20015var ReactComponentEnvironment = require(191);
20016var ReactCurrentOwner = require(194);
20017var ReactElement = require(218);
20018var ReactErrorUtils = require(221);
20019var ReactInstanceMap = require(227);
20020var ReactInstrumentation = require(228);
20021var ReactNodeTypes = require(236);
20022var ReactPropTypeLocations = require(240);
20023var ReactPropTypeLocationNames = require(239);
20024var ReactReconciler = require(243);
20025var ReactUpdateQueue = require(246);
20026
20027var emptyObject = require(38);
20028var invariant = require(45);
20029var shouldUpdateReactComponent = require(293);
20030var warning = require(55);
20031
20032function getDeclarationErrorAddendum(component) {
20033 var owner = component._currentElement._owner || null;
20034 if (owner) {
20035 var name = owner.getName();
20036 if (name) {
20037 return ' Check the render method of `' + name + '`.';
20038 }
20039 }
20040 return '';
20041}
20042
20043function StatelessComponent(Component) {}
20044StatelessComponent.prototype.render = function () {
20045 var Component = ReactInstanceMap.get(this)._currentElement.type;
20046 var element = Component(this.props, this.context, this.updater);
20047 warnIfInvalidElement(Component, element);
20048 return element;
20049};
20050
20051function warnIfInvalidElement(Component, element) {
20052 if (process.env.NODE_ENV !== 'production') {
20053 process.env.NODE_ENV !== 'production' ? warning(element === null || element === false || ReactElement.isValidElement(element), '%s(...): A valid React element (or null) must be returned. You may have ' + 'returned undefined, an array or some other invalid object.', Component.displayName || Component.name || 'Component') : void 0;
20054 }
20055}
20056
20057function invokeComponentDidMountWithTimer() {
20058 var publicInstance = this._instance;
20059 if (this._debugID !== 0) {
20060 ReactInstrumentation.debugTool.onBeginLifeCycleTimer(this._debugID, 'componentDidMount');
20061 }
20062 publicInstance.componentDidMount();
20063 if (this._debugID !== 0) {
20064 ReactInstrumentation.debugTool.onEndLifeCycleTimer(this._debugID, 'componentDidMount');
20065 }
20066}
20067
20068function invokeComponentDidUpdateWithTimer(prevProps, prevState, prevContext) {
20069 var publicInstance = this._instance;
20070 if (this._debugID !== 0) {
20071 ReactInstrumentation.debugTool.onBeginLifeCycleTimer(this._debugID, 'componentDidUpdate');
20072 }
20073 publicInstance.componentDidUpdate(prevProps, prevState, prevContext);
20074 if (this._debugID !== 0) {
20075 ReactInstrumentation.debugTool.onEndLifeCycleTimer(this._debugID, 'componentDidUpdate');
20076 }
20077}
20078
20079function shouldConstruct(Component) {
20080 return Component.prototype && Component.prototype.isReactComponent;
20081}
20082
20083/**
20084 * ------------------ The Life-Cycle of a Composite Component ------------------
20085 *
20086 * - constructor: Initialization of state. The instance is now retained.
20087 * - componentWillMount
20088 * - render
20089 * - [children's constructors]
20090 * - [children's componentWillMount and render]
20091 * - [children's componentDidMount]
20092 * - componentDidMount
20093 *
20094 * Update Phases:
20095 * - componentWillReceiveProps (only called if parent updated)
20096 * - shouldComponentUpdate
20097 * - componentWillUpdate
20098 * - render
20099 * - [children's constructors or receive props phases]
20100 * - componentDidUpdate
20101 *
20102 * - componentWillUnmount
20103 * - [children's componentWillUnmount]
20104 * - [children destroyed]
20105 * - (destroyed): The instance is now blank, released by React and ready for GC.
20106 *
20107 * -----------------------------------------------------------------------------
20108 */
20109
20110/**
20111 * An incrementing ID assigned to each component when it is mounted. This is
20112 * used to enforce the order in which `ReactUpdates` updates dirty components.
20113 *
20114 * @private
20115 */
20116var nextMountID = 1;
20117
20118/**
20119 * @lends {ReactCompositeComponent.prototype}
20120 */
20121var ReactCompositeComponentMixin = {
20122
20123 /**
20124 * Base constructor for all composite component.
20125 *
20126 * @param {ReactElement} element
20127 * @final
20128 * @internal
20129 */
20130 construct: function (element) {
20131 this._currentElement = element;
20132 this._rootNodeID = null;
20133 this._instance = null;
20134 this._nativeParent = null;
20135 this._nativeContainerInfo = null;
20136
20137 // See ReactUpdateQueue
20138 this._updateBatchNumber = null;
20139 this._pendingElement = null;
20140 this._pendingStateQueue = null;
20141 this._pendingReplaceState = false;
20142 this._pendingForceUpdate = false;
20143
20144 this._renderedNodeType = null;
20145 this._renderedComponent = null;
20146 this._context = null;
20147 this._mountOrder = 0;
20148 this._topLevelWrapper = null;
20149
20150 // See ReactUpdates and ReactUpdateQueue.
20151 this._pendingCallbacks = null;
20152
20153 // ComponentWillUnmount shall only be called once
20154 this._calledComponentWillUnmount = false;
20155 },
20156
20157 /**
20158 * Initializes the component, renders markup, and registers event listeners.
20159 *
20160 * @param {ReactReconcileTransaction|ReactServerRenderingTransaction} transaction
20161 * @param {?object} nativeParent
20162 * @param {?object} nativeContainerInfo
20163 * @param {?object} context
20164 * @return {?string} Rendered markup to be inserted into the DOM.
20165 * @final
20166 * @internal
20167 */
20168 mountComponent: function (transaction, nativeParent, nativeContainerInfo, context) {
20169 this._context = context;
20170 this._mountOrder = nextMountID++;
20171 this._nativeParent = nativeParent;
20172 this._nativeContainerInfo = nativeContainerInfo;
20173
20174 var publicProps = this._processProps(this._currentElement.props);
20175 var publicContext = this._processContext(context);
20176
20177 var Component = this._currentElement.type;
20178
20179 // Initialize the public class
20180 var inst = this._constructComponent(publicProps, publicContext);
20181 var renderedElement;
20182
20183 // Support functional components
20184 if (!shouldConstruct(Component) && (inst == null || inst.render == null)) {
20185 renderedElement = inst;
20186 warnIfInvalidElement(Component, renderedElement);
20187 !(inst === null || inst === false || ReactElement.isValidElement(inst)) ? process.env.NODE_ENV !== 'production' ? invariant(false, '%s(...): A valid React element (or null) must be returned. You may have ' + 'returned undefined, an array or some other invalid object.', Component.displayName || Component.name || 'Component') : invariant(false) : void 0;
20188 inst = new StatelessComponent(Component);
20189 }
20190
20191 if (process.env.NODE_ENV !== 'production') {
20192 // This will throw later in _renderValidatedComponent, but add an early
20193 // warning now to help debugging
20194 if (inst.render == null) {
20195 process.env.NODE_ENV !== 'production' ? warning(false, '%s(...): No `render` method found on the returned component ' + 'instance: you may have forgotten to define `render`.', Component.displayName || Component.name || 'Component') : void 0;
20196 }
20197
20198 var propsMutated = inst.props !== publicProps;
20199 var componentName = Component.displayName || Component.name || 'Component';
20200
20201 process.env.NODE_ENV !== 'production' ? warning(inst.props === undefined || !propsMutated, '%s(...): When calling super() in `%s`, make sure to pass ' + 'up the same props that your component\'s constructor was passed.', componentName, componentName) : void 0;
20202 }
20203
20204 // These should be set up in the constructor, but as a convenience for
20205 // simpler class abstractions, we set them up after the fact.
20206 inst.props = publicProps;
20207 inst.context = publicContext;
20208 inst.refs = emptyObject;
20209 inst.updater = ReactUpdateQueue;
20210
20211 this._instance = inst;
20212
20213 // Store a reference from the instance back to the internal representation
20214 ReactInstanceMap.set(inst, this);
20215
20216 if (process.env.NODE_ENV !== 'production') {
20217 // Since plain JS classes are defined without any special initialization
20218 // logic, we can not catch common errors early. Therefore, we have to
20219 // catch them here, at initialization time, instead.
20220 process.env.NODE_ENV !== 'production' ? warning(!inst.getInitialState || inst.getInitialState.isReactClassApproved, 'getInitialState was defined on %s, a plain JavaScript class. ' + 'This is only supported for classes created using React.createClass. ' + 'Did you mean to define a state property instead?', this.getName() || 'a component') : void 0;
20221 process.env.NODE_ENV !== 'production' ? warning(!inst.getDefaultProps || inst.getDefaultProps.isReactClassApproved, 'getDefaultProps was defined on %s, a plain JavaScript class. ' + 'This is only supported for classes created using React.createClass. ' + 'Use a static property to define defaultProps instead.', this.getName() || 'a component') : void 0;
20222 process.env.NODE_ENV !== 'production' ? warning(!inst.propTypes, 'propTypes was defined as an instance property on %s. Use a static ' + 'property to define propTypes instead.', this.getName() || 'a component') : void 0;
20223 process.env.NODE_ENV !== 'production' ? warning(!inst.contextTypes, 'contextTypes was defined as an instance property on %s. Use a ' + 'static property to define contextTypes instead.', this.getName() || 'a component') : void 0;
20224 process.env.NODE_ENV !== 'production' ? warning(typeof inst.componentShouldUpdate !== 'function', '%s has a method called ' + 'componentShouldUpdate(). Did you mean shouldComponentUpdate()? ' + 'The name is phrased as a question because the function is ' + 'expected to return a value.', this.getName() || 'A component') : void 0;
20225 process.env.NODE_ENV !== 'production' ? warning(typeof inst.componentDidUnmount !== 'function', '%s has a method called ' + 'componentDidUnmount(). But there is no such lifecycle method. ' + 'Did you mean componentWillUnmount()?', this.getName() || 'A component') : void 0;
20226 process.env.NODE_ENV !== 'production' ? warning(typeof inst.componentWillRecieveProps !== 'function', '%s has a method called ' + 'componentWillRecieveProps(). Did you mean componentWillReceiveProps()?', this.getName() || 'A component') : void 0;
20227 }
20228
20229 var initialState = inst.state;
20230 if (initialState === undefined) {
20231 inst.state = initialState = null;
20232 }
20233 !(typeof initialState === 'object' && !Array.isArray(initialState)) ? process.env.NODE_ENV !== 'production' ? invariant(false, '%s.state: must be set to an object or null', this.getName() || 'ReactCompositeComponent') : invariant(false) : void 0;
20234
20235 this._pendingStateQueue = null;
20236 this._pendingReplaceState = false;
20237 this._pendingForceUpdate = false;
20238
20239 var markup;
20240 if (inst.unstable_handleError) {
20241 markup = this.performInitialMountWithErrorHandling(renderedElement, nativeParent, nativeContainerInfo, transaction, context);
20242 } else {
20243 markup = this.performInitialMount(renderedElement, nativeParent, nativeContainerInfo, transaction, context);
20244 }
20245
20246 if (inst.componentDidMount) {
20247 if (process.env.NODE_ENV !== 'production') {
20248 transaction.getReactMountReady().enqueue(invokeComponentDidMountWithTimer, this);
20249 } else {
20250 transaction.getReactMountReady().enqueue(inst.componentDidMount, inst);
20251 }
20252 }
20253
20254 return markup;
20255 },
20256
20257 _constructComponent: function (publicProps, publicContext) {
20258 if (process.env.NODE_ENV !== 'production') {
20259 ReactCurrentOwner.current = this;
20260 try {
20261 return this._constructComponentWithoutOwner(publicProps, publicContext);
20262 } finally {
20263 ReactCurrentOwner.current = null;
20264 }
20265 } else {
20266 return this._constructComponentWithoutOwner(publicProps, publicContext);
20267 }
20268 },
20269
20270 _constructComponentWithoutOwner: function (publicProps, publicContext) {
20271 var Component = this._currentElement.type;
20272 var instanceOrElement;
20273 if (shouldConstruct(Component)) {
20274 if (process.env.NODE_ENV !== 'production') {
20275 if (this._debugID !== 0) {
20276 ReactInstrumentation.debugTool.onBeginLifeCycleTimer(this._debugID, 'ctor');
20277 }
20278 }
20279 instanceOrElement = new Component(publicProps, publicContext, ReactUpdateQueue);
20280 if (process.env.NODE_ENV !== 'production') {
20281 if (this._debugID !== 0) {
20282 ReactInstrumentation.debugTool.onEndLifeCycleTimer(this._debugID, 'ctor');
20283 }
20284 }
20285 } else {
20286 // This can still be an instance in case of factory components
20287 // but we'll count this as time spent rendering as the more common case.
20288 if (process.env.NODE_ENV !== 'production') {
20289 if (this._debugID !== 0) {
20290 ReactInstrumentation.debugTool.onBeginLifeCycleTimer(this._debugID, 'render');
20291 }
20292 }
20293 instanceOrElement = Component(publicProps, publicContext, ReactUpdateQueue);
20294 if (process.env.NODE_ENV !== 'production') {
20295 if (this._debugID !== 0) {
20296 ReactInstrumentation.debugTool.onEndLifeCycleTimer(this._debugID, 'render');
20297 }
20298 }
20299 }
20300 return instanceOrElement;
20301 },
20302
20303 performInitialMountWithErrorHandling: function (renderedElement, nativeParent, nativeContainerInfo, transaction, context) {
20304 var markup;
20305 var checkpoint = transaction.checkpoint();
20306 try {
20307 markup = this.performInitialMount(renderedElement, nativeParent, nativeContainerInfo, transaction, context);
20308 } catch (e) {
20309 // Roll back to checkpoint, handle error (which may add items to the transaction), and take a new checkpoint
20310 transaction.rollback(checkpoint);
20311 this._instance.unstable_handleError(e);
20312 if (this._pendingStateQueue) {
20313 this._instance.state = this._processPendingState(this._instance.props, this._instance.context);
20314 }
20315 checkpoint = transaction.checkpoint();
20316
20317 this._renderedComponent.unmountComponent(true);
20318 transaction.rollback(checkpoint);
20319
20320 // Try again - we've informed the component about the error, so they can render an error message this time.
20321 // If this throws again, the error will bubble up (and can be caught by a higher error boundary).
20322 markup = this.performInitialMount(renderedElement, nativeParent, nativeContainerInfo, transaction, context);
20323 }
20324 return markup;
20325 },
20326
20327 performInitialMount: function (renderedElement, nativeParent, nativeContainerInfo, transaction, context) {
20328 var inst = this._instance;
20329 if (inst.componentWillMount) {
20330 if (process.env.NODE_ENV !== 'production') {
20331 if (this._debugID !== 0) {
20332 ReactInstrumentation.debugTool.onBeginLifeCycleTimer(this._debugID, 'componentWillMount');
20333 }
20334 }
20335 inst.componentWillMount();
20336 if (process.env.NODE_ENV !== 'production') {
20337 if (this._debugID !== 0) {
20338 ReactInstrumentation.debugTool.onEndLifeCycleTimer(this._debugID, 'componentWillMount');
20339 }
20340 }
20341 // When mounting, calls to `setState` by `componentWillMount` will set
20342 // `this._pendingStateQueue` without triggering a re-render.
20343 if (this._pendingStateQueue) {
20344 inst.state = this._processPendingState(inst.props, inst.context);
20345 }
20346 }
20347
20348 // If not a stateless component, we now render
20349 if (renderedElement === undefined) {
20350 renderedElement = this._renderValidatedComponent();
20351 }
20352
20353 this._renderedNodeType = ReactNodeTypes.getType(renderedElement);
20354 this._renderedComponent = this._instantiateReactComponent(renderedElement);
20355
20356 var markup = ReactReconciler.mountComponent(this._renderedComponent, transaction, nativeParent, nativeContainerInfo, this._processChildContext(context));
20357
20358 if (process.env.NODE_ENV !== 'production') {
20359 if (this._debugID !== 0) {
20360 ReactInstrumentation.debugTool.onSetChildren(this._debugID, this._renderedComponent._debugID !== 0 ? [this._renderedComponent._debugID] : []);
20361 }
20362 }
20363
20364 return markup;
20365 },
20366
20367 getNativeNode: function () {
20368 return ReactReconciler.getNativeNode(this._renderedComponent);
20369 },
20370
20371 /**
20372 * Releases any resources allocated by `mountComponent`.
20373 *
20374 * @final
20375 * @internal
20376 */
20377 unmountComponent: function (safely) {
20378 if (!this._renderedComponent) {
20379 return;
20380 }
20381 var inst = this._instance;
20382
20383 if (inst.componentWillUnmount && !inst._calledComponentWillUnmount) {
20384 inst._calledComponentWillUnmount = true;
20385 if (process.env.NODE_ENV !== 'production') {
20386 if (this._debugID !== 0) {
20387 ReactInstrumentation.debugTool.onBeginLifeCycleTimer(this._debugID, 'componentWillUnmount');
20388 }
20389 }
20390 if (safely) {
20391 var name = this.getName() + '.componentWillUnmount()';
20392 ReactErrorUtils.invokeGuardedCallback(name, inst.componentWillUnmount.bind(inst));
20393 } else {
20394 inst.componentWillUnmount();
20395 }
20396 if (process.env.NODE_ENV !== 'production') {
20397 if (this._debugID !== 0) {
20398 ReactInstrumentation.debugTool.onEndLifeCycleTimer(this._debugID, 'componentWillUnmount');
20399 }
20400 }
20401 }
20402
20403 if (this._renderedComponent) {
20404 ReactReconciler.unmountComponent(this._renderedComponent, safely);
20405 this._renderedNodeType = null;
20406 this._renderedComponent = null;
20407 this._instance = null;
20408 }
20409
20410 // Reset pending fields
20411 // Even if this component is scheduled for another update in ReactUpdates,
20412 // it would still be ignored because these fields are reset.
20413 this._pendingStateQueue = null;
20414 this._pendingReplaceState = false;
20415 this._pendingForceUpdate = false;
20416 this._pendingCallbacks = null;
20417 this._pendingElement = null;
20418
20419 // These fields do not really need to be reset since this object is no
20420 // longer accessible.
20421 this._context = null;
20422 this._rootNodeID = null;
20423 this._topLevelWrapper = null;
20424
20425 // Delete the reference from the instance to this internal representation
20426 // which allow the internals to be properly cleaned up even if the user
20427 // leaks a reference to the public instance.
20428 ReactInstanceMap.remove(inst);
20429
20430 // Some existing components rely on inst.props even after they've been
20431 // destroyed (in event handlers).
20432 // TODO: inst.props = null;
20433 // TODO: inst.state = null;
20434 // TODO: inst.context = null;
20435 },
20436
20437 /**
20438 * Filters the context object to only contain keys specified in
20439 * `contextTypes`
20440 *
20441 * @param {object} context
20442 * @return {?object}
20443 * @private
20444 */
20445 _maskContext: function (context) {
20446 var Component = this._currentElement.type;
20447 var contextTypes = Component.contextTypes;
20448 if (!contextTypes) {
20449 return emptyObject;
20450 }
20451 var maskedContext = {};
20452 for (var contextName in contextTypes) {
20453 maskedContext[contextName] = context[contextName];
20454 }
20455 return maskedContext;
20456 },
20457
20458 /**
20459 * Filters the context object to only contain keys specified in
20460 * `contextTypes`, and asserts that they are valid.
20461 *
20462 * @param {object} context
20463 * @return {?object}
20464 * @private
20465 */
20466 _processContext: function (context) {
20467 var maskedContext = this._maskContext(context);
20468 if (process.env.NODE_ENV !== 'production') {
20469 var Component = this._currentElement.type;
20470 if (Component.contextTypes) {
20471 this._checkPropTypes(Component.contextTypes, maskedContext, ReactPropTypeLocations.context);
20472 }
20473 }
20474 return maskedContext;
20475 },
20476
20477 /**
20478 * @param {object} currentContext
20479 * @return {object}
20480 * @private
20481 */
20482 _processChildContext: function (currentContext) {
20483 var Component = this._currentElement.type;
20484 var inst = this._instance;
20485 if (process.env.NODE_ENV !== 'production') {
20486 ReactInstrumentation.debugTool.onBeginProcessingChildContext();
20487 }
20488 var childContext = inst.getChildContext && inst.getChildContext();
20489 if (process.env.NODE_ENV !== 'production') {
20490 ReactInstrumentation.debugTool.onEndProcessingChildContext();
20491 }
20492 if (childContext) {
20493 !(typeof Component.childContextTypes === 'object') ? process.env.NODE_ENV !== 'production' ? invariant(false, '%s.getChildContext(): childContextTypes must be defined in order to ' + 'use getChildContext().', this.getName() || 'ReactCompositeComponent') : invariant(false) : void 0;
20494 if (process.env.NODE_ENV !== 'production') {
20495 this._checkPropTypes(Component.childContextTypes, childContext, ReactPropTypeLocations.childContext);
20496 }
20497 for (var name in childContext) {
20498 !(name in Component.childContextTypes) ? process.env.NODE_ENV !== 'production' ? invariant(false, '%s.getChildContext(): key "%s" is not defined in childContextTypes.', this.getName() || 'ReactCompositeComponent', name) : invariant(false) : void 0;
20499 }
20500 return _assign({}, currentContext, childContext);
20501 }
20502 return currentContext;
20503 },
20504
20505 /**
20506 * Processes props by setting default values for unspecified props and
20507 * asserting that the props are valid. Does not mutate its argument; returns
20508 * a new props object with defaults merged in.
20509 *
20510 * @param {object} newProps
20511 * @return {object}
20512 * @private
20513 */
20514 _processProps: function (newProps) {
20515 if (process.env.NODE_ENV !== 'production') {
20516 var Component = this._currentElement.type;
20517 if (Component.propTypes) {
20518 this._checkPropTypes(Component.propTypes, newProps, ReactPropTypeLocations.prop);
20519 }
20520 }
20521 return newProps;
20522 },
20523
20524 /**
20525 * Assert that the props are valid
20526 *
20527 * @param {object} propTypes Map of prop name to a ReactPropType
20528 * @param {object} props
20529 * @param {string} location e.g. "prop", "context", "child context"
20530 * @private
20531 */
20532 _checkPropTypes: function (propTypes, props, location) {
20533 // TODO: Stop validating prop types here and only use the element
20534 // validation.
20535 var componentName = this.getName();
20536 for (var propName in propTypes) {
20537 if (propTypes.hasOwnProperty(propName)) {
20538 var error;
20539 try {
20540 // This is intentionally an invariant that gets caught. It's the same
20541 // behavior as without this statement except with a better message.
20542 !(typeof propTypes[propName] === 'function') ? process.env.NODE_ENV !== 'production' ? invariant(false, '%s: %s type `%s` is invalid; it must be a function, usually ' + 'from React.PropTypes.', componentName || 'React class', ReactPropTypeLocationNames[location], propName) : invariant(false) : void 0;
20543 error = propTypes[propName](props, propName, componentName, location);
20544 } catch (ex) {
20545 error = ex;
20546 }
20547 if (error instanceof Error) {
20548 // We may want to extend this logic for similar errors in
20549 // top-level render calls, so I'm abstracting it away into
20550 // a function to minimize refactoring in the future
20551 var addendum = getDeclarationErrorAddendum(this);
20552
20553 if (location === ReactPropTypeLocations.prop) {
20554 // Preface gives us something to blacklist in warning module
20555 process.env.NODE_ENV !== 'production' ? warning(false, 'Failed Composite propType: %s%s', error.message, addendum) : void 0;
20556 } else {
20557 process.env.NODE_ENV !== 'production' ? warning(false, 'Failed Context Types: %s%s', error.message, addendum) : void 0;
20558 }
20559 }
20560 }
20561 }
20562 },
20563
20564 receiveComponent: function (nextElement, transaction, nextContext) {
20565 var prevElement = this._currentElement;
20566 var prevContext = this._context;
20567
20568 this._pendingElement = null;
20569
20570 this.updateComponent(transaction, prevElement, nextElement, prevContext, nextContext);
20571 },
20572
20573 /**
20574 * If any of `_pendingElement`, `_pendingStateQueue`, or `_pendingForceUpdate`
20575 * is set, update the component.
20576 *
20577 * @param {ReactReconcileTransaction} transaction
20578 * @internal
20579 */
20580 performUpdateIfNecessary: function (transaction) {
20581 if (this._pendingElement != null) {
20582 ReactReconciler.receiveComponent(this, this._pendingElement, transaction, this._context);
20583 } else if (this._pendingStateQueue !== null || this._pendingForceUpdate) {
20584 this.updateComponent(transaction, this._currentElement, this._currentElement, this._context, this._context);
20585 } else {
20586 this._updateBatchNumber = null;
20587 }
20588 },
20589
20590 /**
20591 * Perform an update to a mounted component. The componentWillReceiveProps and
20592 * shouldComponentUpdate methods are called, then (assuming the update isn't
20593 * skipped) the remaining update lifecycle methods are called and the DOM
20594 * representation is updated.
20595 *
20596 * By default, this implements React's rendering and reconciliation algorithm.
20597 * Sophisticated clients may wish to override this.
20598 *
20599 * @param {ReactReconcileTransaction} transaction
20600 * @param {ReactElement} prevParentElement
20601 * @param {ReactElement} nextParentElement
20602 * @internal
20603 * @overridable
20604 */
20605 updateComponent: function (transaction, prevParentElement, nextParentElement, prevUnmaskedContext, nextUnmaskedContext) {
20606 var inst = this._instance;
20607 var willReceive = false;
20608 var nextContext;
20609 var nextProps;
20610
20611 // Determine if the context has changed or not
20612 if (this._context === nextUnmaskedContext) {
20613 nextContext = inst.context;
20614 } else {
20615 nextContext = this._processContext(nextUnmaskedContext);
20616 willReceive = true;
20617 }
20618
20619 // Distinguish between a props update versus a simple state update
20620 if (prevParentElement === nextParentElement) {
20621 // Skip checking prop types again -- we don't read inst.props to avoid
20622 // warning for DOM component props in this upgrade
20623 nextProps = nextParentElement.props;
20624 } else {
20625 nextProps = this._processProps(nextParentElement.props);
20626 willReceive = true;
20627 }
20628
20629 // An update here will schedule an update but immediately set
20630 // _pendingStateQueue which will ensure that any state updates gets
20631 // immediately reconciled instead of waiting for the next batch.
20632 if (willReceive && inst.componentWillReceiveProps) {
20633 if (process.env.NODE_ENV !== 'production') {
20634 if (this._debugID !== 0) {
20635 ReactInstrumentation.debugTool.onBeginLifeCycleTimer(this._debugID, 'componentWillReceiveProps');
20636 }
20637 }
20638 inst.componentWillReceiveProps(nextProps, nextContext);
20639 if (process.env.NODE_ENV !== 'production') {
20640 if (this._debugID !== 0) {
20641 ReactInstrumentation.debugTool.onEndLifeCycleTimer(this._debugID, 'componentWillReceiveProps');
20642 }
20643 }
20644 }
20645
20646 var nextState = this._processPendingState(nextProps, nextContext);
20647 var shouldUpdate = true;
20648
20649 if (!this._pendingForceUpdate && inst.shouldComponentUpdate) {
20650 if (process.env.NODE_ENV !== 'production') {
20651 if (this._debugID !== 0) {
20652 ReactInstrumentation.debugTool.onBeginLifeCycleTimer(this._debugID, 'shouldComponentUpdate');
20653 }
20654 }
20655 shouldUpdate = inst.shouldComponentUpdate(nextProps, nextState, nextContext);
20656 if (process.env.NODE_ENV !== 'production') {
20657 if (this._debugID !== 0) {
20658 ReactInstrumentation.debugTool.onEndLifeCycleTimer(this._debugID, 'shouldComponentUpdate');
20659 }
20660 }
20661 }
20662
20663 if (process.env.NODE_ENV !== 'production') {
20664 process.env.NODE_ENV !== 'production' ? warning(shouldUpdate !== undefined, '%s.shouldComponentUpdate(): Returned undefined instead of a ' + 'boolean value. Make sure to return true or false.', this.getName() || 'ReactCompositeComponent') : void 0;
20665 }
20666
20667 this._updateBatchNumber = null;
20668 if (shouldUpdate) {
20669 this._pendingForceUpdate = false;
20670 // Will set `this.props`, `this.state` and `this.context`.
20671 this._performComponentUpdate(nextParentElement, nextProps, nextState, nextContext, transaction, nextUnmaskedContext);
20672 } else {
20673 // If it's determined that a component should not update, we still want
20674 // to set props and state but we shortcut the rest of the update.
20675 this._currentElement = nextParentElement;
20676 this._context = nextUnmaskedContext;
20677 inst.props = nextProps;
20678 inst.state = nextState;
20679 inst.context = nextContext;
20680 }
20681 },
20682
20683 _processPendingState: function (props, context) {
20684 var inst = this._instance;
20685 var queue = this._pendingStateQueue;
20686 var replace = this._pendingReplaceState;
20687 this._pendingReplaceState = false;
20688 this._pendingStateQueue = null;
20689
20690 if (!queue) {
20691 return inst.state;
20692 }
20693
20694 if (replace && queue.length === 1) {
20695 return queue[0];
20696 }
20697
20698 var nextState = _assign({}, replace ? queue[0] : inst.state);
20699 for (var i = replace ? 1 : 0; i < queue.length; i++) {
20700 var partial = queue[i];
20701 _assign(nextState, typeof partial === 'function' ? partial.call(inst, nextState, props, context) : partial);
20702 }
20703
20704 return nextState;
20705 },
20706
20707 /**
20708 * Merges new props and state, notifies delegate methods of update and
20709 * performs update.
20710 *
20711 * @param {ReactElement} nextElement Next element
20712 * @param {object} nextProps Next public object to set as properties.
20713 * @param {?object} nextState Next object to set as state.
20714 * @param {?object} nextContext Next public object to set as context.
20715 * @param {ReactReconcileTransaction} transaction
20716 * @param {?object} unmaskedContext
20717 * @private
20718 */
20719 _performComponentUpdate: function (nextElement, nextProps, nextState, nextContext, transaction, unmaskedContext) {
20720 var inst = this._instance;
20721
20722 var hasComponentDidUpdate = Boolean(inst.componentDidUpdate);
20723 var prevProps;
20724 var prevState;
20725 var prevContext;
20726 if (hasComponentDidUpdate) {
20727 prevProps = inst.props;
20728 prevState = inst.state;
20729 prevContext = inst.context;
20730 }
20731
20732 if (inst.componentWillUpdate) {
20733 if (process.env.NODE_ENV !== 'production') {
20734 if (this._debugID !== 0) {
20735 ReactInstrumentation.debugTool.onBeginLifeCycleTimer(this._debugID, 'componentWillUpdate');
20736 }
20737 }
20738 inst.componentWillUpdate(nextProps, nextState, nextContext);
20739 if (process.env.NODE_ENV !== 'production') {
20740 if (this._debugID !== 0) {
20741 ReactInstrumentation.debugTool.onEndLifeCycleTimer(this._debugID, 'componentWillUpdate');
20742 }
20743 }
20744 }
20745
20746 this._currentElement = nextElement;
20747 this._context = unmaskedContext;
20748 inst.props = nextProps;
20749 inst.state = nextState;
20750 inst.context = nextContext;
20751
20752 this._updateRenderedComponent(transaction, unmaskedContext);
20753
20754 if (hasComponentDidUpdate) {
20755 if (process.env.NODE_ENV !== 'production') {
20756 transaction.getReactMountReady().enqueue(invokeComponentDidUpdateWithTimer.bind(this, prevProps, prevState, prevContext), this);
20757 } else {
20758 transaction.getReactMountReady().enqueue(inst.componentDidUpdate.bind(inst, prevProps, prevState, prevContext), inst);
20759 }
20760 }
20761 },
20762
20763 /**
20764 * Call the component's `render` method and update the DOM accordingly.
20765 *
20766 * @param {ReactReconcileTransaction} transaction
20767 * @internal
20768 */
20769 _updateRenderedComponent: function (transaction, context) {
20770 var prevComponentInstance = this._renderedComponent;
20771 var prevRenderedElement = prevComponentInstance._currentElement;
20772 var nextRenderedElement = this._renderValidatedComponent();
20773 if (shouldUpdateReactComponent(prevRenderedElement, nextRenderedElement)) {
20774 ReactReconciler.receiveComponent(prevComponentInstance, nextRenderedElement, transaction, this._processChildContext(context));
20775 } else {
20776 var oldNativeNode = ReactReconciler.getNativeNode(prevComponentInstance);
20777 ReactReconciler.unmountComponent(prevComponentInstance, false);
20778
20779 this._renderedNodeType = ReactNodeTypes.getType(nextRenderedElement);
20780 this._renderedComponent = this._instantiateReactComponent(nextRenderedElement);
20781
20782 var nextMarkup = ReactReconciler.mountComponent(this._renderedComponent, transaction, this._nativeParent, this._nativeContainerInfo, this._processChildContext(context));
20783
20784 if (process.env.NODE_ENV !== 'production') {
20785 if (this._debugID !== 0) {
20786 ReactInstrumentation.debugTool.onSetChildren(this._debugID, this._renderedComponent._debugID !== 0 ? [this._renderedComponent._debugID] : []);
20787 }
20788 }
20789
20790 this._replaceNodeWithMarkup(oldNativeNode, nextMarkup, prevComponentInstance);
20791 }
20792 },
20793
20794 /**
20795 * Overridden in shallow rendering.
20796 *
20797 * @protected
20798 */
20799 _replaceNodeWithMarkup: function (oldNativeNode, nextMarkup, prevInstance) {
20800 ReactComponentEnvironment.replaceNodeWithMarkup(oldNativeNode, nextMarkup, prevInstance);
20801 },
20802
20803 /**
20804 * @protected
20805 */
20806 _renderValidatedComponentWithoutOwnerOrContext: function () {
20807 var inst = this._instance;
20808
20809 if (process.env.NODE_ENV !== 'production') {
20810 if (this._debugID !== 0) {
20811 ReactInstrumentation.debugTool.onBeginLifeCycleTimer(this._debugID, 'render');
20812 }
20813 }
20814 var renderedComponent = inst.render();
20815 if (process.env.NODE_ENV !== 'production') {
20816 if (this._debugID !== 0) {
20817 ReactInstrumentation.debugTool.onEndLifeCycleTimer(this._debugID, 'render');
20818 }
20819 }
20820
20821 if (process.env.NODE_ENV !== 'production') {
20822 // We allow auto-mocks to proceed as if they're returning null.
20823 if (renderedComponent === undefined && inst.render._isMockFunction) {
20824 // This is probably bad practice. Consider warning here and
20825 // deprecating this convenience.
20826 renderedComponent = null;
20827 }
20828 }
20829
20830 return renderedComponent;
20831 },
20832
20833 /**
20834 * @private
20835 */
20836 _renderValidatedComponent: function () {
20837 var renderedComponent;
20838 ReactCurrentOwner.current = this;
20839 try {
20840 renderedComponent = this._renderValidatedComponentWithoutOwnerOrContext();
20841 } finally {
20842 ReactCurrentOwner.current = null;
20843 }
20844 !(
20845 // TODO: An `isValidNode` function would probably be more appropriate
20846 renderedComponent === null || renderedComponent === false || ReactElement.isValidElement(renderedComponent)) ? process.env.NODE_ENV !== 'production' ? invariant(false, '%s.render(): A valid React element (or null) must be returned. You may have ' + 'returned undefined, an array or some other invalid object.', this.getName() || 'ReactCompositeComponent') : invariant(false) : void 0;
20847
20848 return renderedComponent;
20849 },
20850
20851 /**
20852 * Lazily allocates the refs object and stores `component` as `ref`.
20853 *
20854 * @param {string} ref Reference name.
20855 * @param {component} component Component to store as `ref`.
20856 * @final
20857 * @private
20858 */
20859 attachRef: function (ref, component) {
20860 var inst = this.getPublicInstance();
20861 !(inst != null) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Stateless function components cannot have refs.') : invariant(false) : void 0;
20862 var publicComponentInstance = component.getPublicInstance();
20863 if (process.env.NODE_ENV !== 'production') {
20864 var componentName = component && component.getName ? component.getName() : 'a component';
20865 process.env.NODE_ENV !== 'production' ? warning(publicComponentInstance != null, 'Stateless function components cannot be given refs ' + '(See ref "%s" in %s created by %s). ' + 'Attempts to access this ref will fail.', ref, componentName, this.getName()) : void 0;
20866 }
20867 var refs = inst.refs === emptyObject ? inst.refs = {} : inst.refs;
20868 refs[ref] = publicComponentInstance;
20869 },
20870
20871 /**
20872 * Detaches a reference name.
20873 *
20874 * @param {string} ref Name to dereference.
20875 * @final
20876 * @private
20877 */
20878 detachRef: function (ref) {
20879 var refs = this.getPublicInstance().refs;
20880 delete refs[ref];
20881 },
20882
20883 /**
20884 * Get a text description of the component that can be used to identify it
20885 * in error messages.
20886 * @return {string} The name or null.
20887 * @internal
20888 */
20889 getName: function () {
20890 var type = this._currentElement.type;
20891 var constructor = this._instance && this._instance.constructor;
20892 return type.displayName || constructor && constructor.displayName || type.name || constructor && constructor.name || null;
20893 },
20894
20895 /**
20896 * Get the publicly accessible representation of this component - i.e. what
20897 * is exposed by refs and returned by render. Can be null for stateless
20898 * components.
20899 *
20900 * @return {ReactComponent} the public component instance.
20901 * @internal
20902 */
20903 getPublicInstance: function () {
20904 var inst = this._instance;
20905 if (inst instanceof StatelessComponent) {
20906 return null;
20907 }
20908 return inst;
20909 },
20910
20911 // Stub
20912 _instantiateReactComponent: null
20913
20914};
20915
20916var ReactCompositeComponent = {
20917
20918 Mixin: ReactCompositeComponentMixin
20919
20920};
20921
20922module.exports = ReactCompositeComponent;
20923}).call(this,require(91))
20924},{"191":191,"194":194,"218":218,"221":221,"227":227,"228":228,"236":236,"239":239,"240":240,"243":243,"246":246,"293":293,"296":296,"38":38,"45":45,"55":55,"91":91}],194:[function(require,module,exports){
20925/**
20926 * Copyright 2013-present, Facebook, Inc.
20927 * All rights reserved.
20928 *
20929 * This source code is licensed under the BSD-style license found in the
20930 * LICENSE file in the root directory of this source tree. An additional grant
20931 * of patent rights can be found in the PATENTS file in the same directory.
20932 *
20933 * @providesModule ReactCurrentOwner
20934 */
20935
20936'use strict';
20937
20938/**
20939 * Keeps track of the current owner.
20940 *
20941 * The current owner is the component who should own any components that are
20942 * currently being constructed.
20943 */
20944
20945var ReactCurrentOwner = {
20946
20947 /**
20948 * @internal
20949 * @type {ReactComponent}
20950 */
20951 current: null
20952
20953};
20954
20955module.exports = ReactCurrentOwner;
20956},{}],195:[function(require,module,exports){
20957(function (process){
20958/**
20959 * Copyright 2013-present, Facebook, Inc.
20960 * All rights reserved.
20961 *
20962 * This source code is licensed under the BSD-style license found in the
20963 * LICENSE file in the root directory of this source tree. An additional grant
20964 * of patent rights can be found in the PATENTS file in the same directory.
20965 *
20966 * @providesModule ReactDOM
20967 */
20968
20969/* globals __REACT_DEVTOOLS_GLOBAL_HOOK__*/
20970
20971'use strict';
20972
20973var ReactDOMComponentTree = require(199);
20974var ReactDefaultInjection = require(217);
20975var ReactMount = require(231);
20976var ReactReconciler = require(243);
20977var ReactUpdates = require(247);
20978var ReactVersion = require(248);
20979
20980var findDOMNode = require(273);
20981var getNativeComponentFromComposite = require(281);
20982var renderSubtreeIntoContainer = require(290);
20983var warning = require(55);
20984
20985ReactDefaultInjection.inject();
20986
20987var React = {
20988 findDOMNode: findDOMNode,
20989 render: ReactMount.render,
20990 unmountComponentAtNode: ReactMount.unmountComponentAtNode,
20991 version: ReactVersion,
20992
20993 /* eslint-disable camelcase */
20994 unstable_batchedUpdates: ReactUpdates.batchedUpdates,
20995 unstable_renderSubtreeIntoContainer: renderSubtreeIntoContainer
20996};
20997
20998// Inject the runtime into a devtools global hook regardless of browser.
20999// Allows for debugging when the hook is injected on the page.
21000/* eslint-enable camelcase */
21001if (typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== 'undefined' && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.inject === 'function') {
21002 __REACT_DEVTOOLS_GLOBAL_HOOK__.inject({
21003 ComponentTree: {
21004 getClosestInstanceFromNode: ReactDOMComponentTree.getClosestInstanceFromNode,
21005 getNodeFromInstance: function (inst) {
21006 // inst is an internal instance (but could be a composite)
21007 if (inst._renderedComponent) {
21008 inst = getNativeComponentFromComposite(inst);
21009 }
21010 if (inst) {
21011 return ReactDOMComponentTree.getNodeFromInstance(inst);
21012 } else {
21013 return null;
21014 }
21015 }
21016 },
21017 Mount: ReactMount,
21018 Reconciler: ReactReconciler
21019 });
21020}
21021
21022if (process.env.NODE_ENV !== 'production') {
21023 var ExecutionEnvironment = require(31);
21024 if (ExecutionEnvironment.canUseDOM && window.top === window.self) {
21025
21026 // First check if devtools is not installed
21027 if (typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ === 'undefined') {
21028 // If we're in Chrome or Firefox, provide a download link if not installed.
21029 if (navigator.userAgent.indexOf('Chrome') > -1 && navigator.userAgent.indexOf('Edge') === -1 || navigator.userAgent.indexOf('Firefox') > -1) {
21030 // Firefox does not have the issue with devtools loaded over file://
21031 var showFileUrlMessage = window.location.protocol.indexOf('http') === -1 && navigator.userAgent.indexOf('Firefox') === -1;
21032 console.debug('Download the React DevTools ' + (showFileUrlMessage ? 'and use an HTTP server (instead of a file: URL) ' : '') + 'for a better development experience: ' + 'https://fb.me/react-devtools');
21033 }
21034 }
21035
21036 var testFunc = function testFn() {};
21037 process.env.NODE_ENV !== 'production' ? warning((testFunc.name || testFunc.toString()).indexOf('testFn') !== -1, 'It looks like you\'re using a minified copy of the development build ' + 'of React. When deploying React apps to production, make sure to use ' + 'the production build which skips development warnings and is faster. ' + 'See https://fb.me/react-minification for more details.') : void 0;
21038
21039 // If we're in IE8, check to see if we are in compatibility mode and provide
21040 // information on preventing compatibility mode
21041 var ieCompatibilityMode = document.documentMode && document.documentMode < 8;
21042
21043 process.env.NODE_ENV !== 'production' ? warning(!ieCompatibilityMode, 'Internet Explorer is running in compatibility mode; please add the ' + 'following tag to your HTML to prevent this from happening: ' + '<meta http-equiv="X-UA-Compatible" content="IE=edge" />') : void 0;
21044
21045 var expectedFeatures = [
21046 // shims
21047 Array.isArray, Array.prototype.every, Array.prototype.forEach, Array.prototype.indexOf, Array.prototype.map, Date.now, Function.prototype.bind, Object.keys, String.prototype.split, String.prototype.trim];
21048
21049 for (var i = 0; i < expectedFeatures.length; i++) {
21050 if (!expectedFeatures[i]) {
21051 process.env.NODE_ENV !== 'production' ? warning(false, 'One or more ES5 shims expected by React are not available: ' + 'https://fb.me/react-warning-polyfills') : void 0;
21052 break;
21053 }
21054 }
21055 }
21056}
21057
21058module.exports = React;
21059}).call(this,require(91))
21060},{"199":199,"217":217,"231":231,"243":243,"247":247,"248":248,"273":273,"281":281,"290":290,"31":31,"55":55,"91":91}],196:[function(require,module,exports){
21061/**
21062 * Copyright 2013-present, Facebook, Inc.
21063 * All rights reserved.
21064 *
21065 * This source code is licensed under the BSD-style license found in the
21066 * LICENSE file in the root directory of this source tree. An additional grant
21067 * of patent rights can be found in the PATENTS file in the same directory.
21068 *
21069 * @providesModule ReactDOMButton
21070 */
21071
21072'use strict';
21073
21074var DisabledInputUtils = require(172);
21075
21076/**
21077 * Implements a <button> native component that does not receive mouse events
21078 * when `disabled` is set.
21079 */
21080var ReactDOMButton = {
21081 getNativeProps: DisabledInputUtils.getNativeProps
21082};
21083
21084module.exports = ReactDOMButton;
21085},{"172":172}],197:[function(require,module,exports){
21086(function (process){
21087/**
21088 * Copyright 2013-present, Facebook, Inc.
21089 * All rights reserved.
21090 *
21091 * This source code is licensed under the BSD-style license found in the
21092 * LICENSE file in the root directory of this source tree. An additional grant
21093 * of patent rights can be found in the PATENTS file in the same directory.
21094 *
21095 * @providesModule ReactDOMComponent
21096 */
21097
21098/* global hasOwnProperty:true */
21099
21100'use strict';
21101
21102var _assign = require(296);
21103
21104var AutoFocusUtils = require(159);
21105var CSSPropertyOperations = require(162);
21106var DOMLazyTree = require(166);
21107var DOMNamespaces = require(167);
21108var DOMProperty = require(168);
21109var DOMPropertyOperations = require(169);
21110var EventConstants = require(174);
21111var EventPluginHub = require(175);
21112var EventPluginRegistry = require(176);
21113var ReactBrowserEventEmitter = require(185);
21114var ReactComponentBrowserEnvironment = require(190);
21115var ReactDOMButton = require(196);
21116var ReactDOMComponentFlags = require(198);
21117var ReactDOMComponentTree = require(199);
21118var ReactDOMInput = require(206);
21119var ReactDOMOption = require(208);
21120var ReactDOMSelect = require(209);
21121var ReactDOMTextarea = require(212);
21122var ReactInstrumentation = require(228);
21123var ReactMultiChild = require(232);
21124var ReactServerRenderingTransaction = require(245);
21125
21126var emptyFunction = require(37);
21127var escapeTextContentForBrowser = require(272);
21128var invariant = require(45);
21129var isEventSupported = require(286);
21130var keyOf = require(49);
21131var shallowEqual = require(54);
21132var validateDOMNesting = require(295);
21133var warning = require(55);
21134
21135var Flags = ReactDOMComponentFlags;
21136var deleteListener = EventPluginHub.deleteListener;
21137var getNode = ReactDOMComponentTree.getNodeFromInstance;
21138var listenTo = ReactBrowserEventEmitter.listenTo;
21139var registrationNameModules = EventPluginRegistry.registrationNameModules;
21140
21141// For quickly matching children type, to test if can be treated as content.
21142var CONTENT_TYPES = { 'string': true, 'number': true };
21143
21144var STYLE = keyOf({ style: null });
21145var HTML = keyOf({ __html: null });
21146var RESERVED_PROPS = {
21147 children: null,
21148 dangerouslySetInnerHTML: null,
21149 suppressContentEditableWarning: null
21150};
21151
21152// Node type for document fragments (Node.DOCUMENT_FRAGMENT_NODE).
21153var DOC_FRAGMENT_TYPE = 11;
21154
21155function getDeclarationErrorAddendum(internalInstance) {
21156 if (internalInstance) {
21157 var owner = internalInstance._currentElement._owner || null;
21158 if (owner) {
21159 var name = owner.getName();
21160 if (name) {
21161 return ' This DOM node was rendered by `' + name + '`.';
21162 }
21163 }
21164 }
21165 return '';
21166}
21167
21168function friendlyStringify(obj) {
21169 if (typeof obj === 'object') {
21170 if (Array.isArray(obj)) {
21171 return '[' + obj.map(friendlyStringify).join(', ') + ']';
21172 } else {
21173 var pairs = [];
21174 for (var key in obj) {
21175 if (Object.prototype.hasOwnProperty.call(obj, key)) {
21176 var keyEscaped = /^[a-z$_][\w$_]*$/i.test(key) ? key : JSON.stringify(key);
21177 pairs.push(keyEscaped + ': ' + friendlyStringify(obj[key]));
21178 }
21179 }
21180 return '{' + pairs.join(', ') + '}';
21181 }
21182 } else if (typeof obj === 'string') {
21183 return JSON.stringify(obj);
21184 } else if (typeof obj === 'function') {
21185 return '[function object]';
21186 }
21187 // Differs from JSON.stringify in that undefined because undefined and that
21188 // inf and nan don't become null
21189 return String(obj);
21190}
21191
21192var styleMutationWarning = {};
21193
21194function checkAndWarnForMutatedStyle(style1, style2, component) {
21195 if (style1 == null || style2 == null) {
21196 return;
21197 }
21198 if (shallowEqual(style1, style2)) {
21199 return;
21200 }
21201
21202 var componentName = component._tag;
21203 var owner = component._currentElement._owner;
21204 var ownerName;
21205 if (owner) {
21206 ownerName = owner.getName();
21207 }
21208
21209 var hash = ownerName + '|' + componentName;
21210
21211 if (styleMutationWarning.hasOwnProperty(hash)) {
21212 return;
21213 }
21214
21215 styleMutationWarning[hash] = true;
21216
21217 process.env.NODE_ENV !== 'production' ? warning(false, '`%s` was passed a style object that has previously been mutated. ' + 'Mutating `style` is deprecated. Consider cloning it beforehand. Check ' + 'the `render` %s. Previous style: %s. Mutated style: %s.', componentName, owner ? 'of `' + ownerName + '`' : 'using <' + componentName + '>', friendlyStringify(style1), friendlyStringify(style2)) : void 0;
21218}
21219
21220/**
21221 * @param {object} component
21222 * @param {?object} props
21223 */
21224function assertValidProps(component, props) {
21225 if (!props) {
21226 return;
21227 }
21228 // Note the use of `==` which checks for null or undefined.
21229 if (voidElementTags[component._tag]) {
21230 !(props.children == null && props.dangerouslySetInnerHTML == null) ? process.env.NODE_ENV !== 'production' ? invariant(false, '%s is a void element tag and must not have `children` or ' + 'use `props.dangerouslySetInnerHTML`.%s', component._tag, component._currentElement._owner ? ' Check the render method of ' + component._currentElement._owner.getName() + '.' : '') : invariant(false) : void 0;
21231 }
21232 if (props.dangerouslySetInnerHTML != null) {
21233 !(props.children == null) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Can only set one of `children` or `props.dangerouslySetInnerHTML`.') : invariant(false) : void 0;
21234 !(typeof props.dangerouslySetInnerHTML === 'object' && HTML in props.dangerouslySetInnerHTML) ? process.env.NODE_ENV !== 'production' ? invariant(false, '`props.dangerouslySetInnerHTML` must be in the form `{__html: ...}`. ' + 'Please visit https://fb.me/react-invariant-dangerously-set-inner-html ' + 'for more information.') : invariant(false) : void 0;
21235 }
21236 if (process.env.NODE_ENV !== 'production') {
21237 process.env.NODE_ENV !== 'production' ? warning(props.innerHTML == null, 'Directly setting property `innerHTML` is not permitted. ' + 'For more information, lookup documentation on `dangerouslySetInnerHTML`.') : void 0;
21238 process.env.NODE_ENV !== 'production' ? warning(props.suppressContentEditableWarning || !props.contentEditable || props.children == null, 'A component is `contentEditable` and contains `children` managed by ' + 'React. It is now your responsibility to guarantee that none of ' + 'those nodes are unexpectedly modified or duplicated. This is ' + 'probably not intentional.') : void 0;
21239 process.env.NODE_ENV !== 'production' ? warning(props.onFocusIn == null && props.onFocusOut == null, 'React uses onFocus and onBlur instead of onFocusIn and onFocusOut. ' + 'All React events are normalized to bubble, so onFocusIn and onFocusOut ' + 'are not needed/supported by React.') : void 0;
21240 }
21241 !(props.style == null || typeof props.style === 'object') ? process.env.NODE_ENV !== 'production' ? invariant(false, 'The `style` prop expects a mapping from style properties to values, ' + 'not a string. For example, style={{marginRight: spacing + \'em\'}} when ' + 'using JSX.%s', getDeclarationErrorAddendum(component)) : invariant(false) : void 0;
21242}
21243
21244function enqueuePutListener(inst, registrationName, listener, transaction) {
21245 if (transaction instanceof ReactServerRenderingTransaction) {
21246 return;
21247 }
21248 if (process.env.NODE_ENV !== 'production') {
21249 // IE8 has no API for event capturing and the `onScroll` event doesn't
21250 // bubble.
21251 process.env.NODE_ENV !== 'production' ? warning(registrationName !== 'onScroll' || isEventSupported('scroll', true), 'This browser doesn\'t support the `onScroll` event') : void 0;
21252 }
21253 var containerInfo = inst._nativeContainerInfo;
21254 var isDocumentFragment = containerInfo._node && containerInfo._node.nodeType === DOC_FRAGMENT_TYPE;
21255 var doc = isDocumentFragment ? containerInfo._node : containerInfo._ownerDocument;
21256 listenTo(registrationName, doc);
21257 transaction.getReactMountReady().enqueue(putListener, {
21258 inst: inst,
21259 registrationName: registrationName,
21260 listener: listener
21261 });
21262}
21263
21264function putListener() {
21265 var listenerToPut = this;
21266 EventPluginHub.putListener(listenerToPut.inst, listenerToPut.registrationName, listenerToPut.listener);
21267}
21268
21269function optionPostMount() {
21270 var inst = this;
21271 ReactDOMOption.postMountWrapper(inst);
21272}
21273
21274var setContentChildForInstrumentation = emptyFunction;
21275if (process.env.NODE_ENV !== 'production') {
21276 setContentChildForInstrumentation = function (contentToUse) {
21277 var debugID = this._debugID;
21278 var contentDebugID = debugID + '#text';
21279 this._contentDebugID = contentDebugID;
21280 ReactInstrumentation.debugTool.onSetDisplayName(contentDebugID, '#text');
21281 ReactInstrumentation.debugTool.onSetText(contentDebugID, '' + contentToUse);
21282 ReactInstrumentation.debugTool.onMountComponent(contentDebugID);
21283 ReactInstrumentation.debugTool.onSetChildren(debugID, [contentDebugID]);
21284 };
21285}
21286
21287// There are so many media events, it makes sense to just
21288// maintain a list rather than create a `trapBubbledEvent` for each
21289var mediaEvents = {
21290 topAbort: 'abort',
21291 topCanPlay: 'canplay',
21292 topCanPlayThrough: 'canplaythrough',
21293 topDurationChange: 'durationchange',
21294 topEmptied: 'emptied',
21295 topEncrypted: 'encrypted',
21296 topEnded: 'ended',
21297 topError: 'error',
21298 topLoadedData: 'loadeddata',
21299 topLoadedMetadata: 'loadedmetadata',
21300 topLoadStart: 'loadstart',
21301 topPause: 'pause',
21302 topPlay: 'play',
21303 topPlaying: 'playing',
21304 topProgress: 'progress',
21305 topRateChange: 'ratechange',
21306 topSeeked: 'seeked',
21307 topSeeking: 'seeking',
21308 topStalled: 'stalled',
21309 topSuspend: 'suspend',
21310 topTimeUpdate: 'timeupdate',
21311 topVolumeChange: 'volumechange',
21312 topWaiting: 'waiting'
21313};
21314
21315function trapBubbledEventsLocal() {
21316 var inst = this;
21317 // If a component renders to null or if another component fatals and causes
21318 // the state of the tree to be corrupted, `node` here can be null.
21319 !inst._rootNodeID ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Must be mounted to trap events') : invariant(false) : void 0;
21320 var node = getNode(inst);
21321 !node ? process.env.NODE_ENV !== 'production' ? invariant(false, 'trapBubbledEvent(...): Requires node to be rendered.') : invariant(false) : void 0;
21322
21323 switch (inst._tag) {
21324 case 'iframe':
21325 case 'object':
21326 inst._wrapperState.listeners = [ReactBrowserEventEmitter.trapBubbledEvent(EventConstants.topLevelTypes.topLoad, 'load', node)];
21327 break;
21328 case 'video':
21329 case 'audio':
21330
21331 inst._wrapperState.listeners = [];
21332 // Create listener for each media event
21333 for (var event in mediaEvents) {
21334 if (mediaEvents.hasOwnProperty(event)) {
21335 inst._wrapperState.listeners.push(ReactBrowserEventEmitter.trapBubbledEvent(EventConstants.topLevelTypes[event], mediaEvents[event], node));
21336 }
21337 }
21338
21339 break;
21340 case 'img':
21341 inst._wrapperState.listeners = [ReactBrowserEventEmitter.trapBubbledEvent(EventConstants.topLevelTypes.topError, 'error', node), ReactBrowserEventEmitter.trapBubbledEvent(EventConstants.topLevelTypes.topLoad, 'load', node)];
21342 break;
21343 case 'form':
21344 inst._wrapperState.listeners = [ReactBrowserEventEmitter.trapBubbledEvent(EventConstants.topLevelTypes.topReset, 'reset', node), ReactBrowserEventEmitter.trapBubbledEvent(EventConstants.topLevelTypes.topSubmit, 'submit', node)];
21345 break;
21346 case 'input':
21347 case 'select':
21348 case 'textarea':
21349 inst._wrapperState.listeners = [ReactBrowserEventEmitter.trapBubbledEvent(EventConstants.topLevelTypes.topInvalid, 'invalid', node)];
21350 break;
21351 }
21352}
21353
21354function postUpdateSelectWrapper() {
21355 ReactDOMSelect.postUpdateWrapper(this);
21356}
21357
21358// For HTML, certain tags should omit their close tag. We keep a whitelist for
21359// those special-case tags.
21360
21361var omittedCloseTags = {
21362 'area': true,
21363 'base': true,
21364 'br': true,
21365 'col': true,
21366 'embed': true,
21367 'hr': true,
21368 'img': true,
21369 'input': true,
21370 'keygen': true,
21371 'link': true,
21372 'meta': true,
21373 'param': true,
21374 'source': true,
21375 'track': true,
21376 'wbr': true
21377};
21378
21379// NOTE: menuitem's close tag should be omitted, but that causes problems.
21380var newlineEatingTags = {
21381 'listing': true,
21382 'pre': true,
21383 'textarea': true
21384};
21385
21386// For HTML, certain tags cannot have children. This has the same purpose as
21387// `omittedCloseTags` except that `menuitem` should still have its closing tag.
21388
21389var voidElementTags = _assign({
21390 'menuitem': true
21391}, omittedCloseTags);
21392
21393// We accept any tag to be rendered but since this gets injected into arbitrary
21394// HTML, we want to make sure that it's a safe tag.
21395// http://www.w3.org/TR/REC-xml/#NT-Name
21396
21397var VALID_TAG_REGEX = /^[a-zA-Z][a-zA-Z:_\.\-\d]*$/; // Simplified subset
21398var validatedTagCache = {};
21399var hasOwnProperty = {}.hasOwnProperty;
21400
21401function validateDangerousTag(tag) {
21402 if (!hasOwnProperty.call(validatedTagCache, tag)) {
21403 !VALID_TAG_REGEX.test(tag) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Invalid tag: %s', tag) : invariant(false) : void 0;
21404 validatedTagCache[tag] = true;
21405 }
21406}
21407
21408function isCustomComponent(tagName, props) {
21409 return tagName.indexOf('-') >= 0 || props.is != null;
21410}
21411
21412var globalIdCounter = 1;
21413
21414/**
21415 * Creates a new React class that is idempotent and capable of containing other
21416 * React components. It accepts event listeners and DOM properties that are
21417 * valid according to `DOMProperty`.
21418 *
21419 * - Event listeners: `onClick`, `onMouseDown`, etc.
21420 * - DOM properties: `className`, `name`, `title`, etc.
21421 *
21422 * The `style` property functions differently from the DOM API. It accepts an
21423 * object mapping of style properties to values.
21424 *
21425 * @constructor ReactDOMComponent
21426 * @extends ReactMultiChild
21427 */
21428function ReactDOMComponent(element) {
21429 var tag = element.type;
21430 validateDangerousTag(tag);
21431 this._currentElement = element;
21432 this._tag = tag.toLowerCase();
21433 this._namespaceURI = null;
21434 this._renderedChildren = null;
21435 this._previousStyle = null;
21436 this._previousStyleCopy = null;
21437 this._nativeNode = null;
21438 this._nativeParent = null;
21439 this._rootNodeID = null;
21440 this._domID = null;
21441 this._nativeContainerInfo = null;
21442 this._wrapperState = null;
21443 this._topLevelWrapper = null;
21444 this._flags = 0;
21445 if (process.env.NODE_ENV !== 'production') {
21446 this._ancestorInfo = null;
21447 this._contentDebugID = null;
21448 }
21449}
21450
21451ReactDOMComponent.displayName = 'ReactDOMComponent';
21452
21453ReactDOMComponent.Mixin = {
21454
21455 /**
21456 * Generates root tag markup then recurses. This method has side effects and
21457 * is not idempotent.
21458 *
21459 * @internal
21460 * @param {ReactReconcileTransaction|ReactServerRenderingTransaction} transaction
21461 * @param {?ReactDOMComponent} the containing DOM component instance
21462 * @param {?object} info about the native container
21463 * @param {object} context
21464 * @return {string} The computed markup.
21465 */
21466 mountComponent: function (transaction, nativeParent, nativeContainerInfo, context) {
21467 this._rootNodeID = globalIdCounter++;
21468 this._domID = nativeContainerInfo._idCounter++;
21469 this._nativeParent = nativeParent;
21470 this._nativeContainerInfo = nativeContainerInfo;
21471
21472 var props = this._currentElement.props;
21473
21474 switch (this._tag) {
21475 case 'iframe':
21476 case 'object':
21477 case 'img':
21478 case 'form':
21479 case 'video':
21480 case 'audio':
21481 this._wrapperState = {
21482 listeners: null
21483 };
21484 transaction.getReactMountReady().enqueue(trapBubbledEventsLocal, this);
21485 break;
21486 case 'button':
21487 props = ReactDOMButton.getNativeProps(this, props, nativeParent);
21488 break;
21489 case 'input':
21490 ReactDOMInput.mountWrapper(this, props, nativeParent);
21491 props = ReactDOMInput.getNativeProps(this, props);
21492 transaction.getReactMountReady().enqueue(trapBubbledEventsLocal, this);
21493 break;
21494 case 'option':
21495 ReactDOMOption.mountWrapper(this, props, nativeParent);
21496 props = ReactDOMOption.getNativeProps(this, props);
21497 break;
21498 case 'select':
21499 ReactDOMSelect.mountWrapper(this, props, nativeParent);
21500 props = ReactDOMSelect.getNativeProps(this, props);
21501 transaction.getReactMountReady().enqueue(trapBubbledEventsLocal, this);
21502 break;
21503 case 'textarea':
21504 ReactDOMTextarea.mountWrapper(this, props, nativeParent);
21505 props = ReactDOMTextarea.getNativeProps(this, props);
21506 transaction.getReactMountReady().enqueue(trapBubbledEventsLocal, this);
21507 break;
21508 }
21509
21510 assertValidProps(this, props);
21511
21512 // We create tags in the namespace of their parent container, except HTML
21513 // tags get no namespace.
21514 var namespaceURI;
21515 var parentTag;
21516 if (nativeParent != null) {
21517 namespaceURI = nativeParent._namespaceURI;
21518 parentTag = nativeParent._tag;
21519 } else if (nativeContainerInfo._tag) {
21520 namespaceURI = nativeContainerInfo._namespaceURI;
21521 parentTag = nativeContainerInfo._tag;
21522 }
21523 if (namespaceURI == null || namespaceURI === DOMNamespaces.svg && parentTag === 'foreignobject') {
21524 namespaceURI = DOMNamespaces.html;
21525 }
21526 if (namespaceURI === DOMNamespaces.html) {
21527 if (this._tag === 'svg') {
21528 namespaceURI = DOMNamespaces.svg;
21529 } else if (this._tag === 'math') {
21530 namespaceURI = DOMNamespaces.mathml;
21531 }
21532 }
21533 this._namespaceURI = namespaceURI;
21534
21535 if (process.env.NODE_ENV !== 'production') {
21536 var parentInfo;
21537 if (nativeParent != null) {
21538 parentInfo = nativeParent._ancestorInfo;
21539 } else if (nativeContainerInfo._tag) {
21540 parentInfo = nativeContainerInfo._ancestorInfo;
21541 }
21542 if (parentInfo) {
21543 // parentInfo should always be present except for the top-level
21544 // component when server rendering
21545 validateDOMNesting(this._tag, this, parentInfo);
21546 }
21547 this._ancestorInfo = validateDOMNesting.updatedAncestorInfo(parentInfo, this._tag, this);
21548 }
21549
21550 var mountImage;
21551 if (transaction.useCreateElement) {
21552 var ownerDocument = nativeContainerInfo._ownerDocument;
21553 var el;
21554 if (namespaceURI === DOMNamespaces.html) {
21555 if (this._tag === 'script') {
21556 // Create the script via .innerHTML so its "parser-inserted" flag is
21557 // set to true and it does not execute
21558 var div = ownerDocument.createElement('div');
21559 var type = this._currentElement.type;
21560 div.innerHTML = '<' + type + '></' + type + '>';
21561 el = div.removeChild(div.firstChild);
21562 } else {
21563 el = ownerDocument.createElement(this._currentElement.type, props.is || null);
21564 }
21565 } else {
21566 el = ownerDocument.createElementNS(namespaceURI, this._currentElement.type);
21567 }
21568 ReactDOMComponentTree.precacheNode(this, el);
21569 this._flags |= Flags.hasCachedChildNodes;
21570 if (!this._nativeParent) {
21571 DOMPropertyOperations.setAttributeForRoot(el);
21572 }
21573 this._updateDOMProperties(null, props, transaction);
21574 var lazyTree = DOMLazyTree(el);
21575 this._createInitialChildren(transaction, props, context, lazyTree);
21576 mountImage = lazyTree;
21577 } else {
21578 var tagOpen = this._createOpenTagMarkupAndPutListeners(transaction, props);
21579 var tagContent = this._createContentMarkup(transaction, props, context);
21580 if (!tagContent && omittedCloseTags[this._tag]) {
21581 mountImage = tagOpen + '/>';
21582 } else {
21583 mountImage = tagOpen + '>' + tagContent + '</' + this._currentElement.type + '>';
21584 }
21585 }
21586
21587 switch (this._tag) {
21588 case 'button':
21589 case 'input':
21590 case 'select':
21591 case 'textarea':
21592 if (props.autoFocus) {
21593 transaction.getReactMountReady().enqueue(AutoFocusUtils.focusDOMComponent, this);
21594 }
21595 break;
21596 case 'option':
21597 transaction.getReactMountReady().enqueue(optionPostMount, this);
21598 }
21599
21600 return mountImage;
21601 },
21602
21603 /**
21604 * Creates markup for the open tag and all attributes.
21605 *
21606 * This method has side effects because events get registered.
21607 *
21608 * Iterating over object properties is faster than iterating over arrays.
21609 * @see http://jsperf.com/obj-vs-arr-iteration
21610 *
21611 * @private
21612 * @param {ReactReconcileTransaction|ReactServerRenderingTransaction} transaction
21613 * @param {object} props
21614 * @return {string} Markup of opening tag.
21615 */
21616 _createOpenTagMarkupAndPutListeners: function (transaction, props) {
21617 var ret = '<' + this._currentElement.type;
21618
21619 for (var propKey in props) {
21620 if (!props.hasOwnProperty(propKey)) {
21621 continue;
21622 }
21623 var propValue = props[propKey];
21624 if (propValue == null) {
21625 continue;
21626 }
21627 if (registrationNameModules.hasOwnProperty(propKey)) {
21628 if (propValue) {
21629 enqueuePutListener(this, propKey, propValue, transaction);
21630 }
21631 } else {
21632 if (propKey === STYLE) {
21633 if (propValue) {
21634 if (process.env.NODE_ENV !== 'production') {
21635 // See `_updateDOMProperties`. style block
21636 this._previousStyle = propValue;
21637 }
21638 propValue = this._previousStyleCopy = _assign({}, props.style);
21639 }
21640 propValue = CSSPropertyOperations.createMarkupForStyles(propValue, this);
21641 }
21642 var markup = null;
21643 if (this._tag != null && isCustomComponent(this._tag, props)) {
21644 if (!RESERVED_PROPS.hasOwnProperty(propKey)) {
21645 markup = DOMPropertyOperations.createMarkupForCustomAttribute(propKey, propValue);
21646 }
21647 } else {
21648 markup = DOMPropertyOperations.createMarkupForProperty(propKey, propValue);
21649 }
21650 if (markup) {
21651 ret += ' ' + markup;
21652 }
21653 }
21654 }
21655
21656 // For static pages, no need to put React ID and checksum. Saves lots of
21657 // bytes.
21658 if (transaction.renderToStaticMarkup) {
21659 return ret;
21660 }
21661
21662 if (!this._nativeParent) {
21663 ret += ' ' + DOMPropertyOperations.createMarkupForRoot();
21664 }
21665 ret += ' ' + DOMPropertyOperations.createMarkupForID(this._domID);
21666 return ret;
21667 },
21668
21669 /**
21670 * Creates markup for the content between the tags.
21671 *
21672 * @private
21673 * @param {ReactReconcileTransaction|ReactServerRenderingTransaction} transaction
21674 * @param {object} props
21675 * @param {object} context
21676 * @return {string} Content markup.
21677 */
21678 _createContentMarkup: function (transaction, props, context) {
21679 var ret = '';
21680
21681 // Intentional use of != to avoid catching zero/false.
21682 var innerHTML = props.dangerouslySetInnerHTML;
21683 if (innerHTML != null) {
21684 if (innerHTML.__html != null) {
21685 ret = innerHTML.__html;
21686 }
21687 } else {
21688 var contentToUse = CONTENT_TYPES[typeof props.children] ? props.children : null;
21689 var childrenToUse = contentToUse != null ? null : props.children;
21690 if (contentToUse != null) {
21691 // TODO: Validate that text is allowed as a child of this node
21692 ret = escapeTextContentForBrowser(contentToUse);
21693 if (process.env.NODE_ENV !== 'production') {
21694 setContentChildForInstrumentation.call(this, contentToUse);
21695 }
21696 } else if (childrenToUse != null) {
21697 var mountImages = this.mountChildren(childrenToUse, transaction, context);
21698 ret = mountImages.join('');
21699 }
21700 }
21701 if (newlineEatingTags[this._tag] && ret.charAt(0) === '\n') {
21702 // text/html ignores the first character in these tags if it's a newline
21703 // Prefer to break application/xml over text/html (for now) by adding
21704 // a newline specifically to get eaten by the parser. (Alternately for
21705 // textareas, replacing "^\n" with "\r\n" doesn't get eaten, and the first
21706 // \r is normalized out by HTMLTextAreaElement#value.)
21707 // See: <http://www.w3.org/TR/html-polyglot/#newlines-in-textarea-and-pre>
21708 // See: <http://www.w3.org/TR/html5/syntax.html#element-restrictions>
21709 // See: <http://www.w3.org/TR/html5/syntax.html#newlines>
21710 // See: Parsing of "textarea" "listing" and "pre" elements
21711 // from <http://www.w3.org/TR/html5/syntax.html#parsing-main-inbody>
21712 return '\n' + ret;
21713 } else {
21714 return ret;
21715 }
21716 },
21717
21718 _createInitialChildren: function (transaction, props, context, lazyTree) {
21719 // Intentional use of != to avoid catching zero/false.
21720 var innerHTML = props.dangerouslySetInnerHTML;
21721 if (innerHTML != null) {
21722 if (innerHTML.__html != null) {
21723 DOMLazyTree.queueHTML(lazyTree, innerHTML.__html);
21724 }
21725 } else {
21726 var contentToUse = CONTENT_TYPES[typeof props.children] ? props.children : null;
21727 var childrenToUse = contentToUse != null ? null : props.children;
21728 if (contentToUse != null) {
21729 // TODO: Validate that text is allowed as a child of this node
21730 if (process.env.NODE_ENV !== 'production') {
21731 setContentChildForInstrumentation.call(this, contentToUse);
21732 }
21733 DOMLazyTree.queueText(lazyTree, contentToUse);
21734 } else if (childrenToUse != null) {
21735 var mountImages = this.mountChildren(childrenToUse, transaction, context);
21736 for (var i = 0; i < mountImages.length; i++) {
21737 DOMLazyTree.queueChild(lazyTree, mountImages[i]);
21738 }
21739 }
21740 }
21741 },
21742
21743 /**
21744 * Receives a next element and updates the component.
21745 *
21746 * @internal
21747 * @param {ReactElement} nextElement
21748 * @param {ReactReconcileTransaction|ReactServerRenderingTransaction} transaction
21749 * @param {object} context
21750 */
21751 receiveComponent: function (nextElement, transaction, context) {
21752 var prevElement = this._currentElement;
21753 this._currentElement = nextElement;
21754 this.updateComponent(transaction, prevElement, nextElement, context);
21755 },
21756
21757 /**
21758 * Updates a native DOM component after it has already been allocated and
21759 * attached to the DOM. Reconciles the root DOM node, then recurses.
21760 *
21761 * @param {ReactReconcileTransaction} transaction
21762 * @param {ReactElement} prevElement
21763 * @param {ReactElement} nextElement
21764 * @internal
21765 * @overridable
21766 */
21767 updateComponent: function (transaction, prevElement, nextElement, context) {
21768 var lastProps = prevElement.props;
21769 var nextProps = this._currentElement.props;
21770
21771 switch (this._tag) {
21772 case 'button':
21773 lastProps = ReactDOMButton.getNativeProps(this, lastProps);
21774 nextProps = ReactDOMButton.getNativeProps(this, nextProps);
21775 break;
21776 case 'input':
21777 ReactDOMInput.updateWrapper(this);
21778 lastProps = ReactDOMInput.getNativeProps(this, lastProps);
21779 nextProps = ReactDOMInput.getNativeProps(this, nextProps);
21780 break;
21781 case 'option':
21782 lastProps = ReactDOMOption.getNativeProps(this, lastProps);
21783 nextProps = ReactDOMOption.getNativeProps(this, nextProps);
21784 break;
21785 case 'select':
21786 lastProps = ReactDOMSelect.getNativeProps(this, lastProps);
21787 nextProps = ReactDOMSelect.getNativeProps(this, nextProps);
21788 break;
21789 case 'textarea':
21790 ReactDOMTextarea.updateWrapper(this);
21791 lastProps = ReactDOMTextarea.getNativeProps(this, lastProps);
21792 nextProps = ReactDOMTextarea.getNativeProps(this, nextProps);
21793 break;
21794 }
21795
21796 assertValidProps(this, nextProps);
21797 this._updateDOMProperties(lastProps, nextProps, transaction);
21798 this._updateDOMChildren(lastProps, nextProps, transaction, context);
21799
21800 if (this._tag === 'select') {
21801 // <select> value update needs to occur after <option> children
21802 // reconciliation
21803 transaction.getReactMountReady().enqueue(postUpdateSelectWrapper, this);
21804 }
21805 },
21806
21807 /**
21808 * Reconciles the properties by detecting differences in property values and
21809 * updating the DOM as necessary. This function is probably the single most
21810 * critical path for performance optimization.
21811 *
21812 * TODO: Benchmark whether checking for changed values in memory actually
21813 * improves performance (especially statically positioned elements).
21814 * TODO: Benchmark the effects of putting this at the top since 99% of props
21815 * do not change for a given reconciliation.
21816 * TODO: Benchmark areas that can be improved with caching.
21817 *
21818 * @private
21819 * @param {object} lastProps
21820 * @param {object} nextProps
21821 * @param {?DOMElement} node
21822 */
21823 _updateDOMProperties: function (lastProps, nextProps, transaction) {
21824 var propKey;
21825 var styleName;
21826 var styleUpdates;
21827 for (propKey in lastProps) {
21828 if (nextProps.hasOwnProperty(propKey) || !lastProps.hasOwnProperty(propKey) || lastProps[propKey] == null) {
21829 continue;
21830 }
21831 if (propKey === STYLE) {
21832 var lastStyle = this._previousStyleCopy;
21833 for (styleName in lastStyle) {
21834 if (lastStyle.hasOwnProperty(styleName)) {
21835 styleUpdates = styleUpdates || {};
21836 styleUpdates[styleName] = '';
21837 }
21838 }
21839 this._previousStyleCopy = null;
21840 } else if (registrationNameModules.hasOwnProperty(propKey)) {
21841 if (lastProps[propKey]) {
21842 // Only call deleteListener if there was a listener previously or
21843 // else willDeleteListener gets called when there wasn't actually a
21844 // listener (e.g., onClick={null})
21845 deleteListener(this, propKey);
21846 }
21847 } else if (DOMProperty.properties[propKey] || DOMProperty.isCustomAttribute(propKey)) {
21848 DOMPropertyOperations.deleteValueForProperty(getNode(this), propKey);
21849 }
21850 }
21851 for (propKey in nextProps) {
21852 var nextProp = nextProps[propKey];
21853 var lastProp = propKey === STYLE ? this._previousStyleCopy : lastProps != null ? lastProps[propKey] : undefined;
21854 if (!nextProps.hasOwnProperty(propKey) || nextProp === lastProp || nextProp == null && lastProp == null) {
21855 continue;
21856 }
21857 if (propKey === STYLE) {
21858 if (nextProp) {
21859 if (process.env.NODE_ENV !== 'production') {
21860 checkAndWarnForMutatedStyle(this._previousStyleCopy, this._previousStyle, this);
21861 this._previousStyle = nextProp;
21862 }
21863 nextProp = this._previousStyleCopy = _assign({}, nextProp);
21864 } else {
21865 this._previousStyleCopy = null;
21866 }
21867 if (lastProp) {
21868 // Unset styles on `lastProp` but not on `nextProp`.
21869 for (styleName in lastProp) {
21870 if (lastProp.hasOwnProperty(styleName) && (!nextProp || !nextProp.hasOwnProperty(styleName))) {
21871 styleUpdates = styleUpdates || {};
21872 styleUpdates[styleName] = '';
21873 }
21874 }
21875 // Update styles that changed since `lastProp`.
21876 for (styleName in nextProp) {
21877 if (nextProp.hasOwnProperty(styleName) && lastProp[styleName] !== nextProp[styleName]) {
21878 styleUpdates = styleUpdates || {};
21879 styleUpdates[styleName] = nextProp[styleName];
21880 }
21881 }
21882 } else {
21883 // Relies on `updateStylesByID` not mutating `styleUpdates`.
21884 styleUpdates = nextProp;
21885 }
21886 } else if (registrationNameModules.hasOwnProperty(propKey)) {
21887 if (nextProp) {
21888 enqueuePutListener(this, propKey, nextProp, transaction);
21889 } else if (lastProp) {
21890 deleteListener(this, propKey);
21891 }
21892 } else if (isCustomComponent(this._tag, nextProps)) {
21893 if (!RESERVED_PROPS.hasOwnProperty(propKey)) {
21894 DOMPropertyOperations.setValueForAttribute(getNode(this), propKey, nextProp);
21895 }
21896 } else if (DOMProperty.properties[propKey] || DOMProperty.isCustomAttribute(propKey)) {
21897 var node = getNode(this);
21898 // If we're updating to null or undefined, we should remove the property
21899 // from the DOM node instead of inadvertently setting to a string. This
21900 // brings us in line with the same behavior we have on initial render.
21901 if (nextProp != null) {
21902 DOMPropertyOperations.setValueForProperty(node, propKey, nextProp);
21903 } else {
21904 DOMPropertyOperations.deleteValueForProperty(node, propKey);
21905 }
21906 }
21907 }
21908 if (styleUpdates) {
21909 CSSPropertyOperations.setValueForStyles(getNode(this), styleUpdates, this);
21910 }
21911 },
21912
21913 /**
21914 * Reconciles the children with the various properties that affect the
21915 * children content.
21916 *
21917 * @param {object} lastProps
21918 * @param {object} nextProps
21919 * @param {ReactReconcileTransaction} transaction
21920 * @param {object} context
21921 */
21922 _updateDOMChildren: function (lastProps, nextProps, transaction, context) {
21923 var lastContent = CONTENT_TYPES[typeof lastProps.children] ? lastProps.children : null;
21924 var nextContent = CONTENT_TYPES[typeof nextProps.children] ? nextProps.children : null;
21925
21926 var lastHtml = lastProps.dangerouslySetInnerHTML && lastProps.dangerouslySetInnerHTML.__html;
21927 var nextHtml = nextProps.dangerouslySetInnerHTML && nextProps.dangerouslySetInnerHTML.__html;
21928
21929 // Note the use of `!=` which checks for null or undefined.
21930 var lastChildren = lastContent != null ? null : lastProps.children;
21931 var nextChildren = nextContent != null ? null : nextProps.children;
21932
21933 // If we're switching from children to content/html or vice versa, remove
21934 // the old content
21935 var lastHasContentOrHtml = lastContent != null || lastHtml != null;
21936 var nextHasContentOrHtml = nextContent != null || nextHtml != null;
21937 if (lastChildren != null && nextChildren == null) {
21938 this.updateChildren(null, transaction, context);
21939 } else if (lastHasContentOrHtml && !nextHasContentOrHtml) {
21940 this.updateTextContent('');
21941 if (process.env.NODE_ENV !== 'production') {
21942 ReactInstrumentation.debugTool.onSetChildren(this._debugID, []);
21943 }
21944 }
21945
21946 if (nextContent != null) {
21947 if (lastContent !== nextContent) {
21948 this.updateTextContent('' + nextContent);
21949 if (process.env.NODE_ENV !== 'production') {
21950 this._contentDebugID = this._debugID + '#text';
21951 setContentChildForInstrumentation.call(this, nextContent);
21952 }
21953 }
21954 } else if (nextHtml != null) {
21955 if (lastHtml !== nextHtml) {
21956 this.updateMarkup('' + nextHtml);
21957 }
21958 if (process.env.NODE_ENV !== 'production') {
21959 ReactInstrumentation.debugTool.onSetChildren(this._debugID, []);
21960 }
21961 } else if (nextChildren != null) {
21962 if (process.env.NODE_ENV !== 'production') {
21963 if (this._contentDebugID) {
21964 ReactInstrumentation.debugTool.onUnmountComponent(this._contentDebugID);
21965 this._contentDebugID = null;
21966 }
21967 }
21968
21969 this.updateChildren(nextChildren, transaction, context);
21970 }
21971 },
21972
21973 getNativeNode: function () {
21974 return getNode(this);
21975 },
21976
21977 /**
21978 * Destroys all event registrations for this instance. Does not remove from
21979 * the DOM. That must be done by the parent.
21980 *
21981 * @internal
21982 */
21983 unmountComponent: function (safely) {
21984 switch (this._tag) {
21985 case 'iframe':
21986 case 'object':
21987 case 'img':
21988 case 'form':
21989 case 'video':
21990 case 'audio':
21991 var listeners = this._wrapperState.listeners;
21992 if (listeners) {
21993 for (var i = 0; i < listeners.length; i++) {
21994 listeners[i].remove();
21995 }
21996 }
21997 break;
21998 case 'html':
21999 case 'head':
22000 case 'body':
22001 /**
22002 * Components like <html> <head> and <body> can't be removed or added
22003 * easily in a cross-browser way, however it's valuable to be able to
22004 * take advantage of React's reconciliation for styling and <title>
22005 * management. So we just document it and throw in dangerous cases.
22006 */
22007 !false ? process.env.NODE_ENV !== 'production' ? invariant(false, '<%s> tried to unmount. Because of cross-browser quirks it is ' + 'impossible to unmount some top-level components (eg <html>, ' + '<head>, and <body>) reliably and efficiently. To fix this, have a ' + 'single top-level component that never unmounts render these ' + 'elements.', this._tag) : invariant(false) : void 0;
22008 break;
22009 }
22010
22011 this.unmountChildren(safely);
22012 ReactDOMComponentTree.uncacheNode(this);
22013 EventPluginHub.deleteAllListeners(this);
22014 ReactComponentBrowserEnvironment.unmountIDFromEnvironment(this._rootNodeID);
22015 this._rootNodeID = null;
22016 this._domID = null;
22017 this._wrapperState = null;
22018
22019 if (process.env.NODE_ENV !== 'production') {
22020 if (this._contentDebugID) {
22021 ReactInstrumentation.debugTool.onUnmountComponent(this._contentDebugID);
22022 this._contentDebugID = null;
22023 }
22024 }
22025 },
22026
22027 getPublicInstance: function () {
22028 return getNode(this);
22029 }
22030
22031};
22032
22033_assign(ReactDOMComponent.prototype, ReactDOMComponent.Mixin, ReactMultiChild.Mixin);
22034
22035module.exports = ReactDOMComponent;
22036}).call(this,require(91))
22037},{"159":159,"162":162,"166":166,"167":167,"168":168,"169":169,"174":174,"175":175,"176":176,"185":185,"190":190,"196":196,"198":198,"199":199,"206":206,"208":208,"209":209,"212":212,"228":228,"232":232,"245":245,"272":272,"286":286,"295":295,"296":296,"37":37,"45":45,"49":49,"54":54,"55":55,"91":91}],198:[function(require,module,exports){
22038/**
22039 * Copyright 2015-present, Facebook, Inc.
22040 * All rights reserved.
22041 *
22042 * This source code is licensed under the BSD-style license found in the
22043 * LICENSE file in the root directory of this source tree. An additional grant
22044 * of patent rights can be found in the PATENTS file in the same directory.
22045 *
22046 * @providesModule ReactDOMComponentFlags
22047 */
22048
22049'use strict';
22050
22051var ReactDOMComponentFlags = {
22052 hasCachedChildNodes: 1 << 0
22053};
22054
22055module.exports = ReactDOMComponentFlags;
22056},{}],199:[function(require,module,exports){
22057(function (process){
22058/**
22059 * Copyright 2013-present, Facebook, Inc.
22060 * All rights reserved.
22061 *
22062 * This source code is licensed under the BSD-style license found in the
22063 * LICENSE file in the root directory of this source tree. An additional grant
22064 * of patent rights can be found in the PATENTS file in the same directory.
22065 *
22066 * @providesModule ReactDOMComponentTree
22067 */
22068
22069'use strict';
22070
22071var DOMProperty = require(168);
22072var ReactDOMComponentFlags = require(198);
22073
22074var invariant = require(45);
22075
22076var ATTR_NAME = DOMProperty.ID_ATTRIBUTE_NAME;
22077var Flags = ReactDOMComponentFlags;
22078
22079var internalInstanceKey = '__reactInternalInstance$' + Math.random().toString(36).slice(2);
22080
22081/**
22082 * Drill down (through composites and empty components) until we get a native or
22083 * native text component.
22084 *
22085 * This is pretty polymorphic but unavoidable with the current structure we have
22086 * for `_renderedChildren`.
22087 */
22088function getRenderedNativeOrTextFromComponent(component) {
22089 var rendered;
22090 while (rendered = component._renderedComponent) {
22091 component = rendered;
22092 }
22093 return component;
22094}
22095
22096/**
22097 * Populate `_nativeNode` on the rendered native/text component with the given
22098 * DOM node. The passed `inst` can be a composite.
22099 */
22100function precacheNode(inst, node) {
22101 var nativeInst = getRenderedNativeOrTextFromComponent(inst);
22102 nativeInst._nativeNode = node;
22103 node[internalInstanceKey] = nativeInst;
22104}
22105
22106function uncacheNode(inst) {
22107 var node = inst._nativeNode;
22108 if (node) {
22109 delete node[internalInstanceKey];
22110 inst._nativeNode = null;
22111 }
22112}
22113
22114/**
22115 * Populate `_nativeNode` on each child of `inst`, assuming that the children
22116 * match up with the DOM (element) children of `node`.
22117 *
22118 * We cache entire levels at once to avoid an n^2 problem where we access the
22119 * children of a node sequentially and have to walk from the start to our target
22120 * node every time.
22121 *
22122 * Since we update `_renderedChildren` and the actual DOM at (slightly)
22123 * different times, we could race here and see a newer `_renderedChildren` than
22124 * the DOM nodes we see. To avoid this, ReactMultiChild calls
22125 * `prepareToManageChildren` before we change `_renderedChildren`, at which
22126 * time the container's child nodes are always cached (until it unmounts).
22127 */
22128function precacheChildNodes(inst, node) {
22129 if (inst._flags & Flags.hasCachedChildNodes) {
22130 return;
22131 }
22132 var children = inst._renderedChildren;
22133 var childNode = node.firstChild;
22134 outer: for (var name in children) {
22135 if (!children.hasOwnProperty(name)) {
22136 continue;
22137 }
22138 var childInst = children[name];
22139 var childID = getRenderedNativeOrTextFromComponent(childInst)._domID;
22140 if (childID == null) {
22141 // We're currently unmounting this child in ReactMultiChild; skip it.
22142 continue;
22143 }
22144 // We assume the child nodes are in the same order as the child instances.
22145 for (; childNode !== null; childNode = childNode.nextSibling) {
22146 if (childNode.nodeType === 1 && childNode.getAttribute(ATTR_NAME) === String(childID) || childNode.nodeType === 8 && childNode.nodeValue === ' react-text: ' + childID + ' ' || childNode.nodeType === 8 && childNode.nodeValue === ' react-empty: ' + childID + ' ') {
22147 precacheNode(childInst, childNode);
22148 continue outer;
22149 }
22150 }
22151 // We reached the end of the DOM children without finding an ID match.
22152 !false ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Unable to find element with ID %s.', childID) : invariant(false) : void 0;
22153 }
22154 inst._flags |= Flags.hasCachedChildNodes;
22155}
22156
22157/**
22158 * Given a DOM node, return the closest ReactDOMComponent or
22159 * ReactDOMTextComponent instance ancestor.
22160 */
22161function getClosestInstanceFromNode(node) {
22162 if (node[internalInstanceKey]) {
22163 return node[internalInstanceKey];
22164 }
22165
22166 // Walk up the tree until we find an ancestor whose instance we have cached.
22167 var parents = [];
22168 while (!node[internalInstanceKey]) {
22169 parents.push(node);
22170 if (node.parentNode) {
22171 node = node.parentNode;
22172 } else {
22173 // Top of the tree. This node must not be part of a React tree (or is
22174 // unmounted, potentially).
22175 return null;
22176 }
22177 }
22178
22179 var closest;
22180 var inst;
22181 for (; node && (inst = node[internalInstanceKey]); node = parents.pop()) {
22182 closest = inst;
22183 if (parents.length) {
22184 precacheChildNodes(inst, node);
22185 }
22186 }
22187
22188 return closest;
22189}
22190
22191/**
22192 * Given a DOM node, return the ReactDOMComponent or ReactDOMTextComponent
22193 * instance, or null if the node was not rendered by this React.
22194 */
22195function getInstanceFromNode(node) {
22196 var inst = getClosestInstanceFromNode(node);
22197 if (inst != null && inst._nativeNode === node) {
22198 return inst;
22199 } else {
22200 return null;
22201 }
22202}
22203
22204/**
22205 * Given a ReactDOMComponent or ReactDOMTextComponent, return the corresponding
22206 * DOM node.
22207 */
22208function getNodeFromInstance(inst) {
22209 // Without this first invariant, passing a non-DOM-component triggers the next
22210 // invariant for a missing parent, which is super confusing.
22211 !(inst._nativeNode !== undefined) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'getNodeFromInstance: Invalid argument.') : invariant(false) : void 0;
22212
22213 if (inst._nativeNode) {
22214 return inst._nativeNode;
22215 }
22216
22217 // Walk up the tree until we find an ancestor whose DOM node we have cached.
22218 var parents = [];
22219 while (!inst._nativeNode) {
22220 parents.push(inst);
22221 !inst._nativeParent ? process.env.NODE_ENV !== 'production' ? invariant(false, 'React DOM tree root should always have a node reference.') : invariant(false) : void 0;
22222 inst = inst._nativeParent;
22223 }
22224
22225 // Now parents contains each ancestor that does *not* have a cached native
22226 // node, and `inst` is the deepest ancestor that does.
22227 for (; parents.length; inst = parents.pop()) {
22228 precacheChildNodes(inst, inst._nativeNode);
22229 }
22230
22231 return inst._nativeNode;
22232}
22233
22234var ReactDOMComponentTree = {
22235 getClosestInstanceFromNode: getClosestInstanceFromNode,
22236 getInstanceFromNode: getInstanceFromNode,
22237 getNodeFromInstance: getNodeFromInstance,
22238 precacheChildNodes: precacheChildNodes,
22239 precacheNode: precacheNode,
22240 uncacheNode: uncacheNode
22241};
22242
22243module.exports = ReactDOMComponentTree;
22244}).call(this,require(91))
22245},{"168":168,"198":198,"45":45,"91":91}],200:[function(require,module,exports){
22246(function (process){
22247/**
22248 * Copyright 2013-present, Facebook, Inc.
22249 * All rights reserved.
22250 *
22251 * This source code is licensed under the BSD-style license found in the
22252 * LICENSE file in the root directory of this source tree. An additional grant
22253 * of patent rights can be found in the PATENTS file in the same directory.
22254 *
22255 * @providesModule ReactDOMContainerInfo
22256 */
22257
22258'use strict';
22259
22260var validateDOMNesting = require(295);
22261
22262var DOC_NODE_TYPE = 9;
22263
22264function ReactDOMContainerInfo(topLevelWrapper, node) {
22265 var info = {
22266 _topLevelWrapper: topLevelWrapper,
22267 _idCounter: 1,
22268 _ownerDocument: node ? node.nodeType === DOC_NODE_TYPE ? node : node.ownerDocument : null,
22269 _node: node,
22270 _tag: node ? node.nodeName.toLowerCase() : null,
22271 _namespaceURI: node ? node.namespaceURI : null
22272 };
22273 if (process.env.NODE_ENV !== 'production') {
22274 info._ancestorInfo = node ? validateDOMNesting.updatedAncestorInfo(null, info._tag, null) : null;
22275 }
22276 return info;
22277}
22278
22279module.exports = ReactDOMContainerInfo;
22280}).call(this,require(91))
22281},{"295":295,"91":91}],201:[function(require,module,exports){
22282(function (process){
22283/**
22284 * Copyright 2013-present, Facebook, Inc.
22285 * All rights reserved.
22286 *
22287 * This source code is licensed under the BSD-style license found in the
22288 * LICENSE file in the root directory of this source tree. An additional grant
22289 * of patent rights can be found in the PATENTS file in the same directory.
22290 *
22291 * @providesModule ReactDOMDebugTool
22292 */
22293
22294'use strict';
22295
22296var ReactDOMUnknownPropertyDevtool = require(214);
22297
22298var warning = require(55);
22299
22300var eventHandlers = [];
22301var handlerDoesThrowForEvent = {};
22302
22303function emitEvent(handlerFunctionName, arg1, arg2, arg3, arg4, arg5) {
22304 if (process.env.NODE_ENV !== 'production') {
22305 eventHandlers.forEach(function (handler) {
22306 try {
22307 if (handler[handlerFunctionName]) {
22308 handler[handlerFunctionName](arg1, arg2, arg3, arg4, arg5);
22309 }
22310 } catch (e) {
22311 process.env.NODE_ENV !== 'production' ? warning(!handlerDoesThrowForEvent[handlerFunctionName], 'exception thrown by devtool while handling %s: %s', handlerFunctionName, e.message) : void 0;
22312 handlerDoesThrowForEvent[handlerFunctionName] = true;
22313 }
22314 });
22315 }
22316}
22317
22318var ReactDOMDebugTool = {
22319 addDevtool: function (devtool) {
22320 eventHandlers.push(devtool);
22321 },
22322 removeDevtool: function (devtool) {
22323 for (var i = 0; i < eventHandlers.length; i++) {
22324 if (eventHandlers[i] === devtool) {
22325 eventHandlers.splice(i, 1);
22326 i--;
22327 }
22328 }
22329 },
22330 onCreateMarkupForProperty: function (name, value) {
22331 emitEvent('onCreateMarkupForProperty', name, value);
22332 },
22333 onSetValueForProperty: function (node, name, value) {
22334 emitEvent('onSetValueForProperty', node, name, value);
22335 },
22336 onDeleteValueForProperty: function (node, name) {
22337 emitEvent('onDeleteValueForProperty', node, name);
22338 }
22339};
22340
22341ReactDOMDebugTool.addDevtool(ReactDOMUnknownPropertyDevtool);
22342
22343module.exports = ReactDOMDebugTool;
22344}).call(this,require(91))
22345},{"214":214,"55":55,"91":91}],202:[function(require,module,exports){
22346/**
22347 * Copyright 2014-present, Facebook, Inc.
22348 * All rights reserved.
22349 *
22350 * This source code is licensed under the BSD-style license found in the
22351 * LICENSE file in the root directory of this source tree. An additional grant
22352 * of patent rights can be found in the PATENTS file in the same directory.
22353 *
22354 * @providesModule ReactDOMEmptyComponent
22355 */
22356
22357'use strict';
22358
22359var _assign = require(296);
22360
22361var DOMLazyTree = require(166);
22362var ReactDOMComponentTree = require(199);
22363
22364var ReactDOMEmptyComponent = function (instantiate) {
22365 // ReactCompositeComponent uses this:
22366 this._currentElement = null;
22367 // ReactDOMComponentTree uses these:
22368 this._nativeNode = null;
22369 this._nativeParent = null;
22370 this._nativeContainerInfo = null;
22371 this._domID = null;
22372};
22373_assign(ReactDOMEmptyComponent.prototype, {
22374 mountComponent: function (transaction, nativeParent, nativeContainerInfo, context) {
22375 var domID = nativeContainerInfo._idCounter++;
22376 this._domID = domID;
22377 this._nativeParent = nativeParent;
22378 this._nativeContainerInfo = nativeContainerInfo;
22379
22380 var nodeValue = ' react-empty: ' + this._domID + ' ';
22381 if (transaction.useCreateElement) {
22382 var ownerDocument = nativeContainerInfo._ownerDocument;
22383 var node = ownerDocument.createComment(nodeValue);
22384 ReactDOMComponentTree.precacheNode(this, node);
22385 return DOMLazyTree(node);
22386 } else {
22387 if (transaction.renderToStaticMarkup) {
22388 // Normally we'd insert a comment node, but since this is a situation
22389 // where React won't take over (static pages), we can simply return
22390 // nothing.
22391 return '';
22392 }
22393 return '<!--' + nodeValue + '-->';
22394 }
22395 },
22396 receiveComponent: function () {},
22397 getNativeNode: function () {
22398 return ReactDOMComponentTree.getNodeFromInstance(this);
22399 },
22400 unmountComponent: function () {
22401 ReactDOMComponentTree.uncacheNode(this);
22402 }
22403});
22404
22405module.exports = ReactDOMEmptyComponent;
22406},{"166":166,"199":199,"296":296}],203:[function(require,module,exports){
22407(function (process){
22408/**
22409 * Copyright 2013-present, Facebook, Inc.
22410 * All rights reserved.
22411 *
22412 * This source code is licensed under the BSD-style license found in the
22413 * LICENSE file in the root directory of this source tree. An additional grant
22414 * of patent rights can be found in the PATENTS file in the same directory.
22415 *
22416 * @providesModule ReactDOMFactories
22417 */
22418
22419'use strict';
22420
22421var ReactElement = require(218);
22422var ReactElementValidator = require(219);
22423
22424var mapObject = require(50);
22425
22426/**
22427 * Create a factory that creates HTML tag elements.
22428 *
22429 * @param {string} tag Tag name (e.g. `div`).
22430 * @private
22431 */
22432function createDOMFactory(tag) {
22433 if (process.env.NODE_ENV !== 'production') {
22434 return ReactElementValidator.createFactory(tag);
22435 }
22436 return ReactElement.createFactory(tag);
22437}
22438
22439/**
22440 * Creates a mapping from supported HTML tags to `ReactDOMComponent` classes.
22441 * This is also accessible via `React.DOM`.
22442 *
22443 * @public
22444 */
22445var ReactDOMFactories = mapObject({
22446 a: 'a',
22447 abbr: 'abbr',
22448 address: 'address',
22449 area: 'area',
22450 article: 'article',
22451 aside: 'aside',
22452 audio: 'audio',
22453 b: 'b',
22454 base: 'base',
22455 bdi: 'bdi',
22456 bdo: 'bdo',
22457 big: 'big',
22458 blockquote: 'blockquote',
22459 body: 'body',
22460 br: 'br',
22461 button: 'button',
22462 canvas: 'canvas',
22463 caption: 'caption',
22464 cite: 'cite',
22465 code: 'code',
22466 col: 'col',
22467 colgroup: 'colgroup',
22468 data: 'data',
22469 datalist: 'datalist',
22470 dd: 'dd',
22471 del: 'del',
22472 details: 'details',
22473 dfn: 'dfn',
22474 dialog: 'dialog',
22475 div: 'div',
22476 dl: 'dl',
22477 dt: 'dt',
22478 em: 'em',
22479 embed: 'embed',
22480 fieldset: 'fieldset',
22481 figcaption: 'figcaption',
22482 figure: 'figure',
22483 footer: 'footer',
22484 form: 'form',
22485 h1: 'h1',
22486 h2: 'h2',
22487 h3: 'h3',
22488 h4: 'h4',
22489 h5: 'h5',
22490 h6: 'h6',
22491 head: 'head',
22492 header: 'header',
22493 hgroup: 'hgroup',
22494 hr: 'hr',
22495 html: 'html',
22496 i: 'i',
22497 iframe: 'iframe',
22498 img: 'img',
22499 input: 'input',
22500 ins: 'ins',
22501 kbd: 'kbd',
22502 keygen: 'keygen',
22503 label: 'label',
22504 legend: 'legend',
22505 li: 'li',
22506 link: 'link',
22507 main: 'main',
22508 map: 'map',
22509 mark: 'mark',
22510 menu: 'menu',
22511 menuitem: 'menuitem',
22512 meta: 'meta',
22513 meter: 'meter',
22514 nav: 'nav',
22515 noscript: 'noscript',
22516 object: 'object',
22517 ol: 'ol',
22518 optgroup: 'optgroup',
22519 option: 'option',
22520 output: 'output',
22521 p: 'p',
22522 param: 'param',
22523 picture: 'picture',
22524 pre: 'pre',
22525 progress: 'progress',
22526 q: 'q',
22527 rp: 'rp',
22528 rt: 'rt',
22529 ruby: 'ruby',
22530 s: 's',
22531 samp: 'samp',
22532 script: 'script',
22533 section: 'section',
22534 select: 'select',
22535 small: 'small',
22536 source: 'source',
22537 span: 'span',
22538 strong: 'strong',
22539 style: 'style',
22540 sub: 'sub',
22541 summary: 'summary',
22542 sup: 'sup',
22543 table: 'table',
22544 tbody: 'tbody',
22545 td: 'td',
22546 textarea: 'textarea',
22547 tfoot: 'tfoot',
22548 th: 'th',
22549 thead: 'thead',
22550 time: 'time',
22551 title: 'title',
22552 tr: 'tr',
22553 track: 'track',
22554 u: 'u',
22555 ul: 'ul',
22556 'var': 'var',
22557 video: 'video',
22558 wbr: 'wbr',
22559
22560 // SVG
22561 circle: 'circle',
22562 clipPath: 'clipPath',
22563 defs: 'defs',
22564 ellipse: 'ellipse',
22565 g: 'g',
22566 image: 'image',
22567 line: 'line',
22568 linearGradient: 'linearGradient',
22569 mask: 'mask',
22570 path: 'path',
22571 pattern: 'pattern',
22572 polygon: 'polygon',
22573 polyline: 'polyline',
22574 radialGradient: 'radialGradient',
22575 rect: 'rect',
22576 stop: 'stop',
22577 svg: 'svg',
22578 text: 'text',
22579 tspan: 'tspan'
22580
22581}, createDOMFactory);
22582
22583module.exports = ReactDOMFactories;
22584}).call(this,require(91))
22585},{"218":218,"219":219,"50":50,"91":91}],204:[function(require,module,exports){
22586/**
22587 * Copyright 2013-present, Facebook, Inc.
22588 * All rights reserved.
22589 *
22590 * This source code is licensed under the BSD-style license found in the
22591 * LICENSE file in the root directory of this source tree. An additional grant
22592 * of patent rights can be found in the PATENTS file in the same directory.
22593 *
22594 * @providesModule ReactDOMFeatureFlags
22595 */
22596
22597'use strict';
22598
22599var ReactDOMFeatureFlags = {
22600 useCreateElement: true
22601};
22602
22603module.exports = ReactDOMFeatureFlags;
22604},{}],205:[function(require,module,exports){
22605/**
22606 * Copyright 2013-present, Facebook, Inc.
22607 * All rights reserved.
22608 *
22609 * This source code is licensed under the BSD-style license found in the
22610 * LICENSE file in the root directory of this source tree. An additional grant
22611 * of patent rights can be found in the PATENTS file in the same directory.
22612 *
22613 * @providesModule ReactDOMIDOperations
22614 */
22615
22616'use strict';
22617
22618var DOMChildrenOperations = require(165);
22619var ReactDOMComponentTree = require(199);
22620
22621/**
22622 * Operations used to process updates to DOM nodes.
22623 */
22624var ReactDOMIDOperations = {
22625
22626 /**
22627 * Updates a component's children by processing a series of updates.
22628 *
22629 * @param {array<object>} updates List of update configurations.
22630 * @internal
22631 */
22632 dangerouslyProcessChildrenUpdates: function (parentInst, updates) {
22633 var node = ReactDOMComponentTree.getNodeFromInstance(parentInst);
22634 DOMChildrenOperations.processUpdates(node, updates);
22635 }
22636};
22637
22638module.exports = ReactDOMIDOperations;
22639},{"165":165,"199":199}],206:[function(require,module,exports){
22640(function (process){
22641/**
22642 * Copyright 2013-present, Facebook, Inc.
22643 * All rights reserved.
22644 *
22645 * This source code is licensed under the BSD-style license found in the
22646 * LICENSE file in the root directory of this source tree. An additional grant
22647 * of patent rights can be found in the PATENTS file in the same directory.
22648 *
22649 * @providesModule ReactDOMInput
22650 */
22651
22652'use strict';
22653
22654var _assign = require(296);
22655
22656var DisabledInputUtils = require(172);
22657var DOMPropertyOperations = require(169);
22658var LinkedValueUtils = require(182);
22659var ReactDOMComponentTree = require(199);
22660var ReactUpdates = require(247);
22661
22662var invariant = require(45);
22663var warning = require(55);
22664
22665var didWarnValueLink = false;
22666var didWarnCheckedLink = false;
22667var didWarnValueNull = false;
22668var didWarnValueDefaultValue = false;
22669var didWarnCheckedDefaultChecked = false;
22670var didWarnControlledToUncontrolled = false;
22671var didWarnUncontrolledToControlled = false;
22672
22673function forceUpdateIfMounted() {
22674 if (this._rootNodeID) {
22675 // DOM component is still mounted; update
22676 ReactDOMInput.updateWrapper(this);
22677 }
22678}
22679
22680function warnIfValueIsNull(props) {
22681 if (props != null && props.value === null && !didWarnValueNull) {
22682 process.env.NODE_ENV !== 'production' ? warning(false, '`value` prop on `input` should not be null. ' + 'Consider using the empty string to clear the component or `undefined` ' + 'for uncontrolled components.') : void 0;
22683
22684 didWarnValueNull = true;
22685 }
22686}
22687
22688/**
22689 * Implements an <input> native component that allows setting these optional
22690 * props: `checked`, `value`, `defaultChecked`, and `defaultValue`.
22691 *
22692 * If `checked` or `value` are not supplied (or null/undefined), user actions
22693 * that affect the checked state or value will trigger updates to the element.
22694 *
22695 * If they are supplied (and not null/undefined), the rendered element will not
22696 * trigger updates to the element. Instead, the props must change in order for
22697 * the rendered element to be updated.
22698 *
22699 * The rendered element will be initialized as unchecked (or `defaultChecked`)
22700 * with an empty value (or `defaultValue`).
22701 *
22702 * @see http://www.w3.org/TR/2012/WD-html5-20121025/the-input-element.html
22703 */
22704var ReactDOMInput = {
22705 getNativeProps: function (inst, props) {
22706 var value = LinkedValueUtils.getValue(props);
22707 var checked = LinkedValueUtils.getChecked(props);
22708
22709 var nativeProps = _assign({
22710 // Make sure we set .type before any other properties (setting .value
22711 // before .type means .value is lost in IE11 and below)
22712 type: undefined
22713 }, DisabledInputUtils.getNativeProps(inst, props), {
22714 defaultChecked: undefined,
22715 defaultValue: undefined,
22716 value: value != null ? value : inst._wrapperState.initialValue,
22717 checked: checked != null ? checked : inst._wrapperState.initialChecked,
22718 onChange: inst._wrapperState.onChange
22719 });
22720
22721 return nativeProps;
22722 },
22723
22724 mountWrapper: function (inst, props) {
22725 if (process.env.NODE_ENV !== 'production') {
22726 LinkedValueUtils.checkPropTypes('input', props, inst._currentElement._owner);
22727
22728 var owner = inst._currentElement._owner;
22729
22730 if (props.valueLink !== undefined && !didWarnValueLink) {
22731 process.env.NODE_ENV !== 'production' ? warning(false, '`valueLink` prop on `input` is deprecated; set `value` and `onChange` instead.') : void 0;
22732 didWarnValueLink = true;
22733 }
22734 if (props.checkedLink !== undefined && !didWarnCheckedLink) {
22735 process.env.NODE_ENV !== 'production' ? warning(false, '`checkedLink` prop on `input` is deprecated; set `value` and `onChange` instead.') : void 0;
22736 didWarnCheckedLink = true;
22737 }
22738 if (props.checked !== undefined && props.defaultChecked !== undefined && !didWarnCheckedDefaultChecked) {
22739 process.env.NODE_ENV !== 'production' ? warning(false, '%s contains an input of type %s with both checked and defaultChecked props. ' + 'Input elements must be either controlled or uncontrolled ' + '(specify either the checked prop, or the defaultChecked prop, but not ' + 'both). Decide between using a controlled or uncontrolled input ' + 'element and remove one of these props. More info: ' + 'https://fb.me/react-controlled-components', owner && owner.getName() || 'A component', props.type) : void 0;
22740 didWarnCheckedDefaultChecked = true;
22741 }
22742 if (props.value !== undefined && props.defaultValue !== undefined && !didWarnValueDefaultValue) {
22743 process.env.NODE_ENV !== 'production' ? warning(false, '%s contains an input of type %s with both value and defaultValue props. ' + 'Input elements must be either controlled or uncontrolled ' + '(specify either the value prop, or the defaultValue prop, but not ' + 'both). Decide between using a controlled or uncontrolled input ' + 'element and remove one of these props. More info: ' + 'https://fb.me/react-controlled-components', owner && owner.getName() || 'A component', props.type) : void 0;
22744 didWarnValueDefaultValue = true;
22745 }
22746 warnIfValueIsNull(props);
22747 }
22748
22749 var defaultValue = props.defaultValue;
22750 inst._wrapperState = {
22751 initialChecked: props.defaultChecked || false,
22752 initialValue: defaultValue != null ? defaultValue : null,
22753 listeners: null,
22754 onChange: _handleChange.bind(inst)
22755 };
22756
22757 if (process.env.NODE_ENV !== 'production') {
22758 inst._wrapperState.controlled = props.checked !== undefined || props.value !== undefined;
22759 }
22760 },
22761
22762 updateWrapper: function (inst) {
22763 var props = inst._currentElement.props;
22764
22765 if (process.env.NODE_ENV !== 'production') {
22766 warnIfValueIsNull(props);
22767
22768 var initialValue = inst._wrapperState.initialChecked || inst._wrapperState.initialValue;
22769 var defaultValue = props.defaultChecked || props.defaultValue;
22770 var controlled = props.checked !== undefined || props.value !== undefined;
22771 var owner = inst._currentElement._owner;
22772
22773 if ((initialValue || !inst._wrapperState.controlled) && controlled && !didWarnUncontrolledToControlled) {
22774 process.env.NODE_ENV !== 'production' ? warning(false, '%s is changing an uncontrolled input of type %s to be controlled. ' + 'Input elements should not switch from uncontrolled to controlled (or vice versa). ' + 'Decide between using a controlled or uncontrolled input ' + 'element for the lifetime of the component. More info: https://fb.me/react-controlled-components', owner && owner.getName() || 'A component', props.type) : void 0;
22775 didWarnUncontrolledToControlled = true;
22776 }
22777 if (inst._wrapperState.controlled && (defaultValue || !controlled) && !didWarnControlledToUncontrolled) {
22778 process.env.NODE_ENV !== 'production' ? warning(false, '%s is changing a controlled input of type %s to be uncontrolled. ' + 'Input elements should not switch from controlled to uncontrolled (or vice versa). ' + 'Decide between using a controlled or uncontrolled input ' + 'element for the lifetime of the component. More info: https://fb.me/react-controlled-components', owner && owner.getName() || 'A component', props.type) : void 0;
22779 didWarnControlledToUncontrolled = true;
22780 }
22781 }
22782
22783 // TODO: Shouldn't this be getChecked(props)?
22784 var checked = props.checked;
22785 if (checked != null) {
22786 DOMPropertyOperations.setValueForProperty(ReactDOMComponentTree.getNodeFromInstance(inst), 'checked', checked || false);
22787 }
22788
22789 var value = LinkedValueUtils.getValue(props);
22790 if (value != null) {
22791 // Cast `value` to a string to ensure the value is set correctly. While
22792 // browsers typically do this as necessary, jsdom doesn't.
22793 DOMPropertyOperations.setValueForProperty(ReactDOMComponentTree.getNodeFromInstance(inst), 'value', '' + value);
22794 }
22795 }
22796};
22797
22798function _handleChange(event) {
22799 var props = this._currentElement.props;
22800
22801 var returnValue = LinkedValueUtils.executeOnChange(props, event);
22802
22803 // Here we use asap to wait until all updates have propagated, which
22804 // is important when using controlled components within layers:
22805 // https://github.com/facebook/react/issues/1698
22806 ReactUpdates.asap(forceUpdateIfMounted, this);
22807
22808 var name = props.name;
22809 if (props.type === 'radio' && name != null) {
22810 var rootNode = ReactDOMComponentTree.getNodeFromInstance(this);
22811 var queryRoot = rootNode;
22812
22813 while (queryRoot.parentNode) {
22814 queryRoot = queryRoot.parentNode;
22815 }
22816
22817 // If `rootNode.form` was non-null, then we could try `form.elements`,
22818 // but that sometimes behaves strangely in IE8. We could also try using
22819 // `form.getElementsByName`, but that will only return direct children
22820 // and won't include inputs that use the HTML5 `form=` attribute. Since
22821 // the input might not even be in a form, let's just use the global
22822 // `querySelectorAll` to ensure we don't miss anything.
22823 var group = queryRoot.querySelectorAll('input[name=' + JSON.stringify('' + name) + '][type="radio"]');
22824
22825 for (var i = 0; i < group.length; i++) {
22826 var otherNode = group[i];
22827 if (otherNode === rootNode || otherNode.form !== rootNode.form) {
22828 continue;
22829 }
22830 // This will throw if radio buttons rendered by different copies of React
22831 // and the same name are rendered into the same form (same as #1939).
22832 // That's probably okay; we don't support it just as we don't support
22833 // mixing React radio buttons with non-React ones.
22834 var otherInstance = ReactDOMComponentTree.getInstanceFromNode(otherNode);
22835 !otherInstance ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactDOMInput: Mixing React and non-React radio inputs with the ' + 'same `name` is not supported.') : invariant(false) : void 0;
22836 // If this is a controlled radio button group, forcing the input that
22837 // was previously checked to update will cause it to be come re-checked
22838 // as appropriate.
22839 ReactUpdates.asap(forceUpdateIfMounted, otherInstance);
22840 }
22841 }
22842
22843 return returnValue;
22844}
22845
22846module.exports = ReactDOMInput;
22847}).call(this,require(91))
22848},{"169":169,"172":172,"182":182,"199":199,"247":247,"296":296,"45":45,"55":55,"91":91}],207:[function(require,module,exports){
22849/**
22850 * Copyright 2013-present, Facebook, Inc.
22851 * All rights reserved.
22852 *
22853 * This source code is licensed under the BSD-style license found in the
22854 * LICENSE file in the root directory of this source tree. An additional grant
22855 * of patent rights can be found in the PATENTS file in the same directory.
22856 *
22857 * @providesModule ReactDOMInstrumentation
22858 */
22859
22860'use strict';
22861
22862var ReactDOMDebugTool = require(201);
22863
22864module.exports = { debugTool: ReactDOMDebugTool };
22865},{"201":201}],208:[function(require,module,exports){
22866(function (process){
22867/**
22868 * Copyright 2013-present, Facebook, Inc.
22869 * All rights reserved.
22870 *
22871 * This source code is licensed under the BSD-style license found in the
22872 * LICENSE file in the root directory of this source tree. An additional grant
22873 * of patent rights can be found in the PATENTS file in the same directory.
22874 *
22875 * @providesModule ReactDOMOption
22876 */
22877
22878'use strict';
22879
22880var _assign = require(296);
22881
22882var ReactChildren = require(187);
22883var ReactDOMComponentTree = require(199);
22884var ReactDOMSelect = require(209);
22885
22886var warning = require(55);
22887
22888/**
22889 * Implements an <option> native component that warns when `selected` is set.
22890 */
22891var ReactDOMOption = {
22892 mountWrapper: function (inst, props, nativeParent) {
22893 // TODO (yungsters): Remove support for `selected` in <option>.
22894 if (process.env.NODE_ENV !== 'production') {
22895 process.env.NODE_ENV !== 'production' ? warning(props.selected == null, 'Use the `defaultValue` or `value` props on <select> instead of ' + 'setting `selected` on <option>.') : void 0;
22896 }
22897
22898 // Look up whether this option is 'selected'
22899 var selectValue = null;
22900 if (nativeParent != null) {
22901 var selectParent = nativeParent;
22902
22903 if (selectParent._tag === 'optgroup') {
22904 selectParent = selectParent._nativeParent;
22905 }
22906
22907 if (selectParent != null && selectParent._tag === 'select') {
22908 selectValue = ReactDOMSelect.getSelectValueContext(selectParent);
22909 }
22910 }
22911
22912 // If the value is null (e.g., no specified value or after initial mount)
22913 // or missing (e.g., for <datalist>), we don't change props.selected
22914 var selected = null;
22915 if (selectValue != null) {
22916 selected = false;
22917 if (Array.isArray(selectValue)) {
22918 // multiple
22919 for (var i = 0; i < selectValue.length; i++) {
22920 if ('' + selectValue[i] === '' + props.value) {
22921 selected = true;
22922 break;
22923 }
22924 }
22925 } else {
22926 selected = '' + selectValue === '' + props.value;
22927 }
22928 }
22929
22930 inst._wrapperState = { selected: selected };
22931 },
22932
22933 postMountWrapper: function (inst) {
22934 // value="" should make a value attribute (#6219)
22935 var props = inst._currentElement.props;
22936 if (props.value != null) {
22937 var node = ReactDOMComponentTree.getNodeFromInstance(inst);
22938 node.setAttribute('value', props.value);
22939 }
22940 },
22941
22942 getNativeProps: function (inst, props) {
22943 var nativeProps = _assign({ selected: undefined, children: undefined }, props);
22944
22945 // Read state only from initial mount because <select> updates value
22946 // manually; we need the initial state only for server rendering
22947 if (inst._wrapperState.selected != null) {
22948 nativeProps.selected = inst._wrapperState.selected;
22949 }
22950
22951 var content = '';
22952
22953 // Flatten children and warn if they aren't strings or numbers;
22954 // invalid types are ignored.
22955 ReactChildren.forEach(props.children, function (child) {
22956 if (child == null) {
22957 return;
22958 }
22959 if (typeof child === 'string' || typeof child === 'number') {
22960 content += child;
22961 } else {
22962 process.env.NODE_ENV !== 'production' ? warning(false, 'Only strings and numbers are supported as <option> children.') : void 0;
22963 }
22964 });
22965
22966 if (content) {
22967 nativeProps.children = content;
22968 }
22969
22970 return nativeProps;
22971 }
22972
22973};
22974
22975module.exports = ReactDOMOption;
22976}).call(this,require(91))
22977},{"187":187,"199":199,"209":209,"296":296,"55":55,"91":91}],209:[function(require,module,exports){
22978(function (process){
22979/**
22980 * Copyright 2013-present, Facebook, Inc.
22981 * All rights reserved.
22982 *
22983 * This source code is licensed under the BSD-style license found in the
22984 * LICENSE file in the root directory of this source tree. An additional grant
22985 * of patent rights can be found in the PATENTS file in the same directory.
22986 *
22987 * @providesModule ReactDOMSelect
22988 */
22989
22990'use strict';
22991
22992var _assign = require(296);
22993
22994var DisabledInputUtils = require(172);
22995var LinkedValueUtils = require(182);
22996var ReactDOMComponentTree = require(199);
22997var ReactUpdates = require(247);
22998
22999var warning = require(55);
23000
23001var didWarnValueLink = false;
23002var didWarnValueNull = false;
23003var didWarnValueDefaultValue = false;
23004
23005function updateOptionsIfPendingUpdateAndMounted() {
23006 if (this._rootNodeID && this._wrapperState.pendingUpdate) {
23007 this._wrapperState.pendingUpdate = false;
23008
23009 var props = this._currentElement.props;
23010 var value = LinkedValueUtils.getValue(props);
23011
23012 if (value != null) {
23013 updateOptions(this, Boolean(props.multiple), value);
23014 }
23015 }
23016}
23017
23018function getDeclarationErrorAddendum(owner) {
23019 if (owner) {
23020 var name = owner.getName();
23021 if (name) {
23022 return ' Check the render method of `' + name + '`.';
23023 }
23024 }
23025 return '';
23026}
23027
23028function warnIfValueIsNull(props) {
23029 if (props != null && props.value === null && !didWarnValueNull) {
23030 process.env.NODE_ENV !== 'production' ? warning(false, '`value` prop on `select` should not be null. ' + 'Consider using the empty string to clear the component or `undefined` ' + 'for uncontrolled components.') : void 0;
23031
23032 didWarnValueNull = true;
23033 }
23034}
23035
23036var valuePropNames = ['value', 'defaultValue'];
23037
23038/**
23039 * Validation function for `value` and `defaultValue`.
23040 * @private
23041 */
23042function checkSelectPropTypes(inst, props) {
23043 var owner = inst._currentElement._owner;
23044 LinkedValueUtils.checkPropTypes('select', props, owner);
23045
23046 if (props.valueLink !== undefined && !didWarnValueLink) {
23047 process.env.NODE_ENV !== 'production' ? warning(false, '`valueLink` prop on `select` is deprecated; set `value` and `onChange` instead.') : void 0;
23048 didWarnValueLink = true;
23049 }
23050
23051 for (var i = 0; i < valuePropNames.length; i++) {
23052 var propName = valuePropNames[i];
23053 if (props[propName] == null) {
23054 continue;
23055 }
23056 if (props.multiple) {
23057 process.env.NODE_ENV !== 'production' ? warning(Array.isArray(props[propName]), 'The `%s` prop supplied to <select> must be an array if ' + '`multiple` is true.%s', propName, getDeclarationErrorAddendum(owner)) : void 0;
23058 } else {
23059 process.env.NODE_ENV !== 'production' ? warning(!Array.isArray(props[propName]), 'The `%s` prop supplied to <select> must be a scalar ' + 'value if `multiple` is false.%s', propName, getDeclarationErrorAddendum(owner)) : void 0;
23060 }
23061 }
23062}
23063
23064/**
23065 * @param {ReactDOMComponent} inst
23066 * @param {boolean} multiple
23067 * @param {*} propValue A stringable (with `multiple`, a list of stringables).
23068 * @private
23069 */
23070function updateOptions(inst, multiple, propValue) {
23071 var selectedValue, i;
23072 var options = ReactDOMComponentTree.getNodeFromInstance(inst).options;
23073
23074 if (multiple) {
23075 selectedValue = {};
23076 for (i = 0; i < propValue.length; i++) {
23077 selectedValue['' + propValue[i]] = true;
23078 }
23079 for (i = 0; i < options.length; i++) {
23080 var selected = selectedValue.hasOwnProperty(options[i].value);
23081 if (options[i].selected !== selected) {
23082 options[i].selected = selected;
23083 }
23084 }
23085 } else {
23086 // Do not set `select.value` as exact behavior isn't consistent across all
23087 // browsers for all cases.
23088 selectedValue = '' + propValue;
23089 for (i = 0; i < options.length; i++) {
23090 if (options[i].value === selectedValue) {
23091 options[i].selected = true;
23092 return;
23093 }
23094 }
23095 if (options.length) {
23096 options[0].selected = true;
23097 }
23098 }
23099}
23100
23101/**
23102 * Implements a <select> native component that allows optionally setting the
23103 * props `value` and `defaultValue`. If `multiple` is false, the prop must be a
23104 * stringable. If `multiple` is true, the prop must be an array of stringables.
23105 *
23106 * If `value` is not supplied (or null/undefined), user actions that change the
23107 * selected option will trigger updates to the rendered options.
23108 *
23109 * If it is supplied (and not null/undefined), the rendered options will not
23110 * update in response to user actions. Instead, the `value` prop must change in
23111 * order for the rendered options to update.
23112 *
23113 * If `defaultValue` is provided, any options with the supplied values will be
23114 * selected.
23115 */
23116var ReactDOMSelect = {
23117 getNativeProps: function (inst, props) {
23118 return _assign({}, DisabledInputUtils.getNativeProps(inst, props), {
23119 onChange: inst._wrapperState.onChange,
23120 value: undefined
23121 });
23122 },
23123
23124 mountWrapper: function (inst, props) {
23125 if (process.env.NODE_ENV !== 'production') {
23126 checkSelectPropTypes(inst, props);
23127 warnIfValueIsNull(props);
23128 }
23129
23130 var value = LinkedValueUtils.getValue(props);
23131 inst._wrapperState = {
23132 pendingUpdate: false,
23133 initialValue: value != null ? value : props.defaultValue,
23134 listeners: null,
23135 onChange: _handleChange.bind(inst),
23136 wasMultiple: Boolean(props.multiple)
23137 };
23138
23139 if (props.value !== undefined && props.defaultValue !== undefined && !didWarnValueDefaultValue) {
23140 process.env.NODE_ENV !== 'production' ? warning(false, 'Select elements must be either controlled or uncontrolled ' + '(specify either the value prop, or the defaultValue prop, but not ' + 'both). Decide between using a controlled or uncontrolled select ' + 'element and remove one of these props. More info: ' + 'https://fb.me/react-controlled-components') : void 0;
23141 didWarnValueDefaultValue = true;
23142 }
23143 },
23144
23145 getSelectValueContext: function (inst) {
23146 // ReactDOMOption looks at this initial value so the initial generated
23147 // markup has correct `selected` attributes
23148 return inst._wrapperState.initialValue;
23149 },
23150
23151 postUpdateWrapper: function (inst) {
23152 var props = inst._currentElement.props;
23153 if (process.env.NODE_ENV !== 'production') {
23154 warnIfValueIsNull(props);
23155 }
23156
23157 // After the initial mount, we control selected-ness manually so don't pass
23158 // this value down
23159 inst._wrapperState.initialValue = undefined;
23160
23161 var wasMultiple = inst._wrapperState.wasMultiple;
23162 inst._wrapperState.wasMultiple = Boolean(props.multiple);
23163
23164 var value = LinkedValueUtils.getValue(props);
23165 if (value != null) {
23166 inst._wrapperState.pendingUpdate = false;
23167 updateOptions(inst, Boolean(props.multiple), value);
23168 } else if (wasMultiple !== Boolean(props.multiple)) {
23169 // For simplicity, reapply `defaultValue` if `multiple` is toggled.
23170 if (props.defaultValue != null) {
23171 updateOptions(inst, Boolean(props.multiple), props.defaultValue);
23172 } else {
23173 // Revert the select back to its default unselected state.
23174 updateOptions(inst, Boolean(props.multiple), props.multiple ? [] : '');
23175 }
23176 }
23177 }
23178};
23179
23180function _handleChange(event) {
23181 var props = this._currentElement.props;
23182 var returnValue = LinkedValueUtils.executeOnChange(props, event);
23183
23184 if (this._rootNodeID) {
23185 this._wrapperState.pendingUpdate = true;
23186 }
23187 ReactUpdates.asap(updateOptionsIfPendingUpdateAndMounted, this);
23188 return returnValue;
23189}
23190
23191module.exports = ReactDOMSelect;
23192}).call(this,require(91))
23193},{"172":172,"182":182,"199":199,"247":247,"296":296,"55":55,"91":91}],210:[function(require,module,exports){
23194/**
23195 * Copyright 2013-present, Facebook, Inc.
23196 * All rights reserved.
23197 *
23198 * This source code is licensed under the BSD-style license found in the
23199 * LICENSE file in the root directory of this source tree. An additional grant
23200 * of patent rights can be found in the PATENTS file in the same directory.
23201 *
23202 * @providesModule ReactDOMSelection
23203 */
23204
23205'use strict';
23206
23207var ExecutionEnvironment = require(31);
23208
23209var getNodeForCharacterOffset = require(282);
23210var getTextContentAccessor = require(283);
23211
23212/**
23213 * While `isCollapsed` is available on the Selection object and `collapsed`
23214 * is available on the Range object, IE11 sometimes gets them wrong.
23215 * If the anchor/focus nodes and offsets are the same, the range is collapsed.
23216 */
23217function isCollapsed(anchorNode, anchorOffset, focusNode, focusOffset) {
23218 return anchorNode === focusNode && anchorOffset === focusOffset;
23219}
23220
23221/**
23222 * Get the appropriate anchor and focus node/offset pairs for IE.
23223 *
23224 * The catch here is that IE's selection API doesn't provide information
23225 * about whether the selection is forward or backward, so we have to
23226 * behave as though it's always forward.
23227 *
23228 * IE text differs from modern selection in that it behaves as though
23229 * block elements end with a new line. This means character offsets will
23230 * differ between the two APIs.
23231 *
23232 * @param {DOMElement} node
23233 * @return {object}
23234 */
23235function getIEOffsets(node) {
23236 var selection = document.selection;
23237 var selectedRange = selection.createRange();
23238 var selectedLength = selectedRange.text.length;
23239
23240 // Duplicate selection so we can move range without breaking user selection.
23241 var fromStart = selectedRange.duplicate();
23242 fromStart.moveToElementText(node);
23243 fromStart.setEndPoint('EndToStart', selectedRange);
23244
23245 var startOffset = fromStart.text.length;
23246 var endOffset = startOffset + selectedLength;
23247
23248 return {
23249 start: startOffset,
23250 end: endOffset
23251 };
23252}
23253
23254/**
23255 * @param {DOMElement} node
23256 * @return {?object}
23257 */
23258function getModernOffsets(node) {
23259 var selection = window.getSelection && window.getSelection();
23260
23261 if (!selection || selection.rangeCount === 0) {
23262 return null;
23263 }
23264
23265 var anchorNode = selection.anchorNode;
23266 var anchorOffset = selection.anchorOffset;
23267 var focusNode = selection.focusNode;
23268 var focusOffset = selection.focusOffset;
23269
23270 var currentRange = selection.getRangeAt(0);
23271
23272 // In Firefox, range.startContainer and range.endContainer can be "anonymous
23273 // divs", e.g. the up/down buttons on an <input type="number">. Anonymous
23274 // divs do not seem to expose properties, triggering a "Permission denied
23275 // error" if any of its properties are accessed. The only seemingly possible
23276 // way to avoid erroring is to access a property that typically works for
23277 // non-anonymous divs and catch any error that may otherwise arise. See
23278 // https://bugzilla.mozilla.org/show_bug.cgi?id=208427
23279 try {
23280 /* eslint-disable no-unused-expressions */
23281 currentRange.startContainer.nodeType;
23282 currentRange.endContainer.nodeType;
23283 /* eslint-enable no-unused-expressions */
23284 } catch (e) {
23285 return null;
23286 }
23287
23288 // If the node and offset values are the same, the selection is collapsed.
23289 // `Selection.isCollapsed` is available natively, but IE sometimes gets
23290 // this value wrong.
23291 var isSelectionCollapsed = isCollapsed(selection.anchorNode, selection.anchorOffset, selection.focusNode, selection.focusOffset);
23292
23293 var rangeLength = isSelectionCollapsed ? 0 : currentRange.toString().length;
23294
23295 var tempRange = currentRange.cloneRange();
23296 tempRange.selectNodeContents(node);
23297 tempRange.setEnd(currentRange.startContainer, currentRange.startOffset);
23298
23299 var isTempRangeCollapsed = isCollapsed(tempRange.startContainer, tempRange.startOffset, tempRange.endContainer, tempRange.endOffset);
23300
23301 var start = isTempRangeCollapsed ? 0 : tempRange.toString().length;
23302 var end = start + rangeLength;
23303
23304 // Detect whether the selection is backward.
23305 var detectionRange = document.createRange();
23306 detectionRange.setStart(anchorNode, anchorOffset);
23307 detectionRange.setEnd(focusNode, focusOffset);
23308 var isBackward = detectionRange.collapsed;
23309
23310 return {
23311 start: isBackward ? end : start,
23312 end: isBackward ? start : end
23313 };
23314}
23315
23316/**
23317 * @param {DOMElement|DOMTextNode} node
23318 * @param {object} offsets
23319 */
23320function setIEOffsets(node, offsets) {
23321 var range = document.selection.createRange().duplicate();
23322 var start, end;
23323
23324 if (offsets.end === undefined) {
23325 start = offsets.start;
23326 end = start;
23327 } else if (offsets.start > offsets.end) {
23328 start = offsets.end;
23329 end = offsets.start;
23330 } else {
23331 start = offsets.start;
23332 end = offsets.end;
23333 }
23334
23335 range.moveToElementText(node);
23336 range.moveStart('character', start);
23337 range.setEndPoint('EndToStart', range);
23338 range.moveEnd('character', end - start);
23339 range.select();
23340}
23341
23342/**
23343 * In modern non-IE browsers, we can support both forward and backward
23344 * selections.
23345 *
23346 * Note: IE10+ supports the Selection object, but it does not support
23347 * the `extend` method, which means that even in modern IE, it's not possible
23348 * to programmatically create a backward selection. Thus, for all IE
23349 * versions, we use the old IE API to create our selections.
23350 *
23351 * @param {DOMElement|DOMTextNode} node
23352 * @param {object} offsets
23353 */
23354function setModernOffsets(node, offsets) {
23355 if (!window.getSelection) {
23356 return;
23357 }
23358
23359 var selection = window.getSelection();
23360 var length = node[getTextContentAccessor()].length;
23361 var start = Math.min(offsets.start, length);
23362 var end = offsets.end === undefined ? start : Math.min(offsets.end, length);
23363
23364 // IE 11 uses modern selection, but doesn't support the extend method.
23365 // Flip backward selections, so we can set with a single range.
23366 if (!selection.extend && start > end) {
23367 var temp = end;
23368 end = start;
23369 start = temp;
23370 }
23371
23372 var startMarker = getNodeForCharacterOffset(node, start);
23373 var endMarker = getNodeForCharacterOffset(node, end);
23374
23375 if (startMarker && endMarker) {
23376 var range = document.createRange();
23377 range.setStart(startMarker.node, startMarker.offset);
23378 selection.removeAllRanges();
23379
23380 if (start > end) {
23381 selection.addRange(range);
23382 selection.extend(endMarker.node, endMarker.offset);
23383 } else {
23384 range.setEnd(endMarker.node, endMarker.offset);
23385 selection.addRange(range);
23386 }
23387 }
23388}
23389
23390var useIEOffsets = ExecutionEnvironment.canUseDOM && 'selection' in document && !('getSelection' in window);
23391
23392var ReactDOMSelection = {
23393 /**
23394 * @param {DOMElement} node
23395 */
23396 getOffsets: useIEOffsets ? getIEOffsets : getModernOffsets,
23397
23398 /**
23399 * @param {DOMElement|DOMTextNode} node
23400 * @param {object} offsets
23401 */
23402 setOffsets: useIEOffsets ? setIEOffsets : setModernOffsets
23403};
23404
23405module.exports = ReactDOMSelection;
23406},{"282":282,"283":283,"31":31}],211:[function(require,module,exports){
23407(function (process){
23408/**
23409 * Copyright 2013-present, Facebook, Inc.
23410 * All rights reserved.
23411 *
23412 * This source code is licensed under the BSD-style license found in the
23413 * LICENSE file in the root directory of this source tree. An additional grant
23414 * of patent rights can be found in the PATENTS file in the same directory.
23415 *
23416 * @providesModule ReactDOMTextComponent
23417 */
23418
23419'use strict';
23420
23421var _assign = require(296);
23422
23423var DOMChildrenOperations = require(165);
23424var DOMLazyTree = require(166);
23425var ReactDOMComponentTree = require(199);
23426var ReactInstrumentation = require(228);
23427
23428var escapeTextContentForBrowser = require(272);
23429var invariant = require(45);
23430var validateDOMNesting = require(295);
23431
23432/**
23433 * Text nodes violate a couple assumptions that React makes about components:
23434 *
23435 * - When mounting text into the DOM, adjacent text nodes are merged.
23436 * - Text nodes cannot be assigned a React root ID.
23437 *
23438 * This component is used to wrap strings between comment nodes so that they
23439 * can undergo the same reconciliation that is applied to elements.
23440 *
23441 * TODO: Investigate representing React components in the DOM with text nodes.
23442 *
23443 * @class ReactDOMTextComponent
23444 * @extends ReactComponent
23445 * @internal
23446 */
23447var ReactDOMTextComponent = function (text) {
23448 // TODO: This is really a ReactText (ReactNode), not a ReactElement
23449 this._currentElement = text;
23450 this._stringText = '' + text;
23451 // ReactDOMComponentTree uses these:
23452 this._nativeNode = null;
23453 this._nativeParent = null;
23454
23455 // Properties
23456 this._domID = null;
23457 this._mountIndex = 0;
23458 this._closingComment = null;
23459 this._commentNodes = null;
23460};
23461
23462_assign(ReactDOMTextComponent.prototype, {
23463
23464 /**
23465 * Creates the markup for this text node. This node is not intended to have
23466 * any features besides containing text content.
23467 *
23468 * @param {ReactReconcileTransaction|ReactServerRenderingTransaction} transaction
23469 * @return {string} Markup for this text node.
23470 * @internal
23471 */
23472 mountComponent: function (transaction, nativeParent, nativeContainerInfo, context) {
23473 if (process.env.NODE_ENV !== 'production') {
23474 ReactInstrumentation.debugTool.onSetText(this._debugID, this._stringText);
23475
23476 var parentInfo;
23477 if (nativeParent != null) {
23478 parentInfo = nativeParent._ancestorInfo;
23479 } else if (nativeContainerInfo != null) {
23480 parentInfo = nativeContainerInfo._ancestorInfo;
23481 }
23482 if (parentInfo) {
23483 // parentInfo should always be present except for the top-level
23484 // component when server rendering
23485 validateDOMNesting('#text', this, parentInfo);
23486 }
23487 }
23488
23489 var domID = nativeContainerInfo._idCounter++;
23490 var openingValue = ' react-text: ' + domID + ' ';
23491 var closingValue = ' /react-text ';
23492 this._domID = domID;
23493 this._nativeParent = nativeParent;
23494 if (transaction.useCreateElement) {
23495 var ownerDocument = nativeContainerInfo._ownerDocument;
23496 var openingComment = ownerDocument.createComment(openingValue);
23497 var closingComment = ownerDocument.createComment(closingValue);
23498 var lazyTree = DOMLazyTree(ownerDocument.createDocumentFragment());
23499 DOMLazyTree.queueChild(lazyTree, DOMLazyTree(openingComment));
23500 if (this._stringText) {
23501 DOMLazyTree.queueChild(lazyTree, DOMLazyTree(ownerDocument.createTextNode(this._stringText)));
23502 }
23503 DOMLazyTree.queueChild(lazyTree, DOMLazyTree(closingComment));
23504 ReactDOMComponentTree.precacheNode(this, openingComment);
23505 this._closingComment = closingComment;
23506 return lazyTree;
23507 } else {
23508 var escapedText = escapeTextContentForBrowser(this._stringText);
23509
23510 if (transaction.renderToStaticMarkup) {
23511 // Normally we'd wrap this between comment nodes for the reasons stated
23512 // above, but since this is a situation where React won't take over
23513 // (static pages), we can simply return the text as it is.
23514 return escapedText;
23515 }
23516
23517 return '<!--' + openingValue + '-->' + escapedText + '<!--' + closingValue + '-->';
23518 }
23519 },
23520
23521 /**
23522 * Updates this component by updating the text content.
23523 *
23524 * @param {ReactText} nextText The next text content
23525 * @param {ReactReconcileTransaction} transaction
23526 * @internal
23527 */
23528 receiveComponent: function (nextText, transaction) {
23529 if (nextText !== this._currentElement) {
23530 this._currentElement = nextText;
23531 var nextStringText = '' + nextText;
23532 if (nextStringText !== this._stringText) {
23533 // TODO: Save this as pending props and use performUpdateIfNecessary
23534 // and/or updateComponent to do the actual update for consistency with
23535 // other component types?
23536 this._stringText = nextStringText;
23537 var commentNodes = this.getNativeNode();
23538 DOMChildrenOperations.replaceDelimitedText(commentNodes[0], commentNodes[1], nextStringText);
23539
23540 if (process.env.NODE_ENV !== 'production') {
23541 ReactInstrumentation.debugTool.onSetText(this._debugID, nextStringText);
23542 }
23543 }
23544 }
23545 },
23546
23547 getNativeNode: function () {
23548 var nativeNode = this._commentNodes;
23549 if (nativeNode) {
23550 return nativeNode;
23551 }
23552 if (!this._closingComment) {
23553 var openingComment = ReactDOMComponentTree.getNodeFromInstance(this);
23554 var node = openingComment.nextSibling;
23555 while (true) {
23556 !(node != null) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Missing closing comment for text component %s', this._domID) : invariant(false) : void 0;
23557 if (node.nodeType === 8 && node.nodeValue === ' /react-text ') {
23558 this._closingComment = node;
23559 break;
23560 }
23561 node = node.nextSibling;
23562 }
23563 }
23564 nativeNode = [this._nativeNode, this._closingComment];
23565 this._commentNodes = nativeNode;
23566 return nativeNode;
23567 },
23568
23569 unmountComponent: function () {
23570 this._closingComment = null;
23571 this._commentNodes = null;
23572 ReactDOMComponentTree.uncacheNode(this);
23573 }
23574
23575});
23576
23577module.exports = ReactDOMTextComponent;
23578}).call(this,require(91))
23579},{"165":165,"166":166,"199":199,"228":228,"272":272,"295":295,"296":296,"45":45,"91":91}],212:[function(require,module,exports){
23580(function (process){
23581/**
23582 * Copyright 2013-present, Facebook, Inc.
23583 * All rights reserved.
23584 *
23585 * This source code is licensed under the BSD-style license found in the
23586 * LICENSE file in the root directory of this source tree. An additional grant
23587 * of patent rights can be found in the PATENTS file in the same directory.
23588 *
23589 * @providesModule ReactDOMTextarea
23590 */
23591
23592'use strict';
23593
23594var _assign = require(296);
23595
23596var DisabledInputUtils = require(172);
23597var DOMPropertyOperations = require(169);
23598var LinkedValueUtils = require(182);
23599var ReactDOMComponentTree = require(199);
23600var ReactUpdates = require(247);
23601
23602var invariant = require(45);
23603var warning = require(55);
23604
23605var didWarnValueLink = false;
23606var didWarnValueNull = false;
23607var didWarnValDefaultVal = false;
23608
23609function forceUpdateIfMounted() {
23610 if (this._rootNodeID) {
23611 // DOM component is still mounted; update
23612 ReactDOMTextarea.updateWrapper(this);
23613 }
23614}
23615
23616function warnIfValueIsNull(props) {
23617 if (props != null && props.value === null && !didWarnValueNull) {
23618 process.env.NODE_ENV !== 'production' ? warning(false, '`value` prop on `textarea` should not be null. ' + 'Consider using the empty string to clear the component or `undefined` ' + 'for uncontrolled components.') : void 0;
23619
23620 didWarnValueNull = true;
23621 }
23622}
23623
23624/**
23625 * Implements a <textarea> native component that allows setting `value`, and
23626 * `defaultValue`. This differs from the traditional DOM API because value is
23627 * usually set as PCDATA children.
23628 *
23629 * If `value` is not supplied (or null/undefined), user actions that affect the
23630 * value will trigger updates to the element.
23631 *
23632 * If `value` is supplied (and not null/undefined), the rendered element will
23633 * not trigger updates to the element. Instead, the `value` prop must change in
23634 * order for the rendered element to be updated.
23635 *
23636 * The rendered element will be initialized with an empty value, the prop
23637 * `defaultValue` if specified, or the children content (deprecated).
23638 */
23639var ReactDOMTextarea = {
23640 getNativeProps: function (inst, props) {
23641 !(props.dangerouslySetInnerHTML == null) ? process.env.NODE_ENV !== 'production' ? invariant(false, '`dangerouslySetInnerHTML` does not make sense on <textarea>.') : invariant(false) : void 0;
23642
23643 // Always set children to the same thing. In IE9, the selection range will
23644 // get reset if `textContent` is mutated.
23645 var nativeProps = _assign({}, DisabledInputUtils.getNativeProps(inst, props), {
23646 defaultValue: undefined,
23647 value: undefined,
23648 children: inst._wrapperState.initialValue,
23649 onChange: inst._wrapperState.onChange
23650 });
23651
23652 return nativeProps;
23653 },
23654
23655 mountWrapper: function (inst, props) {
23656 if (process.env.NODE_ENV !== 'production') {
23657 LinkedValueUtils.checkPropTypes('textarea', props, inst._currentElement._owner);
23658 if (props.valueLink !== undefined && !didWarnValueLink) {
23659 process.env.NODE_ENV !== 'production' ? warning(false, '`valueLink` prop on `textarea` is deprecated; set `value` and `onChange` instead.') : void 0;
23660 didWarnValueLink = true;
23661 }
23662 if (props.value !== undefined && props.defaultValue !== undefined && !didWarnValDefaultVal) {
23663 process.env.NODE_ENV !== 'production' ? warning(false, 'Textarea elements must be either controlled or uncontrolled ' + '(specify either the value prop, or the defaultValue prop, but not ' + 'both). Decide between using a controlled or uncontrolled textarea ' + 'and remove one of these props. More info: ' + 'https://fb.me/react-controlled-components') : void 0;
23664 didWarnValDefaultVal = true;
23665 }
23666 warnIfValueIsNull(props);
23667 }
23668
23669 var defaultValue = props.defaultValue;
23670 // TODO (yungsters): Remove support for children content in <textarea>.
23671 var children = props.children;
23672 if (children != null) {
23673 if (process.env.NODE_ENV !== 'production') {
23674 process.env.NODE_ENV !== 'production' ? warning(false, 'Use the `defaultValue` or `value` props instead of setting ' + 'children on <textarea>.') : void 0;
23675 }
23676 !(defaultValue == null) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'If you supply `defaultValue` on a <textarea>, do not pass children.') : invariant(false) : void 0;
23677 if (Array.isArray(children)) {
23678 !(children.length <= 1) ? process.env.NODE_ENV !== 'production' ? invariant(false, '<textarea> can only have at most one child.') : invariant(false) : void 0;
23679 children = children[0];
23680 }
23681
23682 defaultValue = '' + children;
23683 }
23684 if (defaultValue == null) {
23685 defaultValue = '';
23686 }
23687 var value = LinkedValueUtils.getValue(props);
23688 inst._wrapperState = {
23689 // We save the initial value so that `ReactDOMComponent` doesn't update
23690 // `textContent` (unnecessary since we update value).
23691 // The initial value can be a boolean or object so that's why it's
23692 // forced to be a string.
23693 initialValue: '' + (value != null ? value : defaultValue),
23694 listeners: null,
23695 onChange: _handleChange.bind(inst)
23696 };
23697 },
23698
23699 updateWrapper: function (inst) {
23700 var props = inst._currentElement.props;
23701
23702 if (process.env.NODE_ENV !== 'production') {
23703 warnIfValueIsNull(props);
23704 }
23705
23706 var value = LinkedValueUtils.getValue(props);
23707 if (value != null) {
23708 // Cast `value` to a string to ensure the value is set correctly. While
23709 // browsers typically do this as necessary, jsdom doesn't.
23710 DOMPropertyOperations.setValueForProperty(ReactDOMComponentTree.getNodeFromInstance(inst), 'value', '' + value);
23711 }
23712 }
23713};
23714
23715function _handleChange(event) {
23716 var props = this._currentElement.props;
23717 var returnValue = LinkedValueUtils.executeOnChange(props, event);
23718 ReactUpdates.asap(forceUpdateIfMounted, this);
23719 return returnValue;
23720}
23721
23722module.exports = ReactDOMTextarea;
23723}).call(this,require(91))
23724},{"169":169,"172":172,"182":182,"199":199,"247":247,"296":296,"45":45,"55":55,"91":91}],213:[function(require,module,exports){
23725(function (process){
23726/**
23727 * Copyright 2015-present, Facebook, Inc.
23728 * All rights reserved.
23729 *
23730 * This source code is licensed under the BSD-style license found in the
23731 * LICENSE file in the root directory of this source tree. An additional grant
23732 * of patent rights can be found in the PATENTS file in the same directory.
23733 *
23734 * @providesModule ReactDOMTreeTraversal
23735 */
23736
23737'use strict';
23738
23739var invariant = require(45);
23740
23741/**
23742 * Return the lowest common ancestor of A and B, or null if they are in
23743 * different trees.
23744 */
23745function getLowestCommonAncestor(instA, instB) {
23746 !('_nativeNode' in instA) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'getNodeFromInstance: Invalid argument.') : invariant(false) : void 0;
23747 !('_nativeNode' in instB) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'getNodeFromInstance: Invalid argument.') : invariant(false) : void 0;
23748
23749 var depthA = 0;
23750 for (var tempA = instA; tempA; tempA = tempA._nativeParent) {
23751 depthA++;
23752 }
23753 var depthB = 0;
23754 for (var tempB = instB; tempB; tempB = tempB._nativeParent) {
23755 depthB++;
23756 }
23757
23758 // If A is deeper, crawl up.
23759 while (depthA - depthB > 0) {
23760 instA = instA._nativeParent;
23761 depthA--;
23762 }
23763
23764 // If B is deeper, crawl up.
23765 while (depthB - depthA > 0) {
23766 instB = instB._nativeParent;
23767 depthB--;
23768 }
23769
23770 // Walk in lockstep until we find a match.
23771 var depth = depthA;
23772 while (depth--) {
23773 if (instA === instB) {
23774 return instA;
23775 }
23776 instA = instA._nativeParent;
23777 instB = instB._nativeParent;
23778 }
23779 return null;
23780}
23781
23782/**
23783 * Return if A is an ancestor of B.
23784 */
23785function isAncestor(instA, instB) {
23786 !('_nativeNode' in instA) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'isAncestor: Invalid argument.') : invariant(false) : void 0;
23787 !('_nativeNode' in instB) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'isAncestor: Invalid argument.') : invariant(false) : void 0;
23788
23789 while (instB) {
23790 if (instB === instA) {
23791 return true;
23792 }
23793 instB = instB._nativeParent;
23794 }
23795 return false;
23796}
23797
23798/**
23799 * Return the parent instance of the passed-in instance.
23800 */
23801function getParentInstance(inst) {
23802 !('_nativeNode' in inst) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'getParentInstance: Invalid argument.') : invariant(false) : void 0;
23803
23804 return inst._nativeParent;
23805}
23806
23807/**
23808 * Simulates the traversal of a two-phase, capture/bubble event dispatch.
23809 */
23810function traverseTwoPhase(inst, fn, arg) {
23811 var path = [];
23812 while (inst) {
23813 path.push(inst);
23814 inst = inst._nativeParent;
23815 }
23816 var i;
23817 for (i = path.length; i-- > 0;) {
23818 fn(path[i], false, arg);
23819 }
23820 for (i = 0; i < path.length; i++) {
23821 fn(path[i], true, arg);
23822 }
23823}
23824
23825/**
23826 * Traverses the ID hierarchy and invokes the supplied `cb` on any IDs that
23827 * should would receive a `mouseEnter` or `mouseLeave` event.
23828 *
23829 * Does not invoke the callback on the nearest common ancestor because nothing
23830 * "entered" or "left" that element.
23831 */
23832function traverseEnterLeave(from, to, fn, argFrom, argTo) {
23833 var common = from && to ? getLowestCommonAncestor(from, to) : null;
23834 var pathFrom = [];
23835 while (from && from !== common) {
23836 pathFrom.push(from);
23837 from = from._nativeParent;
23838 }
23839 var pathTo = [];
23840 while (to && to !== common) {
23841 pathTo.push(to);
23842 to = to._nativeParent;
23843 }
23844 var i;
23845 for (i = 0; i < pathFrom.length; i++) {
23846 fn(pathFrom[i], true, argFrom);
23847 }
23848 for (i = pathTo.length; i-- > 0;) {
23849 fn(pathTo[i], false, argTo);
23850 }
23851}
23852
23853module.exports = {
23854 isAncestor: isAncestor,
23855 getLowestCommonAncestor: getLowestCommonAncestor,
23856 getParentInstance: getParentInstance,
23857 traverseTwoPhase: traverseTwoPhase,
23858 traverseEnterLeave: traverseEnterLeave
23859};
23860}).call(this,require(91))
23861},{"45":45,"91":91}],214:[function(require,module,exports){
23862(function (process){
23863/**
23864 * Copyright 2013-present, Facebook, Inc.
23865 * All rights reserved.
23866 *
23867 * This source code is licensed under the BSD-style license found in the
23868 * LICENSE file in the root directory of this source tree. An additional grant
23869 * of patent rights can be found in the PATENTS file in the same directory.
23870 *
23871 * @providesModule ReactDOMUnknownPropertyDevtool
23872 */
23873
23874'use strict';
23875
23876var DOMProperty = require(168);
23877var EventPluginRegistry = require(176);
23878
23879var warning = require(55);
23880
23881if (process.env.NODE_ENV !== 'production') {
23882 var reactProps = {
23883 children: true,
23884 dangerouslySetInnerHTML: true,
23885 key: true,
23886 ref: true
23887 };
23888 var warnedProperties = {};
23889
23890 var warnUnknownProperty = function (name) {
23891 if (DOMProperty.properties.hasOwnProperty(name) || DOMProperty.isCustomAttribute(name)) {
23892 return;
23893 }
23894 if (reactProps.hasOwnProperty(name) && reactProps[name] || warnedProperties.hasOwnProperty(name) && warnedProperties[name]) {
23895 return;
23896 }
23897
23898 warnedProperties[name] = true;
23899 var lowerCasedName = name.toLowerCase();
23900
23901 // data-* attributes should be lowercase; suggest the lowercase version
23902 var standardName = DOMProperty.isCustomAttribute(lowerCasedName) ? lowerCasedName : DOMProperty.getPossibleStandardName.hasOwnProperty(lowerCasedName) ? DOMProperty.getPossibleStandardName[lowerCasedName] : null;
23903
23904 // For now, only warn when we have a suggested correction. This prevents
23905 // logging too much when using transferPropsTo.
23906 process.env.NODE_ENV !== 'production' ? warning(standardName == null, 'Unknown DOM property %s. Did you mean %s?', name, standardName) : void 0;
23907
23908 var registrationName = EventPluginRegistry.possibleRegistrationNames.hasOwnProperty(lowerCasedName) ? EventPluginRegistry.possibleRegistrationNames[lowerCasedName] : null;
23909
23910 process.env.NODE_ENV !== 'production' ? warning(registrationName == null, 'Unknown event handler property %s. Did you mean `%s`?', name, registrationName) : void 0;
23911 };
23912}
23913
23914var ReactDOMUnknownPropertyDevtool = {
23915 onCreateMarkupForProperty: function (name, value) {
23916 warnUnknownProperty(name);
23917 },
23918 onSetValueForProperty: function (node, name, value) {
23919 warnUnknownProperty(name);
23920 },
23921 onDeleteValueForProperty: function (node, name) {
23922 warnUnknownProperty(name);
23923 }
23924};
23925
23926module.exports = ReactDOMUnknownPropertyDevtool;
23927}).call(this,require(91))
23928},{"168":168,"176":176,"55":55,"91":91}],215:[function(require,module,exports){
23929(function (process){
23930/**
23931 * Copyright 2016-present, Facebook, Inc.
23932 * All rights reserved.
23933 *
23934 * This source code is licensed under the BSD-style license found in the
23935 * LICENSE file in the root directory of this source tree. An additional grant
23936 * of patent rights can be found in the PATENTS file in the same directory.
23937 *
23938 * @providesModule ReactDebugTool
23939 */
23940
23941'use strict';
23942
23943var ExecutionEnvironment = require(31);
23944
23945var performanceNow = require(53);
23946var warning = require(55);
23947
23948var eventHandlers = [];
23949var handlerDoesThrowForEvent = {};
23950
23951function emitEvent(handlerFunctionName, arg1, arg2, arg3, arg4, arg5) {
23952 if (process.env.NODE_ENV !== 'production') {
23953 eventHandlers.forEach(function (handler) {
23954 try {
23955 if (handler[handlerFunctionName]) {
23956 handler[handlerFunctionName](arg1, arg2, arg3, arg4, arg5);
23957 }
23958 } catch (e) {
23959 process.env.NODE_ENV !== 'production' ? warning(!handlerDoesThrowForEvent[handlerFunctionName], 'exception thrown by devtool while handling %s: %s', handlerFunctionName, e.message) : void 0;
23960 handlerDoesThrowForEvent[handlerFunctionName] = true;
23961 }
23962 });
23963 }
23964}
23965
23966var isProfiling = false;
23967var flushHistory = [];
23968var currentFlushNesting = 0;
23969var currentFlushMeasurements = null;
23970var currentFlushStartTime = null;
23971var currentTimerDebugID = null;
23972var currentTimerStartTime = null;
23973var currentTimerType = null;
23974
23975function clearHistory() {
23976 ReactComponentTreeDevtool.purgeUnmountedComponents();
23977 ReactNativeOperationHistoryDevtool.clearHistory();
23978}
23979
23980function getTreeSnapshot(registeredIDs) {
23981 return registeredIDs.reduce(function (tree, id) {
23982 var ownerID = ReactComponentTreeDevtool.getOwnerID(id);
23983 var parentID = ReactComponentTreeDevtool.getParentID(id);
23984 tree[id] = {
23985 displayName: ReactComponentTreeDevtool.getDisplayName(id),
23986 text: ReactComponentTreeDevtool.getText(id),
23987 updateCount: ReactComponentTreeDevtool.getUpdateCount(id),
23988 childIDs: ReactComponentTreeDevtool.getChildIDs(id),
23989 // Text nodes don't have owners but this is close enough.
23990 ownerID: ownerID || ReactComponentTreeDevtool.getOwnerID(parentID),
23991 parentID: parentID
23992 };
23993 return tree;
23994 }, {});
23995}
23996
23997function resetMeasurements() {
23998 if (process.env.NODE_ENV !== 'production') {
23999 var previousStartTime = currentFlushStartTime;
24000 var previousMeasurements = currentFlushMeasurements || [];
24001 var previousOperations = ReactNativeOperationHistoryDevtool.getHistory();
24002
24003 if (!isProfiling || currentFlushNesting === 0) {
24004 currentFlushStartTime = null;
24005 currentFlushMeasurements = null;
24006 clearHistory();
24007 return;
24008 }
24009
24010 if (previousMeasurements.length || previousOperations.length) {
24011 var registeredIDs = ReactComponentTreeDevtool.getRegisteredIDs();
24012 flushHistory.push({
24013 duration: performanceNow() - previousStartTime,
24014 measurements: previousMeasurements || [],
24015 operations: previousOperations || [],
24016 treeSnapshot: getTreeSnapshot(registeredIDs)
24017 });
24018 }
24019
24020 clearHistory();
24021 currentFlushStartTime = performanceNow();
24022 currentFlushMeasurements = [];
24023 }
24024}
24025
24026function checkDebugID(debugID) {
24027 process.env.NODE_ENV !== 'production' ? warning(debugID, 'ReactDebugTool: debugID may not be empty.') : void 0;
24028}
24029
24030var ReactDebugTool = {
24031 addDevtool: function (devtool) {
24032 eventHandlers.push(devtool);
24033 },
24034 removeDevtool: function (devtool) {
24035 for (var i = 0; i < eventHandlers.length; i++) {
24036 if (eventHandlers[i] === devtool) {
24037 eventHandlers.splice(i, 1);
24038 i--;
24039 }
24040 }
24041 },
24042 beginProfiling: function () {
24043 if (process.env.NODE_ENV !== 'production') {
24044 if (isProfiling) {
24045 return;
24046 }
24047
24048 isProfiling = true;
24049 flushHistory.length = 0;
24050 resetMeasurements();
24051 }
24052 },
24053 endProfiling: function () {
24054 if (process.env.NODE_ENV !== 'production') {
24055 if (!isProfiling) {
24056 return;
24057 }
24058
24059 isProfiling = false;
24060 resetMeasurements();
24061 }
24062 },
24063 getFlushHistory: function () {
24064 if (process.env.NODE_ENV !== 'production') {
24065 return flushHistory;
24066 }
24067 },
24068 onBeginFlush: function () {
24069 if (process.env.NODE_ENV !== 'production') {
24070 currentFlushNesting++;
24071 resetMeasurements();
24072 }
24073 emitEvent('onBeginFlush');
24074 },
24075 onEndFlush: function () {
24076 if (process.env.NODE_ENV !== 'production') {
24077 resetMeasurements();
24078 currentFlushNesting--;
24079 }
24080 emitEvent('onEndFlush');
24081 },
24082 onBeginLifeCycleTimer: function (debugID, timerType) {
24083 checkDebugID(debugID);
24084 emitEvent('onBeginLifeCycleTimer', debugID, timerType);
24085 if (process.env.NODE_ENV !== 'production') {
24086 if (isProfiling && currentFlushNesting > 0) {
24087 process.env.NODE_ENV !== 'production' ? warning(!currentTimerType, 'There is an internal error in the React performance measurement code. ' + 'Did not expect %s timer to start while %s timer is still in ' + 'progress for %s instance.', timerType, currentTimerType || 'no', debugID === currentTimerDebugID ? 'the same' : 'another') : void 0;
24088 currentTimerStartTime = performanceNow();
24089 currentTimerDebugID = debugID;
24090 currentTimerType = timerType;
24091 }
24092 }
24093 },
24094 onEndLifeCycleTimer: function (debugID, timerType) {
24095 checkDebugID(debugID);
24096 if (process.env.NODE_ENV !== 'production') {
24097 if (isProfiling && currentFlushNesting > 0) {
24098 process.env.NODE_ENV !== 'production' ? warning(currentTimerType === timerType, 'There is an internal error in the React performance measurement code. ' + 'We did not expect %s timer to stop while %s timer is still in ' + 'progress for %s instance. Please report this as a bug in React.', timerType, currentTimerType || 'no', debugID === currentTimerDebugID ? 'the same' : 'another') : void 0;
24099 currentFlushMeasurements.push({
24100 timerType: timerType,
24101 instanceID: debugID,
24102 duration: performanceNow() - currentTimerStartTime
24103 });
24104 currentTimerStartTime = null;
24105 currentTimerDebugID = null;
24106 currentTimerType = null;
24107 }
24108 }
24109 emitEvent('onEndLifeCycleTimer', debugID, timerType);
24110 },
24111 onBeginReconcilerTimer: function (debugID, timerType) {
24112 checkDebugID(debugID);
24113 emitEvent('onBeginReconcilerTimer', debugID, timerType);
24114 },
24115 onEndReconcilerTimer: function (debugID, timerType) {
24116 checkDebugID(debugID);
24117 emitEvent('onEndReconcilerTimer', debugID, timerType);
24118 },
24119 onBeginProcessingChildContext: function () {
24120 emitEvent('onBeginProcessingChildContext');
24121 },
24122 onEndProcessingChildContext: function () {
24123 emitEvent('onEndProcessingChildContext');
24124 },
24125 onNativeOperation: function (debugID, type, payload) {
24126 checkDebugID(debugID);
24127 emitEvent('onNativeOperation', debugID, type, payload);
24128 },
24129 onSetState: function () {
24130 emitEvent('onSetState');
24131 },
24132 onSetDisplayName: function (debugID, displayName) {
24133 checkDebugID(debugID);
24134 emitEvent('onSetDisplayName', debugID, displayName);
24135 },
24136 onSetChildren: function (debugID, childDebugIDs) {
24137 checkDebugID(debugID);
24138 emitEvent('onSetChildren', debugID, childDebugIDs);
24139 },
24140 onSetOwner: function (debugID, ownerDebugID) {
24141 checkDebugID(debugID);
24142 emitEvent('onSetOwner', debugID, ownerDebugID);
24143 },
24144 onSetText: function (debugID, text) {
24145 checkDebugID(debugID);
24146 emitEvent('onSetText', debugID, text);
24147 },
24148 onMountRootComponent: function (debugID) {
24149 checkDebugID(debugID);
24150 emitEvent('onMountRootComponent', debugID);
24151 },
24152 onMountComponent: function (debugID) {
24153 checkDebugID(debugID);
24154 emitEvent('onMountComponent', debugID);
24155 },
24156 onUpdateComponent: function (debugID) {
24157 checkDebugID(debugID);
24158 emitEvent('onUpdateComponent', debugID);
24159 },
24160 onUnmountComponent: function (debugID) {
24161 checkDebugID(debugID);
24162 emitEvent('onUnmountComponent', debugID);
24163 }
24164};
24165
24166if (process.env.NODE_ENV !== 'production') {
24167 var ReactInvalidSetStateWarningDevTool = require(229);
24168 var ReactNativeOperationHistoryDevtool = require(235);
24169 var ReactComponentTreeDevtool = require(192);
24170 ReactDebugTool.addDevtool(ReactInvalidSetStateWarningDevTool);
24171 ReactDebugTool.addDevtool(ReactComponentTreeDevtool);
24172 ReactDebugTool.addDevtool(ReactNativeOperationHistoryDevtool);
24173 var url = ExecutionEnvironment.canUseDOM && window.location.href || '';
24174 if (/[?&]react_perf\b/.test(url)) {
24175 ReactDebugTool.beginProfiling();
24176 }
24177}
24178
24179module.exports = ReactDebugTool;
24180}).call(this,require(91))
24181},{"192":192,"229":229,"235":235,"31":31,"53":53,"55":55,"91":91}],216:[function(require,module,exports){
24182/**
24183 * Copyright 2013-present, Facebook, Inc.
24184 * All rights reserved.
24185 *
24186 * This source code is licensed under the BSD-style license found in the
24187 * LICENSE file in the root directory of this source tree. An additional grant
24188 * of patent rights can be found in the PATENTS file in the same directory.
24189 *
24190 * @providesModule ReactDefaultBatchingStrategy
24191 */
24192
24193'use strict';
24194
24195var _assign = require(296);
24196
24197var ReactUpdates = require(247);
24198var Transaction = require(265);
24199
24200var emptyFunction = require(37);
24201
24202var RESET_BATCHED_UPDATES = {
24203 initialize: emptyFunction,
24204 close: function () {
24205 ReactDefaultBatchingStrategy.isBatchingUpdates = false;
24206 }
24207};
24208
24209var FLUSH_BATCHED_UPDATES = {
24210 initialize: emptyFunction,
24211 close: ReactUpdates.flushBatchedUpdates.bind(ReactUpdates)
24212};
24213
24214var TRANSACTION_WRAPPERS = [FLUSH_BATCHED_UPDATES, RESET_BATCHED_UPDATES];
24215
24216function ReactDefaultBatchingStrategyTransaction() {
24217 this.reinitializeTransaction();
24218}
24219
24220_assign(ReactDefaultBatchingStrategyTransaction.prototype, Transaction.Mixin, {
24221 getTransactionWrappers: function () {
24222 return TRANSACTION_WRAPPERS;
24223 }
24224});
24225
24226var transaction = new ReactDefaultBatchingStrategyTransaction();
24227
24228var ReactDefaultBatchingStrategy = {
24229 isBatchingUpdates: false,
24230
24231 /**
24232 * Call the provided function in a context within which calls to `setState`
24233 * and friends are batched such that components aren't updated unnecessarily.
24234 */
24235 batchedUpdates: function (callback, a, b, c, d, e) {
24236 var alreadyBatchingUpdates = ReactDefaultBatchingStrategy.isBatchingUpdates;
24237
24238 ReactDefaultBatchingStrategy.isBatchingUpdates = true;
24239
24240 // The code is written this way to avoid extra allocations
24241 if (alreadyBatchingUpdates) {
24242 callback(a, b, c, d, e);
24243 } else {
24244 transaction.perform(callback, null, a, b, c, d, e);
24245 }
24246 }
24247};
24248
24249module.exports = ReactDefaultBatchingStrategy;
24250},{"247":247,"265":265,"296":296,"37":37}],217:[function(require,module,exports){
24251/**
24252 * Copyright 2013-present, Facebook, Inc.
24253 * All rights reserved.
24254 *
24255 * This source code is licensed under the BSD-style license found in the
24256 * LICENSE file in the root directory of this source tree. An additional grant
24257 * of patent rights can be found in the PATENTS file in the same directory.
24258 *
24259 * @providesModule ReactDefaultInjection
24260 */
24261
24262'use strict';
24263
24264var BeforeInputEventPlugin = require(160);
24265var ChangeEventPlugin = require(164);
24266var DefaultEventPluginOrder = require(171);
24267var EnterLeaveEventPlugin = require(173);
24268var HTMLDOMPropertyConfig = require(180);
24269var ReactComponentBrowserEnvironment = require(190);
24270var ReactDOMComponent = require(197);
24271var ReactDOMComponentTree = require(199);
24272var ReactDOMEmptyComponent = require(202);
24273var ReactDOMTreeTraversal = require(213);
24274var ReactDOMTextComponent = require(211);
24275var ReactDefaultBatchingStrategy = require(216);
24276var ReactEventListener = require(223);
24277var ReactInjection = require(225);
24278var ReactReconcileTransaction = require(242);
24279var SVGDOMPropertyConfig = require(249);
24280var SelectEventPlugin = require(250);
24281var SimpleEventPlugin = require(251);
24282
24283var alreadyInjected = false;
24284
24285function inject() {
24286 if (alreadyInjected) {
24287 // TODO: This is currently true because these injections are shared between
24288 // the client and the server package. They should be built independently
24289 // and not share any injection state. Then this problem will be solved.
24290 return;
24291 }
24292 alreadyInjected = true;
24293
24294 ReactInjection.EventEmitter.injectReactEventListener(ReactEventListener);
24295
24296 /**
24297 * Inject modules for resolving DOM hierarchy and plugin ordering.
24298 */
24299 ReactInjection.EventPluginHub.injectEventPluginOrder(DefaultEventPluginOrder);
24300 ReactInjection.EventPluginUtils.injectComponentTree(ReactDOMComponentTree);
24301 ReactInjection.EventPluginUtils.injectTreeTraversal(ReactDOMTreeTraversal);
24302
24303 /**
24304 * Some important event plugins included by default (without having to require
24305 * them).
24306 */
24307 ReactInjection.EventPluginHub.injectEventPluginsByName({
24308 SimpleEventPlugin: SimpleEventPlugin,
24309 EnterLeaveEventPlugin: EnterLeaveEventPlugin,
24310 ChangeEventPlugin: ChangeEventPlugin,
24311 SelectEventPlugin: SelectEventPlugin,
24312 BeforeInputEventPlugin: BeforeInputEventPlugin
24313 });
24314
24315 ReactInjection.NativeComponent.injectGenericComponentClass(ReactDOMComponent);
24316
24317 ReactInjection.NativeComponent.injectTextComponentClass(ReactDOMTextComponent);
24318
24319 ReactInjection.DOMProperty.injectDOMPropertyConfig(HTMLDOMPropertyConfig);
24320 ReactInjection.DOMProperty.injectDOMPropertyConfig(SVGDOMPropertyConfig);
24321
24322 ReactInjection.EmptyComponent.injectEmptyComponentFactory(function (instantiate) {
24323 return new ReactDOMEmptyComponent(instantiate);
24324 });
24325
24326 ReactInjection.Updates.injectReconcileTransaction(ReactReconcileTransaction);
24327 ReactInjection.Updates.injectBatchingStrategy(ReactDefaultBatchingStrategy);
24328
24329 ReactInjection.Component.injectEnvironment(ReactComponentBrowserEnvironment);
24330}
24331
24332module.exports = {
24333 inject: inject
24334};
24335},{"160":160,"164":164,"171":171,"173":173,"180":180,"190":190,"197":197,"199":199,"202":202,"211":211,"213":213,"216":216,"223":223,"225":225,"242":242,"249":249,"250":250,"251":251}],218:[function(require,module,exports){
24336(function (process){
24337/**
24338 * Copyright 2014-present, Facebook, Inc.
24339 * All rights reserved.
24340 *
24341 * This source code is licensed under the BSD-style license found in the
24342 * LICENSE file in the root directory of this source tree. An additional grant
24343 * of patent rights can be found in the PATENTS file in the same directory.
24344 *
24345 * @providesModule ReactElement
24346 */
24347
24348'use strict';
24349
24350var _assign = require(296);
24351
24352var ReactCurrentOwner = require(194);
24353
24354var warning = require(55);
24355var canDefineProperty = require(269);
24356
24357// The Symbol used to tag the ReactElement type. If there is no native Symbol
24358// nor polyfill, then a plain number is used for performance.
24359var REACT_ELEMENT_TYPE = typeof Symbol === 'function' && Symbol['for'] && Symbol['for']('react.element') || 0xeac7;
24360
24361var RESERVED_PROPS = {
24362 key: true,
24363 ref: true,
24364 __self: true,
24365 __source: true
24366};
24367
24368var specialPropKeyWarningShown, specialPropRefWarningShown;
24369
24370/**
24371 * Factory method to create a new React element. This no longer adheres to
24372 * the class pattern, so do not use new to call it. Also, no instanceof check
24373 * will work. Instead test $$typeof field against Symbol.for('react.element') to check
24374 * if something is a React Element.
24375 *
24376 * @param {*} type
24377 * @param {*} key
24378 * @param {string|object} ref
24379 * @param {*} self A *temporary* helper to detect places where `this` is
24380 * different from the `owner` when React.createElement is called, so that we
24381 * can warn. We want to get rid of owner and replace string `ref`s with arrow
24382 * functions, and as long as `this` and owner are the same, there will be no
24383 * change in behavior.
24384 * @param {*} source An annotation object (added by a transpiler or otherwise)
24385 * indicating filename, line number, and/or other information.
24386 * @param {*} owner
24387 * @param {*} props
24388 * @internal
24389 */
24390var ReactElement = function (type, key, ref, self, source, owner, props) {
24391 var element = {
24392 // This tag allow us to uniquely identify this as a React Element
24393 $$typeof: REACT_ELEMENT_TYPE,
24394
24395 // Built-in properties that belong on the element
24396 type: type,
24397 key: key,
24398 ref: ref,
24399 props: props,
24400
24401 // Record the component responsible for creating this element.
24402 _owner: owner
24403 };
24404
24405 if (process.env.NODE_ENV !== 'production') {
24406 // The validation flag is currently mutative. We put it on
24407 // an external backing store so that we can freeze the whole object.
24408 // This can be replaced with a WeakMap once they are implemented in
24409 // commonly used development environments.
24410 element._store = {};
24411
24412 // To make comparing ReactElements easier for testing purposes, we make
24413 // the validation flag non-enumerable (where possible, which should
24414 // include every environment we run tests in), so the test framework
24415 // ignores it.
24416 if (canDefineProperty) {
24417 Object.defineProperty(element._store, 'validated', {
24418 configurable: false,
24419 enumerable: false,
24420 writable: true,
24421 value: false
24422 });
24423 // self and source are DEV only properties.
24424 Object.defineProperty(element, '_self', {
24425 configurable: false,
24426 enumerable: false,
24427 writable: false,
24428 value: self
24429 });
24430 // Two elements created in two different places should be considered
24431 // equal for testing purposes and therefore we hide it from enumeration.
24432 Object.defineProperty(element, '_source', {
24433 configurable: false,
24434 enumerable: false,
24435 writable: false,
24436 value: source
24437 });
24438 } else {
24439 element._store.validated = false;
24440 element._self = self;
24441 element._source = source;
24442 }
24443 if (Object.freeze) {
24444 Object.freeze(element.props);
24445 Object.freeze(element);
24446 }
24447 }
24448
24449 return element;
24450};
24451
24452/**
24453 * Create and return a new ReactElement of the given type.
24454 * See https://facebook.github.io/react/docs/top-level-api.html#react.createelement
24455 */
24456ReactElement.createElement = function (type, config, children) {
24457 var propName;
24458
24459 // Reserved names are extracted
24460 var props = {};
24461
24462 var key = null;
24463 var ref = null;
24464 var self = null;
24465 var source = null;
24466
24467 if (config != null) {
24468 if (process.env.NODE_ENV !== 'production') {
24469 process.env.NODE_ENV !== 'production' ? warning(
24470 /* eslint-disable no-proto */
24471 config.__proto__ == null || config.__proto__ === Object.prototype,
24472 /* eslint-enable no-proto */
24473 'React.createElement(...): Expected props argument to be a plain object. ' + 'Properties defined in its prototype chain will be ignored.') : void 0;
24474 ref = !config.hasOwnProperty('ref') || Object.getOwnPropertyDescriptor(config, 'ref').get ? null : config.ref;
24475 key = !config.hasOwnProperty('key') || Object.getOwnPropertyDescriptor(config, 'key').get ? null : '' + config.key;
24476 } else {
24477 ref = config.ref === undefined ? null : config.ref;
24478 key = config.key === undefined ? null : '' + config.key;
24479 }
24480 self = config.__self === undefined ? null : config.__self;
24481 source = config.__source === undefined ? null : config.__source;
24482 // Remaining properties are added to a new props object
24483 for (propName in config) {
24484 if (config.hasOwnProperty(propName) && !RESERVED_PROPS.hasOwnProperty(propName)) {
24485 props[propName] = config[propName];
24486 }
24487 }
24488 }
24489
24490 // Children can be more than one argument, and those are transferred onto
24491 // the newly allocated props object.
24492 var childrenLength = arguments.length - 2;
24493 if (childrenLength === 1) {
24494 props.children = children;
24495 } else if (childrenLength > 1) {
24496 var childArray = Array(childrenLength);
24497 for (var i = 0; i < childrenLength; i++) {
24498 childArray[i] = arguments[i + 2];
24499 }
24500 props.children = childArray;
24501 }
24502
24503 // Resolve default props
24504 if (type && type.defaultProps) {
24505 var defaultProps = type.defaultProps;
24506 for (propName in defaultProps) {
24507 if (props[propName] === undefined) {
24508 props[propName] = defaultProps[propName];
24509 }
24510 }
24511 }
24512 if (process.env.NODE_ENV !== 'production') {
24513 // Create dummy `key` and `ref` property to `props` to warn users
24514 // against its use
24515 if (typeof props.$$typeof === 'undefined' || props.$$typeof !== REACT_ELEMENT_TYPE) {
24516 if (!props.hasOwnProperty('key')) {
24517 Object.defineProperty(props, 'key', {
24518 get: function () {
24519 if (!specialPropKeyWarningShown) {
24520 specialPropKeyWarningShown = true;
24521 process.env.NODE_ENV !== 'production' ? warning(false, '%s: `key` is not a prop. Trying to access it will result ' + 'in `undefined` being returned. If you need to access the same ' + 'value within the child component, you should pass it as a different ' + 'prop. (https://fb.me/react-special-props)', typeof type === 'function' && 'displayName' in type ? type.displayName : 'Element') : void 0;
24522 }
24523 return undefined;
24524 },
24525 configurable: true
24526 });
24527 }
24528 if (!props.hasOwnProperty('ref')) {
24529 Object.defineProperty(props, 'ref', {
24530 get: function () {
24531 if (!specialPropRefWarningShown) {
24532 specialPropRefWarningShown = true;
24533 process.env.NODE_ENV !== 'production' ? warning(false, '%s: `ref` is not a prop. Trying to access it will result ' + 'in `undefined` being returned. If you need to access the same ' + 'value within the child component, you should pass it as a different ' + 'prop. (https://fb.me/react-special-props)', typeof type === 'function' && 'displayName' in type ? type.displayName : 'Element') : void 0;
24534 }
24535 return undefined;
24536 },
24537 configurable: true
24538 });
24539 }
24540 }
24541 }
24542 return ReactElement(type, key, ref, self, source, ReactCurrentOwner.current, props);
24543};
24544
24545/**
24546 * Return a function that produces ReactElements of a given type.
24547 * See https://facebook.github.io/react/docs/top-level-api.html#react.createfactory
24548 */
24549ReactElement.createFactory = function (type) {
24550 var factory = ReactElement.createElement.bind(null, type);
24551 // Expose the type on the factory and the prototype so that it can be
24552 // easily accessed on elements. E.g. `<Foo />.type === Foo`.
24553 // This should not be named `constructor` since this may not be the function
24554 // that created the element, and it may not even be a constructor.
24555 // Legacy hook TODO: Warn if this is accessed
24556 factory.type = type;
24557 return factory;
24558};
24559
24560ReactElement.cloneAndReplaceKey = function (oldElement, newKey) {
24561 var newElement = ReactElement(oldElement.type, newKey, oldElement.ref, oldElement._self, oldElement._source, oldElement._owner, oldElement.props);
24562
24563 return newElement;
24564};
24565
24566/**
24567 * Clone and return a new ReactElement using element as the starting point.
24568 * See https://facebook.github.io/react/docs/top-level-api.html#react.cloneelement
24569 */
24570ReactElement.cloneElement = function (element, config, children) {
24571 var propName;
24572
24573 // Original props are copied
24574 var props = _assign({}, element.props);
24575
24576 // Reserved names are extracted
24577 var key = element.key;
24578 var ref = element.ref;
24579 // Self is preserved since the owner is preserved.
24580 var self = element._self;
24581 // Source is preserved since cloneElement is unlikely to be targeted by a
24582 // transpiler, and the original source is probably a better indicator of the
24583 // true owner.
24584 var source = element._source;
24585
24586 // Owner will be preserved, unless ref is overridden
24587 var owner = element._owner;
24588
24589 if (config != null) {
24590 if (process.env.NODE_ENV !== 'production') {
24591 process.env.NODE_ENV !== 'production' ? warning(
24592 /* eslint-disable no-proto */
24593 config.__proto__ == null || config.__proto__ === Object.prototype,
24594 /* eslint-enable no-proto */
24595 'React.cloneElement(...): Expected props argument to be a plain object. ' + 'Properties defined in its prototype chain will be ignored.') : void 0;
24596 }
24597 if (config.ref !== undefined) {
24598 // Silently steal the ref from the parent.
24599 ref = config.ref;
24600 owner = ReactCurrentOwner.current;
24601 }
24602 if (config.key !== undefined) {
24603 key = '' + config.key;
24604 }
24605 // Remaining properties override existing props
24606 var defaultProps;
24607 if (element.type && element.type.defaultProps) {
24608 defaultProps = element.type.defaultProps;
24609 }
24610 for (propName in config) {
24611 if (config.hasOwnProperty(propName) && !RESERVED_PROPS.hasOwnProperty(propName)) {
24612 if (config[propName] === undefined && defaultProps !== undefined) {
24613 // Resolve default props
24614 props[propName] = defaultProps[propName];
24615 } else {
24616 props[propName] = config[propName];
24617 }
24618 }
24619 }
24620 }
24621
24622 // Children can be more than one argument, and those are transferred onto
24623 // the newly allocated props object.
24624 var childrenLength = arguments.length - 2;
24625 if (childrenLength === 1) {
24626 props.children = children;
24627 } else if (childrenLength > 1) {
24628 var childArray = Array(childrenLength);
24629 for (var i = 0; i < childrenLength; i++) {
24630 childArray[i] = arguments[i + 2];
24631 }
24632 props.children = childArray;
24633 }
24634
24635 return ReactElement(element.type, key, ref, self, source, owner, props);
24636};
24637
24638/**
24639 * Verifies the object is a ReactElement.
24640 * See https://facebook.github.io/react/docs/top-level-api.html#react.isvalidelement
24641 * @param {?object} object
24642 * @return {boolean} True if `object` is a valid component.
24643 * @final
24644 */
24645ReactElement.isValidElement = function (object) {
24646 return typeof object === 'object' && object !== null && object.$$typeof === REACT_ELEMENT_TYPE;
24647};
24648
24649module.exports = ReactElement;
24650}).call(this,require(91))
24651},{"194":194,"269":269,"296":296,"55":55,"91":91}],219:[function(require,module,exports){
24652(function (process){
24653/**
24654 * Copyright 2014-present, Facebook, Inc.
24655 * All rights reserved.
24656 *
24657 * This source code is licensed under the BSD-style license found in the
24658 * LICENSE file in the root directory of this source tree. An additional grant
24659 * of patent rights can be found in the PATENTS file in the same directory.
24660 *
24661 * @providesModule ReactElementValidator
24662 */
24663
24664/**
24665 * ReactElementValidator provides a wrapper around a element factory
24666 * which validates the props passed to the element. This is intended to be
24667 * used only in DEV and could be replaced by a static type checker for languages
24668 * that support it.
24669 */
24670
24671'use strict';
24672
24673var ReactElement = require(218);
24674var ReactPropTypeLocations = require(240);
24675var ReactPropTypeLocationNames = require(239);
24676var ReactCurrentOwner = require(194);
24677
24678var canDefineProperty = require(269);
24679var getIteratorFn = require(280);
24680var invariant = require(45);
24681var warning = require(55);
24682
24683function getDeclarationErrorAddendum() {
24684 if (ReactCurrentOwner.current) {
24685 var name = ReactCurrentOwner.current.getName();
24686 if (name) {
24687 return ' Check the render method of `' + name + '`.';
24688 }
24689 }
24690 return '';
24691}
24692
24693/**
24694 * Warn if there's no key explicitly set on dynamic arrays of children or
24695 * object keys are not valid. This allows us to keep track of children between
24696 * updates.
24697 */
24698var ownerHasKeyUseWarning = {};
24699
24700var loggedTypeFailures = {};
24701
24702/**
24703 * Warn if the element doesn't have an explicit key assigned to it.
24704 * This element is in an array. The array could grow and shrink or be
24705 * reordered. All children that haven't already been validated are required to
24706 * have a "key" property assigned to it.
24707 *
24708 * @internal
24709 * @param {ReactElement} element Element that requires a key.
24710 * @param {*} parentType element's parent's type.
24711 */
24712function validateExplicitKey(element, parentType) {
24713 if (!element._store || element._store.validated || element.key != null) {
24714 return;
24715 }
24716 element._store.validated = true;
24717
24718 var addenda = getAddendaForKeyUse('uniqueKey', element, parentType);
24719 if (addenda === null) {
24720 // we already showed the warning
24721 return;
24722 }
24723 process.env.NODE_ENV !== 'production' ? warning(false, 'Each child in an array or iterator should have a unique "key" prop.' + '%s%s%s', addenda.parentOrOwner || '', addenda.childOwner || '', addenda.url || '') : void 0;
24724}
24725
24726/**
24727 * Shared warning and monitoring code for the key warnings.
24728 *
24729 * @internal
24730 * @param {string} messageType A key used for de-duping warnings.
24731 * @param {ReactElement} element Component that requires a key.
24732 * @param {*} parentType element's parent's type.
24733 * @returns {?object} A set of addenda to use in the warning message, or null
24734 * if the warning has already been shown before (and shouldn't be shown again).
24735 */
24736function getAddendaForKeyUse(messageType, element, parentType) {
24737 var addendum = getDeclarationErrorAddendum();
24738 if (!addendum) {
24739 var parentName = typeof parentType === 'string' ? parentType : parentType.displayName || parentType.name;
24740 if (parentName) {
24741 addendum = ' Check the top-level render call using <' + parentName + '>.';
24742 }
24743 }
24744
24745 var memoizer = ownerHasKeyUseWarning[messageType] || (ownerHasKeyUseWarning[messageType] = {});
24746 if (memoizer[addendum]) {
24747 return null;
24748 }
24749 memoizer[addendum] = true;
24750
24751 var addenda = {
24752 parentOrOwner: addendum,
24753 url: ' See https://fb.me/react-warning-keys for more information.',
24754 childOwner: null
24755 };
24756
24757 // Usually the current owner is the offender, but if it accepts children as a
24758 // property, it may be the creator of the child that's responsible for
24759 // assigning it a key.
24760 if (element && element._owner && element._owner !== ReactCurrentOwner.current) {
24761 // Give the component that originally created this child.
24762 addenda.childOwner = ' It was passed a child from ' + element._owner.getName() + '.';
24763 }
24764
24765 return addenda;
24766}
24767
24768/**
24769 * Ensure that every element either is passed in a static location, in an
24770 * array with an explicit keys property defined, or in an object literal
24771 * with valid key property.
24772 *
24773 * @internal
24774 * @param {ReactNode} node Statically passed child of any type.
24775 * @param {*} parentType node's parent's type.
24776 */
24777function validateChildKeys(node, parentType) {
24778 if (typeof node !== 'object') {
24779 return;
24780 }
24781 if (Array.isArray(node)) {
24782 for (var i = 0; i < node.length; i++) {
24783 var child = node[i];
24784 if (ReactElement.isValidElement(child)) {
24785 validateExplicitKey(child, parentType);
24786 }
24787 }
24788 } else if (ReactElement.isValidElement(node)) {
24789 // This element was passed in a valid location.
24790 if (node._store) {
24791 node._store.validated = true;
24792 }
24793 } else if (node) {
24794 var iteratorFn = getIteratorFn(node);
24795 // Entry iterators provide implicit keys.
24796 if (iteratorFn) {
24797 if (iteratorFn !== node.entries) {
24798 var iterator = iteratorFn.call(node);
24799 var step;
24800 while (!(step = iterator.next()).done) {
24801 if (ReactElement.isValidElement(step.value)) {
24802 validateExplicitKey(step.value, parentType);
24803 }
24804 }
24805 }
24806 }
24807 }
24808}
24809
24810/**
24811 * Assert that the props are valid
24812 *
24813 * @param {string} componentName Name of the component for error messages.
24814 * @param {object} propTypes Map of prop name to a ReactPropType
24815 * @param {object} props
24816 * @param {string} location e.g. "prop", "context", "child context"
24817 * @private
24818 */
24819function checkPropTypes(componentName, propTypes, props, location) {
24820 for (var propName in propTypes) {
24821 if (propTypes.hasOwnProperty(propName)) {
24822 var error;
24823 // Prop type validation may throw. In case they do, we don't want to
24824 // fail the render phase where it didn't fail before. So we log it.
24825 // After these have been cleaned up, we'll let them throw.
24826 try {
24827 // This is intentionally an invariant that gets caught. It's the same
24828 // behavior as without this statement except with a better message.
24829 !(typeof propTypes[propName] === 'function') ? process.env.NODE_ENV !== 'production' ? invariant(false, '%s: %s type `%s` is invalid; it must be a function, usually from ' + 'React.PropTypes.', componentName || 'React class', ReactPropTypeLocationNames[location], propName) : invariant(false) : void 0;
24830 error = propTypes[propName](props, propName, componentName, location);
24831 } catch (ex) {
24832 error = ex;
24833 }
24834 process.env.NODE_ENV !== 'production' ? warning(!error || error instanceof Error, '%s: type specification of %s `%s` is invalid; the type checker ' + 'function must return `null` or an `Error` but returned a %s. ' + 'You may have forgotten to pass an argument to the type checker ' + 'creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and ' + 'shape all require an argument).', componentName || 'React class', ReactPropTypeLocationNames[location], propName, typeof error) : void 0;
24835 if (error instanceof Error && !(error.message in loggedTypeFailures)) {
24836 // Only monitor this failure once because there tends to be a lot of the
24837 // same error.
24838 loggedTypeFailures[error.message] = true;
24839
24840 var addendum = getDeclarationErrorAddendum();
24841 process.env.NODE_ENV !== 'production' ? warning(false, 'Failed propType: %s%s', error.message, addendum) : void 0;
24842 }
24843 }
24844 }
24845}
24846
24847/**
24848 * Given an element, validate that its props follow the propTypes definition,
24849 * provided by the type.
24850 *
24851 * @param {ReactElement} element
24852 */
24853function validatePropTypes(element) {
24854 var componentClass = element.type;
24855 if (typeof componentClass !== 'function') {
24856 return;
24857 }
24858 var name = componentClass.displayName || componentClass.name;
24859 if (componentClass.propTypes) {
24860 checkPropTypes(name, componentClass.propTypes, element.props, ReactPropTypeLocations.prop);
24861 }
24862 if (typeof componentClass.getDefaultProps === 'function') {
24863 process.env.NODE_ENV !== 'production' ? warning(componentClass.getDefaultProps.isReactClassApproved, 'getDefaultProps is only used on classic React.createClass ' + 'definitions. Use a static property named `defaultProps` instead.') : void 0;
24864 }
24865}
24866
24867var ReactElementValidator = {
24868
24869 createElement: function (type, props, children) {
24870 var validType = typeof type === 'string' || typeof type === 'function';
24871 // We warn in this case but don't throw. We expect the element creation to
24872 // succeed and there will likely be errors in render.
24873 process.env.NODE_ENV !== 'production' ? warning(validType, 'React.createElement: type should not be null, undefined, boolean, or ' + 'number. It should be a string (for DOM elements) or a ReactClass ' + '(for composite components).%s', getDeclarationErrorAddendum()) : void 0;
24874
24875 var element = ReactElement.createElement.apply(this, arguments);
24876
24877 // The result can be nullish if a mock or a custom function is used.
24878 // TODO: Drop this when these are no longer allowed as the type argument.
24879 if (element == null) {
24880 return element;
24881 }
24882
24883 // Skip key warning if the type isn't valid since our key validation logic
24884 // doesn't expect a non-string/function type and can throw confusing errors.
24885 // We don't want exception behavior to differ between dev and prod.
24886 // (Rendering will throw with a helpful message and as soon as the type is
24887 // fixed, the key warnings will appear.)
24888 if (validType) {
24889 for (var i = 2; i < arguments.length; i++) {
24890 validateChildKeys(arguments[i], type);
24891 }
24892 }
24893
24894 validatePropTypes(element);
24895
24896 return element;
24897 },
24898
24899 createFactory: function (type) {
24900 var validatedFactory = ReactElementValidator.createElement.bind(null, type);
24901 // Legacy hook TODO: Warn if this is accessed
24902 validatedFactory.type = type;
24903
24904 if (process.env.NODE_ENV !== 'production') {
24905 if (canDefineProperty) {
24906 Object.defineProperty(validatedFactory, 'type', {
24907 enumerable: false,
24908 get: function () {
24909 process.env.NODE_ENV !== 'production' ? warning(false, 'Factory.type is deprecated. Access the class directly ' + 'before passing it to createFactory.') : void 0;
24910 Object.defineProperty(this, 'type', {
24911 value: type
24912 });
24913 return type;
24914 }
24915 });
24916 }
24917 }
24918
24919 return validatedFactory;
24920 },
24921
24922 cloneElement: function (element, props, children) {
24923 var newElement = ReactElement.cloneElement.apply(this, arguments);
24924 for (var i = 2; i < arguments.length; i++) {
24925 validateChildKeys(arguments[i], newElement.type);
24926 }
24927 validatePropTypes(newElement);
24928 return newElement;
24929 }
24930
24931};
24932
24933module.exports = ReactElementValidator;
24934}).call(this,require(91))
24935},{"194":194,"218":218,"239":239,"240":240,"269":269,"280":280,"45":45,"55":55,"91":91}],220:[function(require,module,exports){
24936/**
24937 * Copyright 2014-present, Facebook, Inc.
24938 * All rights reserved.
24939 *
24940 * This source code is licensed under the BSD-style license found in the
24941 * LICENSE file in the root directory of this source tree. An additional grant
24942 * of patent rights can be found in the PATENTS file in the same directory.
24943 *
24944 * @providesModule ReactEmptyComponent
24945 */
24946
24947'use strict';
24948
24949var emptyComponentFactory;
24950
24951var ReactEmptyComponentInjection = {
24952 injectEmptyComponentFactory: function (factory) {
24953 emptyComponentFactory = factory;
24954 }
24955};
24956
24957var ReactEmptyComponent = {
24958 create: function (instantiate) {
24959 return emptyComponentFactory(instantiate);
24960 }
24961};
24962
24963ReactEmptyComponent.injection = ReactEmptyComponentInjection;
24964
24965module.exports = ReactEmptyComponent;
24966},{}],221:[function(require,module,exports){
24967(function (process){
24968/**
24969 * Copyright 2013-present, Facebook, Inc.
24970 * All rights reserved.
24971 *
24972 * This source code is licensed under the BSD-style license found in the
24973 * LICENSE file in the root directory of this source tree. An additional grant
24974 * of patent rights can be found in the PATENTS file in the same directory.
24975 *
24976 * @providesModule ReactErrorUtils
24977 */
24978
24979'use strict';
24980
24981var caughtError = null;
24982
24983/**
24984 * Call a function while guarding against errors that happens within it.
24985 *
24986 * @param {?String} name of the guard to use for logging or debugging
24987 * @param {Function} func The function to invoke
24988 * @param {*} a First argument
24989 * @param {*} b Second argument
24990 */
24991function invokeGuardedCallback(name, func, a, b) {
24992 try {
24993 return func(a, b);
24994 } catch (x) {
24995 if (caughtError === null) {
24996 caughtError = x;
24997 }
24998 return undefined;
24999 }
25000}
25001
25002var ReactErrorUtils = {
25003 invokeGuardedCallback: invokeGuardedCallback,
25004
25005 /**
25006 * Invoked by ReactTestUtils.Simulate so that any errors thrown by the event
25007 * handler are sure to be rethrown by rethrowCaughtError.
25008 */
25009 invokeGuardedCallbackWithCatch: invokeGuardedCallback,
25010
25011 /**
25012 * During execution of guarded functions we will capture the first error which
25013 * we will rethrow to be handled by the top level error handler.
25014 */
25015 rethrowCaughtError: function () {
25016 if (caughtError) {
25017 var error = caughtError;
25018 caughtError = null;
25019 throw error;
25020 }
25021 }
25022};
25023
25024if (process.env.NODE_ENV !== 'production') {
25025 /**
25026 * To help development we can get better devtools integration by simulating a
25027 * real browser event.
25028 */
25029 if (typeof window !== 'undefined' && typeof window.dispatchEvent === 'function' && typeof document !== 'undefined' && typeof document.createEvent === 'function') {
25030 var fakeNode = document.createElement('react');
25031 ReactErrorUtils.invokeGuardedCallback = function (name, func, a, b) {
25032 var boundFunc = func.bind(null, a, b);
25033 var evtType = 'react-' + name;
25034 fakeNode.addEventListener(evtType, boundFunc, false);
25035 var evt = document.createEvent('Event');
25036 evt.initEvent(evtType, false, false);
25037 fakeNode.dispatchEvent(evt);
25038 fakeNode.removeEventListener(evtType, boundFunc, false);
25039 };
25040 }
25041}
25042
25043module.exports = ReactErrorUtils;
25044}).call(this,require(91))
25045},{"91":91}],222:[function(require,module,exports){
25046/**
25047 * Copyright 2013-present, Facebook, Inc.
25048 * All rights reserved.
25049 *
25050 * This source code is licensed under the BSD-style license found in the
25051 * LICENSE file in the root directory of this source tree. An additional grant
25052 * of patent rights can be found in the PATENTS file in the same directory.
25053 *
25054 * @providesModule ReactEventEmitterMixin
25055 */
25056
25057'use strict';
25058
25059var EventPluginHub = require(175);
25060
25061function runEventQueueInBatch(events) {
25062 EventPluginHub.enqueueEvents(events);
25063 EventPluginHub.processEventQueue(false);
25064}
25065
25066var ReactEventEmitterMixin = {
25067
25068 /**
25069 * Streams a fired top-level event to `EventPluginHub` where plugins have the
25070 * opportunity to create `ReactEvent`s to be dispatched.
25071 */
25072 handleTopLevel: function (topLevelType, targetInst, nativeEvent, nativeEventTarget) {
25073 var events = EventPluginHub.extractEvents(topLevelType, targetInst, nativeEvent, nativeEventTarget);
25074 runEventQueueInBatch(events);
25075 }
25076};
25077
25078module.exports = ReactEventEmitterMixin;
25079},{"175":175}],223:[function(require,module,exports){
25080/**
25081 * Copyright 2013-present, Facebook, Inc.
25082 * All rights reserved.
25083 *
25084 * This source code is licensed under the BSD-style license found in the
25085 * LICENSE file in the root directory of this source tree. An additional grant
25086 * of patent rights can be found in the PATENTS file in the same directory.
25087 *
25088 * @providesModule ReactEventListener
25089 */
25090
25091'use strict';
25092
25093var _assign = require(296);
25094
25095var EventListener = require(30);
25096var ExecutionEnvironment = require(31);
25097var PooledClass = require(183);
25098var ReactDOMComponentTree = require(199);
25099var ReactUpdates = require(247);
25100
25101var getEventTarget = require(279);
25102var getUnboundedScrollPosition = require(42);
25103
25104/**
25105 * Find the deepest React component completely containing the root of the
25106 * passed-in instance (for use when entire React trees are nested within each
25107 * other). If React trees are not nested, returns null.
25108 */
25109function findParent(inst) {
25110 // TODO: It may be a good idea to cache this to prevent unnecessary DOM
25111 // traversal, but caching is difficult to do correctly without using a
25112 // mutation observer to listen for all DOM changes.
25113 while (inst._nativeParent) {
25114 inst = inst._nativeParent;
25115 }
25116 var rootNode = ReactDOMComponentTree.getNodeFromInstance(inst);
25117 var container = rootNode.parentNode;
25118 return ReactDOMComponentTree.getClosestInstanceFromNode(container);
25119}
25120
25121// Used to store ancestor hierarchy in top level callback
25122function TopLevelCallbackBookKeeping(topLevelType, nativeEvent) {
25123 this.topLevelType = topLevelType;
25124 this.nativeEvent = nativeEvent;
25125 this.ancestors = [];
25126}
25127_assign(TopLevelCallbackBookKeeping.prototype, {
25128 destructor: function () {
25129 this.topLevelType = null;
25130 this.nativeEvent = null;
25131 this.ancestors.length = 0;
25132 }
25133});
25134PooledClass.addPoolingTo(TopLevelCallbackBookKeeping, PooledClass.twoArgumentPooler);
25135
25136function handleTopLevelImpl(bookKeeping) {
25137 var nativeEventTarget = getEventTarget(bookKeeping.nativeEvent);
25138 var targetInst = ReactDOMComponentTree.getClosestInstanceFromNode(nativeEventTarget);
25139
25140 // Loop through the hierarchy, in case there's any nested components.
25141 // It's important that we build the array of ancestors before calling any
25142 // event handlers, because event handlers can modify the DOM, leading to
25143 // inconsistencies with ReactMount's node cache. See #1105.
25144 var ancestor = targetInst;
25145 do {
25146 bookKeeping.ancestors.push(ancestor);
25147 ancestor = ancestor && findParent(ancestor);
25148 } while (ancestor);
25149
25150 for (var i = 0; i < bookKeeping.ancestors.length; i++) {
25151 targetInst = bookKeeping.ancestors[i];
25152 ReactEventListener._handleTopLevel(bookKeeping.topLevelType, targetInst, bookKeeping.nativeEvent, getEventTarget(bookKeeping.nativeEvent));
25153 }
25154}
25155
25156function scrollValueMonitor(cb) {
25157 var scrollPosition = getUnboundedScrollPosition(window);
25158 cb(scrollPosition);
25159}
25160
25161var ReactEventListener = {
25162 _enabled: true,
25163 _handleTopLevel: null,
25164
25165 WINDOW_HANDLE: ExecutionEnvironment.canUseDOM ? window : null,
25166
25167 setHandleTopLevel: function (handleTopLevel) {
25168 ReactEventListener._handleTopLevel = handleTopLevel;
25169 },
25170
25171 setEnabled: function (enabled) {
25172 ReactEventListener._enabled = !!enabled;
25173 },
25174
25175 isEnabled: function () {
25176 return ReactEventListener._enabled;
25177 },
25178
25179 /**
25180 * Traps top-level events by using event bubbling.
25181 *
25182 * @param {string} topLevelType Record from `EventConstants`.
25183 * @param {string} handlerBaseName Event name (e.g. "click").
25184 * @param {object} handle Element on which to attach listener.
25185 * @return {?object} An object with a remove function which will forcefully
25186 * remove the listener.
25187 * @internal
25188 */
25189 trapBubbledEvent: function (topLevelType, handlerBaseName, handle) {
25190 var element = handle;
25191 if (!element) {
25192 return null;
25193 }
25194 return EventListener.listen(element, handlerBaseName, ReactEventListener.dispatchEvent.bind(null, topLevelType));
25195 },
25196
25197 /**
25198 * Traps a top-level event by using event capturing.
25199 *
25200 * @param {string} topLevelType Record from `EventConstants`.
25201 * @param {string} handlerBaseName Event name (e.g. "click").
25202 * @param {object} handle Element on which to attach listener.
25203 * @return {?object} An object with a remove function which will forcefully
25204 * remove the listener.
25205 * @internal
25206 */
25207 trapCapturedEvent: function (topLevelType, handlerBaseName, handle) {
25208 var element = handle;
25209 if (!element) {
25210 return null;
25211 }
25212 return EventListener.capture(element, handlerBaseName, ReactEventListener.dispatchEvent.bind(null, topLevelType));
25213 },
25214
25215 monitorScrollValue: function (refresh) {
25216 var callback = scrollValueMonitor.bind(null, refresh);
25217 EventListener.listen(window, 'scroll', callback);
25218 },
25219
25220 dispatchEvent: function (topLevelType, nativeEvent) {
25221 if (!ReactEventListener._enabled) {
25222 return;
25223 }
25224
25225 var bookKeeping = TopLevelCallbackBookKeeping.getPooled(topLevelType, nativeEvent);
25226 try {
25227 // Event queue being processed in the same cycle allows
25228 // `preventDefault`.
25229 ReactUpdates.batchedUpdates(handleTopLevelImpl, bookKeeping);
25230 } finally {
25231 TopLevelCallbackBookKeeping.release(bookKeeping);
25232 }
25233 }
25234};
25235
25236module.exports = ReactEventListener;
25237},{"183":183,"199":199,"247":247,"279":279,"296":296,"30":30,"31":31,"42":42}],224:[function(require,module,exports){
25238/**
25239 * Copyright 2013-present, Facebook, Inc.
25240 * All rights reserved.
25241 *
25242 * This source code is licensed under the BSD-style license found in the
25243 * LICENSE file in the root directory of this source tree. An additional grant
25244 * of patent rights can be found in the PATENTS file in the same directory.
25245 *
25246 * @providesModule ReactFeatureFlags
25247 */
25248
25249'use strict';
25250
25251var ReactFeatureFlags = {
25252 // When true, call console.time() before and .timeEnd() after each top-level
25253 // render (both initial renders and updates). Useful when looking at prod-mode
25254 // timeline profiles in Chrome, for example.
25255 logTopLevelRenders: false
25256};
25257
25258module.exports = ReactFeatureFlags;
25259},{}],225:[function(require,module,exports){
25260/**
25261 * Copyright 2013-present, Facebook, Inc.
25262 * All rights reserved.
25263 *
25264 * This source code is licensed under the BSD-style license found in the
25265 * LICENSE file in the root directory of this source tree. An additional grant
25266 * of patent rights can be found in the PATENTS file in the same directory.
25267 *
25268 * @providesModule ReactInjection
25269 */
25270
25271'use strict';
25272
25273var DOMProperty = require(168);
25274var EventPluginHub = require(175);
25275var EventPluginUtils = require(177);
25276var ReactComponentEnvironment = require(191);
25277var ReactClass = require(188);
25278var ReactEmptyComponent = require(220);
25279var ReactBrowserEventEmitter = require(185);
25280var ReactNativeComponent = require(234);
25281var ReactUpdates = require(247);
25282
25283var ReactInjection = {
25284 Component: ReactComponentEnvironment.injection,
25285 Class: ReactClass.injection,
25286 DOMProperty: DOMProperty.injection,
25287 EmptyComponent: ReactEmptyComponent.injection,
25288 EventPluginHub: EventPluginHub.injection,
25289 EventPluginUtils: EventPluginUtils.injection,
25290 EventEmitter: ReactBrowserEventEmitter.injection,
25291 NativeComponent: ReactNativeComponent.injection,
25292 Updates: ReactUpdates.injection
25293};
25294
25295module.exports = ReactInjection;
25296},{"168":168,"175":175,"177":177,"185":185,"188":188,"191":191,"220":220,"234":234,"247":247}],226:[function(require,module,exports){
25297/**
25298 * Copyright 2013-present, Facebook, Inc.
25299 * All rights reserved.
25300 *
25301 * This source code is licensed under the BSD-style license found in the
25302 * LICENSE file in the root directory of this source tree. An additional grant
25303 * of patent rights can be found in the PATENTS file in the same directory.
25304 *
25305 * @providesModule ReactInputSelection
25306 */
25307
25308'use strict';
25309
25310var ReactDOMSelection = require(210);
25311
25312var containsNode = require(34);
25313var focusNode = require(39);
25314var getActiveElement = require(40);
25315
25316function isInDocument(node) {
25317 return containsNode(document.documentElement, node);
25318}
25319
25320/**
25321 * @ReactInputSelection: React input selection module. Based on Selection.js,
25322 * but modified to be suitable for react and has a couple of bug fixes (doesn't
25323 * assume buttons have range selections allowed).
25324 * Input selection module for React.
25325 */
25326var ReactInputSelection = {
25327
25328 hasSelectionCapabilities: function (elem) {
25329 var nodeName = elem && elem.nodeName && elem.nodeName.toLowerCase();
25330 return nodeName && (nodeName === 'input' && elem.type === 'text' || nodeName === 'textarea' || elem.contentEditable === 'true');
25331 },
25332
25333 getSelectionInformation: function () {
25334 var focusedElem = getActiveElement();
25335 return {
25336 focusedElem: focusedElem,
25337 selectionRange: ReactInputSelection.hasSelectionCapabilities(focusedElem) ? ReactInputSelection.getSelection(focusedElem) : null
25338 };
25339 },
25340
25341 /**
25342 * @restoreSelection: If any selection information was potentially lost,
25343 * restore it. This is useful when performing operations that could remove dom
25344 * nodes and place them back in, resulting in focus being lost.
25345 */
25346 restoreSelection: function (priorSelectionInformation) {
25347 var curFocusedElem = getActiveElement();
25348 var priorFocusedElem = priorSelectionInformation.focusedElem;
25349 var priorSelectionRange = priorSelectionInformation.selectionRange;
25350 if (curFocusedElem !== priorFocusedElem && isInDocument(priorFocusedElem)) {
25351 if (ReactInputSelection.hasSelectionCapabilities(priorFocusedElem)) {
25352 ReactInputSelection.setSelection(priorFocusedElem, priorSelectionRange);
25353 }
25354 focusNode(priorFocusedElem);
25355 }
25356 },
25357
25358 /**
25359 * @getSelection: Gets the selection bounds of a focused textarea, input or
25360 * contentEditable node.
25361 * -@input: Look up selection bounds of this input
25362 * -@return {start: selectionStart, end: selectionEnd}
25363 */
25364 getSelection: function (input) {
25365 var selection;
25366
25367 if ('selectionStart' in input) {
25368 // Modern browser with input or textarea.
25369 selection = {
25370 start: input.selectionStart,
25371 end: input.selectionEnd
25372 };
25373 } else if (document.selection && input.nodeName && input.nodeName.toLowerCase() === 'input') {
25374 // IE8 input.
25375 var range = document.selection.createRange();
25376 // There can only be one selection per document in IE, so it must
25377 // be in our element.
25378 if (range.parentElement() === input) {
25379 selection = {
25380 start: -range.moveStart('character', -input.value.length),
25381 end: -range.moveEnd('character', -input.value.length)
25382 };
25383 }
25384 } else {
25385 // Content editable or old IE textarea.
25386 selection = ReactDOMSelection.getOffsets(input);
25387 }
25388
25389 return selection || { start: 0, end: 0 };
25390 },
25391
25392 /**
25393 * @setSelection: Sets the selection bounds of a textarea or input and focuses
25394 * the input.
25395 * -@input Set selection bounds of this input or textarea
25396 * -@offsets Object of same form that is returned from get*
25397 */
25398 setSelection: function (input, offsets) {
25399 var start = offsets.start;
25400 var end = offsets.end;
25401 if (end === undefined) {
25402 end = start;
25403 }
25404
25405 if ('selectionStart' in input) {
25406 input.selectionStart = start;
25407 input.selectionEnd = Math.min(end, input.value.length);
25408 } else if (document.selection && input.nodeName && input.nodeName.toLowerCase() === 'input') {
25409 var range = input.createTextRange();
25410 range.collapse(true);
25411 range.moveStart('character', start);
25412 range.moveEnd('character', end - start);
25413 range.select();
25414 } else {
25415 ReactDOMSelection.setOffsets(input, offsets);
25416 }
25417 }
25418};
25419
25420module.exports = ReactInputSelection;
25421},{"210":210,"34":34,"39":39,"40":40}],227:[function(require,module,exports){
25422/**
25423 * Copyright 2013-present, Facebook, Inc.
25424 * All rights reserved.
25425 *
25426 * This source code is licensed under the BSD-style license found in the
25427 * LICENSE file in the root directory of this source tree. An additional grant
25428 * of patent rights can be found in the PATENTS file in the same directory.
25429 *
25430 * @providesModule ReactInstanceMap
25431 */
25432
25433'use strict';
25434
25435/**
25436 * `ReactInstanceMap` maintains a mapping from a public facing stateful
25437 * instance (key) and the internal representation (value). This allows public
25438 * methods to accept the user facing instance as an argument and map them back
25439 * to internal methods.
25440 */
25441
25442// TODO: Replace this with ES6: var ReactInstanceMap = new Map();
25443
25444var ReactInstanceMap = {
25445
25446 /**
25447 * This API should be called `delete` but we'd have to make sure to always
25448 * transform these to strings for IE support. When this transform is fully
25449 * supported we can rename it.
25450 */
25451 remove: function (key) {
25452 key._reactInternalInstance = undefined;
25453 },
25454
25455 get: function (key) {
25456 return key._reactInternalInstance;
25457 },
25458
25459 has: function (key) {
25460 return key._reactInternalInstance !== undefined;
25461 },
25462
25463 set: function (key, value) {
25464 key._reactInternalInstance = value;
25465 }
25466
25467};
25468
25469module.exports = ReactInstanceMap;
25470},{}],228:[function(require,module,exports){
25471/**
25472 * Copyright 2016-present, Facebook, Inc.
25473 * All rights reserved.
25474 *
25475 * This source code is licensed under the BSD-style license found in the
25476 * LICENSE file in the root directory of this source tree. An additional grant
25477 * of patent rights can be found in the PATENTS file in the same directory.
25478 *
25479 * @providesModule ReactInstrumentation
25480 */
25481
25482'use strict';
25483
25484var ReactDebugTool = require(215);
25485
25486module.exports = { debugTool: ReactDebugTool };
25487},{"215":215}],229:[function(require,module,exports){
25488(function (process){
25489/**
25490 * Copyright 2016-present, Facebook, Inc.
25491 * All rights reserved.
25492 *
25493 * This source code is licensed under the BSD-style license found in the
25494 * LICENSE file in the root directory of this source tree. An additional grant
25495 * of patent rights can be found in the PATENTS file in the same directory.
25496 *
25497 * @providesModule ReactInvalidSetStateWarningDevTool
25498 */
25499
25500'use strict';
25501
25502var warning = require(55);
25503
25504if (process.env.NODE_ENV !== 'production') {
25505 var processingChildContext = false;
25506
25507 var warnInvalidSetState = function () {
25508 process.env.NODE_ENV !== 'production' ? warning(!processingChildContext, 'setState(...): Cannot call setState() inside getChildContext()') : void 0;
25509 };
25510}
25511
25512var ReactInvalidSetStateWarningDevTool = {
25513 onBeginProcessingChildContext: function () {
25514 processingChildContext = true;
25515 },
25516 onEndProcessingChildContext: function () {
25517 processingChildContext = false;
25518 },
25519 onSetState: function () {
25520 warnInvalidSetState();
25521 }
25522};
25523
25524module.exports = ReactInvalidSetStateWarningDevTool;
25525}).call(this,require(91))
25526},{"55":55,"91":91}],230:[function(require,module,exports){
25527/**
25528 * Copyright 2013-present, Facebook, Inc.
25529 * All rights reserved.
25530 *
25531 * This source code is licensed under the BSD-style license found in the
25532 * LICENSE file in the root directory of this source tree. An additional grant
25533 * of patent rights can be found in the PATENTS file in the same directory.
25534 *
25535 * @providesModule ReactMarkupChecksum
25536 */
25537
25538'use strict';
25539
25540var adler32 = require(268);
25541
25542var TAG_END = /\/?>/;
25543var COMMENT_START = /^<\!\-\-/;
25544
25545var ReactMarkupChecksum = {
25546 CHECKSUM_ATTR_NAME: 'data-react-checksum',
25547
25548 /**
25549 * @param {string} markup Markup string
25550 * @return {string} Markup string with checksum attribute attached
25551 */
25552 addChecksumToMarkup: function (markup) {
25553 var checksum = adler32(markup);
25554
25555 // Add checksum (handle both parent tags, comments and self-closing tags)
25556 if (COMMENT_START.test(markup)) {
25557 return markup;
25558 } else {
25559 return markup.replace(TAG_END, ' ' + ReactMarkupChecksum.CHECKSUM_ATTR_NAME + '="' + checksum + '"$&');
25560 }
25561 },
25562
25563 /**
25564 * @param {string} markup to use
25565 * @param {DOMElement} element root React element
25566 * @returns {boolean} whether or not the markup is the same
25567 */
25568 canReuseMarkup: function (markup, element) {
25569 var existingChecksum = element.getAttribute(ReactMarkupChecksum.CHECKSUM_ATTR_NAME);
25570 existingChecksum = existingChecksum && parseInt(existingChecksum, 10);
25571 var markupChecksum = adler32(markup);
25572 return markupChecksum === existingChecksum;
25573 }
25574};
25575
25576module.exports = ReactMarkupChecksum;
25577},{"268":268}],231:[function(require,module,exports){
25578(function (process){
25579/**
25580 * Copyright 2013-present, Facebook, Inc.
25581 * All rights reserved.
25582 *
25583 * This source code is licensed under the BSD-style license found in the
25584 * LICENSE file in the root directory of this source tree. An additional grant
25585 * of patent rights can be found in the PATENTS file in the same directory.
25586 *
25587 * @providesModule ReactMount
25588 */
25589
25590'use strict';
25591
25592var DOMLazyTree = require(166);
25593var DOMProperty = require(168);
25594var ReactBrowserEventEmitter = require(185);
25595var ReactCurrentOwner = require(194);
25596var ReactDOMComponentTree = require(199);
25597var ReactDOMContainerInfo = require(200);
25598var ReactDOMFeatureFlags = require(204);
25599var ReactElement = require(218);
25600var ReactFeatureFlags = require(224);
25601var ReactInstrumentation = require(228);
25602var ReactMarkupChecksum = require(230);
25603var ReactReconciler = require(243);
25604var ReactUpdateQueue = require(246);
25605var ReactUpdates = require(247);
25606
25607var emptyObject = require(38);
25608var instantiateReactComponent = require(285);
25609var invariant = require(45);
25610var setInnerHTML = require(291);
25611var shouldUpdateReactComponent = require(293);
25612var warning = require(55);
25613
25614var ATTR_NAME = DOMProperty.ID_ATTRIBUTE_NAME;
25615var ROOT_ATTR_NAME = DOMProperty.ROOT_ATTRIBUTE_NAME;
25616
25617var ELEMENT_NODE_TYPE = 1;
25618var DOC_NODE_TYPE = 9;
25619var DOCUMENT_FRAGMENT_NODE_TYPE = 11;
25620
25621var instancesByReactRootID = {};
25622
25623/**
25624 * Finds the index of the first character
25625 * that's not common between the two given strings.
25626 *
25627 * @return {number} the index of the character where the strings diverge
25628 */
25629function firstDifferenceIndex(string1, string2) {
25630 var minLen = Math.min(string1.length, string2.length);
25631 for (var i = 0; i < minLen; i++) {
25632 if (string1.charAt(i) !== string2.charAt(i)) {
25633 return i;
25634 }
25635 }
25636 return string1.length === string2.length ? -1 : minLen;
25637}
25638
25639/**
25640 * @param {DOMElement|DOMDocument} container DOM element that may contain
25641 * a React component
25642 * @return {?*} DOM element that may have the reactRoot ID, or null.
25643 */
25644function getReactRootElementInContainer(container) {
25645 if (!container) {
25646 return null;
25647 }
25648
25649 if (container.nodeType === DOC_NODE_TYPE) {
25650 return container.documentElement;
25651 } else {
25652 return container.firstChild;
25653 }
25654}
25655
25656function internalGetID(node) {
25657 // If node is something like a window, document, or text node, none of
25658 // which support attributes or a .getAttribute method, gracefully return
25659 // the empty string, as if the attribute were missing.
25660 return node.getAttribute && node.getAttribute(ATTR_NAME) || '';
25661}
25662
25663/**
25664 * Mounts this component and inserts it into the DOM.
25665 *
25666 * @param {ReactComponent} componentInstance The instance to mount.
25667 * @param {DOMElement} container DOM element to mount into.
25668 * @param {ReactReconcileTransaction} transaction
25669 * @param {boolean} shouldReuseMarkup If true, do not insert markup
25670 */
25671function mountComponentIntoNode(wrapperInstance, container, transaction, shouldReuseMarkup, context) {
25672 var markerName;
25673 if (ReactFeatureFlags.logTopLevelRenders) {
25674 var wrappedElement = wrapperInstance._currentElement.props;
25675 var type = wrappedElement.type;
25676 markerName = 'React mount: ' + (typeof type === 'string' ? type : type.displayName || type.name);
25677 console.time(markerName);
25678 }
25679
25680 var markup = ReactReconciler.mountComponent(wrapperInstance, transaction, null, ReactDOMContainerInfo(wrapperInstance, container), context);
25681
25682 if (markerName) {
25683 console.timeEnd(markerName);
25684 }
25685
25686 wrapperInstance._renderedComponent._topLevelWrapper = wrapperInstance;
25687 ReactMount._mountImageIntoNode(markup, container, wrapperInstance, shouldReuseMarkup, transaction);
25688}
25689
25690/**
25691 * Batched mount.
25692 *
25693 * @param {ReactComponent} componentInstance The instance to mount.
25694 * @param {DOMElement} container DOM element to mount into.
25695 * @param {boolean} shouldReuseMarkup If true, do not insert markup
25696 */
25697function batchedMountComponentIntoNode(componentInstance, container, shouldReuseMarkup, context) {
25698 var transaction = ReactUpdates.ReactReconcileTransaction.getPooled(
25699 /* useCreateElement */
25700 !shouldReuseMarkup && ReactDOMFeatureFlags.useCreateElement);
25701 transaction.perform(mountComponentIntoNode, null, componentInstance, container, transaction, shouldReuseMarkup, context);
25702 ReactUpdates.ReactReconcileTransaction.release(transaction);
25703}
25704
25705/**
25706 * Unmounts a component and removes it from the DOM.
25707 *
25708 * @param {ReactComponent} instance React component instance.
25709 * @param {DOMElement} container DOM element to unmount from.
25710 * @final
25711 * @internal
25712 * @see {ReactMount.unmountComponentAtNode}
25713 */
25714function unmountComponentFromNode(instance, container, safely) {
25715 ReactReconciler.unmountComponent(instance, safely);
25716
25717 if (container.nodeType === DOC_NODE_TYPE) {
25718 container = container.documentElement;
25719 }
25720
25721 // http://jsperf.com/emptying-a-node
25722 while (container.lastChild) {
25723 container.removeChild(container.lastChild);
25724 }
25725}
25726
25727/**
25728 * True if the supplied DOM node has a direct React-rendered child that is
25729 * not a React root element. Useful for warning in `render`,
25730 * `unmountComponentAtNode`, etc.
25731 *
25732 * @param {?DOMElement} node The candidate DOM node.
25733 * @return {boolean} True if the DOM element contains a direct child that was
25734 * rendered by React but is not a root element.
25735 * @internal
25736 */
25737function hasNonRootReactChild(container) {
25738 var rootEl = getReactRootElementInContainer(container);
25739 if (rootEl) {
25740 var inst = ReactDOMComponentTree.getInstanceFromNode(rootEl);
25741 return !!(inst && inst._nativeParent);
25742 }
25743}
25744
25745function getNativeRootInstanceInContainer(container) {
25746 var rootEl = getReactRootElementInContainer(container);
25747 var prevNativeInstance = rootEl && ReactDOMComponentTree.getInstanceFromNode(rootEl);
25748 return prevNativeInstance && !prevNativeInstance._nativeParent ? prevNativeInstance : null;
25749}
25750
25751function getTopLevelWrapperInContainer(container) {
25752 var root = getNativeRootInstanceInContainer(container);
25753 return root ? root._nativeContainerInfo._topLevelWrapper : null;
25754}
25755
25756/**
25757 * Temporary (?) hack so that we can store all top-level pending updates on
25758 * composites instead of having to worry about different types of components
25759 * here.
25760 */
25761var topLevelRootCounter = 1;
25762var TopLevelWrapper = function () {
25763 this.rootID = topLevelRootCounter++;
25764};
25765TopLevelWrapper.prototype.isReactComponent = {};
25766if (process.env.NODE_ENV !== 'production') {
25767 TopLevelWrapper.displayName = 'TopLevelWrapper';
25768}
25769TopLevelWrapper.prototype.render = function () {
25770 // this.props is actually a ReactElement
25771 return this.props;
25772};
25773
25774/**
25775 * Mounting is the process of initializing a React component by creating its
25776 * representative DOM elements and inserting them into a supplied `container`.
25777 * Any prior content inside `container` is destroyed in the process.
25778 *
25779 * ReactMount.render(
25780 * component,
25781 * document.getElementById('container')
25782 * );
25783 *
25784 * <div id="container"> <-- Supplied `container`.
25785 * <div data-reactid=".3"> <-- Rendered reactRoot of React
25786 * // ... component.
25787 * </div>
25788 * </div>
25789 *
25790 * Inside of `container`, the first element rendered is the "reactRoot".
25791 */
25792var ReactMount = {
25793
25794 TopLevelWrapper: TopLevelWrapper,
25795
25796 /**
25797 * Used by devtools. The keys are not important.
25798 */
25799 _instancesByReactRootID: instancesByReactRootID,
25800
25801 /**
25802 * This is a hook provided to support rendering React components while
25803 * ensuring that the apparent scroll position of its `container` does not
25804 * change.
25805 *
25806 * @param {DOMElement} container The `container` being rendered into.
25807 * @param {function} renderCallback This must be called once to do the render.
25808 */
25809 scrollMonitor: function (container, renderCallback) {
25810 renderCallback();
25811 },
25812
25813 /**
25814 * Take a component that's already mounted into the DOM and replace its props
25815 * @param {ReactComponent} prevComponent component instance already in the DOM
25816 * @param {ReactElement} nextElement component instance to render
25817 * @param {DOMElement} container container to render into
25818 * @param {?function} callback function triggered on completion
25819 */
25820 _updateRootComponent: function (prevComponent, nextElement, container, callback) {
25821 ReactMount.scrollMonitor(container, function () {
25822 ReactUpdateQueue.enqueueElementInternal(prevComponent, nextElement);
25823 if (callback) {
25824 ReactUpdateQueue.enqueueCallbackInternal(prevComponent, callback);
25825 }
25826 });
25827
25828 return prevComponent;
25829 },
25830
25831 /**
25832 * Render a new component into the DOM. Hooked by devtools!
25833 *
25834 * @param {ReactElement} nextElement element to render
25835 * @param {DOMElement} container container to render into
25836 * @param {boolean} shouldReuseMarkup if we should skip the markup insertion
25837 * @return {ReactComponent} nextComponent
25838 */
25839 _renderNewRootComponent: function (nextElement, container, shouldReuseMarkup, context) {
25840 if (process.env.NODE_ENV !== 'production') {
25841 ReactInstrumentation.debugTool.onBeginFlush();
25842 }
25843
25844 // Various parts of our code (such as ReactCompositeComponent's
25845 // _renderValidatedComponent) assume that calls to render aren't nested;
25846 // verify that that's the case.
25847 process.env.NODE_ENV !== 'production' ? warning(ReactCurrentOwner.current == null, '_renderNewRootComponent(): Render methods should be a pure function ' + 'of props and state; triggering nested component updates from ' + 'render is not allowed. If necessary, trigger nested updates in ' + 'componentDidUpdate. Check the render method of %s.', ReactCurrentOwner.current && ReactCurrentOwner.current.getName() || 'ReactCompositeComponent') : void 0;
25848
25849 !(container && (container.nodeType === ELEMENT_NODE_TYPE || container.nodeType === DOC_NODE_TYPE || container.nodeType === DOCUMENT_FRAGMENT_NODE_TYPE)) ? process.env.NODE_ENV !== 'production' ? invariant(false, '_registerComponent(...): Target container is not a DOM element.') : invariant(false) : void 0;
25850
25851 ReactBrowserEventEmitter.ensureScrollValueMonitoring();
25852 var componentInstance = instantiateReactComponent(nextElement);
25853
25854 if (process.env.NODE_ENV !== 'production') {
25855 // Mute future events from the top level wrapper.
25856 // It is an implementation detail that devtools should not know about.
25857 componentInstance._debugID = 0;
25858 }
25859
25860 // The initial render is synchronous but any updates that happen during
25861 // rendering, in componentWillMount or componentDidMount, will be batched
25862 // according to the current batching strategy.
25863
25864 ReactUpdates.batchedUpdates(batchedMountComponentIntoNode, componentInstance, container, shouldReuseMarkup, context);
25865
25866 var wrapperID = componentInstance._instance.rootID;
25867 instancesByReactRootID[wrapperID] = componentInstance;
25868
25869 if (process.env.NODE_ENV !== 'production') {
25870 // The instance here is TopLevelWrapper so we report mount for its child.
25871 ReactInstrumentation.debugTool.onMountRootComponent(componentInstance._renderedComponent._debugID);
25872 ReactInstrumentation.debugTool.onEndFlush();
25873 }
25874
25875 return componentInstance;
25876 },
25877
25878 /**
25879 * Renders a React component into the DOM in the supplied `container`.
25880 *
25881 * If the React component was previously rendered into `container`, this will
25882 * perform an update on it and only mutate the DOM as necessary to reflect the
25883 * latest React component.
25884 *
25885 * @param {ReactComponent} parentComponent The conceptual parent of this render tree.
25886 * @param {ReactElement} nextElement Component element to render.
25887 * @param {DOMElement} container DOM element to render into.
25888 * @param {?function} callback function triggered on completion
25889 * @return {ReactComponent} Component instance rendered in `container`.
25890 */
25891 renderSubtreeIntoContainer: function (parentComponent, nextElement, container, callback) {
25892 !(parentComponent != null && parentComponent._reactInternalInstance != null) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'parentComponent must be a valid React Component') : invariant(false) : void 0;
25893 return ReactMount._renderSubtreeIntoContainer(parentComponent, nextElement, container, callback);
25894 },
25895
25896 _renderSubtreeIntoContainer: function (parentComponent, nextElement, container, callback) {
25897 ReactUpdateQueue.validateCallback(callback, 'ReactDOM.render');
25898 !ReactElement.isValidElement(nextElement) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactDOM.render(): Invalid component element.%s', typeof nextElement === 'string' ? ' Instead of passing a string like \'div\', pass ' + 'React.createElement(\'div\') or <div />.' : typeof nextElement === 'function' ? ' Instead of passing a class like Foo, pass ' + 'React.createElement(Foo) or <Foo />.' :
25899 // Check if it quacks like an element
25900 nextElement != null && nextElement.props !== undefined ? ' This may be caused by unintentionally loading two independent ' + 'copies of React.' : '') : invariant(false) : void 0;
25901
25902 process.env.NODE_ENV !== 'production' ? warning(!container || !container.tagName || container.tagName.toUpperCase() !== 'BODY', 'render(): Rendering components directly into document.body is ' + 'discouraged, since its children are often manipulated by third-party ' + 'scripts and browser extensions. This may lead to subtle ' + 'reconciliation issues. Try rendering into a container element created ' + 'for your app.') : void 0;
25903
25904 var nextWrappedElement = ReactElement(TopLevelWrapper, null, null, null, null, null, nextElement);
25905
25906 var prevComponent = getTopLevelWrapperInContainer(container);
25907
25908 if (prevComponent) {
25909 var prevWrappedElement = prevComponent._currentElement;
25910 var prevElement = prevWrappedElement.props;
25911 if (shouldUpdateReactComponent(prevElement, nextElement)) {
25912 var publicInst = prevComponent._renderedComponent.getPublicInstance();
25913 var updatedCallback = callback && function () {
25914 callback.call(publicInst);
25915 };
25916 ReactMount._updateRootComponent(prevComponent, nextWrappedElement, container, updatedCallback);
25917 return publicInst;
25918 } else {
25919 ReactMount.unmountComponentAtNode(container);
25920 }
25921 }
25922
25923 var reactRootElement = getReactRootElementInContainer(container);
25924 var containerHasReactMarkup = reactRootElement && !!internalGetID(reactRootElement);
25925 var containerHasNonRootReactChild = hasNonRootReactChild(container);
25926
25927 if (process.env.NODE_ENV !== 'production') {
25928 process.env.NODE_ENV !== 'production' ? warning(!containerHasNonRootReactChild, 'render(...): Replacing React-rendered children with a new root ' + 'component. If you intended to update the children of this node, ' + 'you should instead have the existing children update their state ' + 'and render the new components instead of calling ReactDOM.render.') : void 0;
25929
25930 if (!containerHasReactMarkup || reactRootElement.nextSibling) {
25931 var rootElementSibling = reactRootElement;
25932 while (rootElementSibling) {
25933 if (internalGetID(rootElementSibling)) {
25934 process.env.NODE_ENV !== 'production' ? warning(false, 'render(): Target node has markup rendered by React, but there ' + 'are unrelated nodes as well. This is most commonly caused by ' + 'white-space inserted around server-rendered markup.') : void 0;
25935 break;
25936 }
25937 rootElementSibling = rootElementSibling.nextSibling;
25938 }
25939 }
25940 }
25941
25942 var shouldReuseMarkup = containerHasReactMarkup && !prevComponent && !containerHasNonRootReactChild;
25943 var component = ReactMount._renderNewRootComponent(nextWrappedElement, container, shouldReuseMarkup, parentComponent != null ? parentComponent._reactInternalInstance._processChildContext(parentComponent._reactInternalInstance._context) : emptyObject)._renderedComponent.getPublicInstance();
25944 if (callback) {
25945 callback.call(component);
25946 }
25947 return component;
25948 },
25949
25950 /**
25951 * Renders a React component into the DOM in the supplied `container`.
25952 * See https://facebook.github.io/react/docs/top-level-api.html#reactdom.render
25953 *
25954 * If the React component was previously rendered into `container`, this will
25955 * perform an update on it and only mutate the DOM as necessary to reflect the
25956 * latest React component.
25957 *
25958 * @param {ReactElement} nextElement Component element to render.
25959 * @param {DOMElement} container DOM element to render into.
25960 * @param {?function} callback function triggered on completion
25961 * @return {ReactComponent} Component instance rendered in `container`.
25962 */
25963 render: function (nextElement, container, callback) {
25964 return ReactMount._renderSubtreeIntoContainer(null, nextElement, container, callback);
25965 },
25966
25967 /**
25968 * Unmounts and destroys the React component rendered in the `container`.
25969 * See https://facebook.github.io/react/docs/top-level-api.html#reactdom.unmountcomponentatnode
25970 *
25971 * @param {DOMElement} container DOM element containing a React component.
25972 * @return {boolean} True if a component was found in and unmounted from
25973 * `container`
25974 */
25975 unmountComponentAtNode: function (container) {
25976 // Various parts of our code (such as ReactCompositeComponent's
25977 // _renderValidatedComponent) assume that calls to render aren't nested;
25978 // verify that that's the case. (Strictly speaking, unmounting won't cause a
25979 // render but we still don't expect to be in a render call here.)
25980 process.env.NODE_ENV !== 'production' ? warning(ReactCurrentOwner.current == null, 'unmountComponentAtNode(): Render methods should be a pure function ' + 'of props and state; triggering nested component updates from render ' + 'is not allowed. If necessary, trigger nested updates in ' + 'componentDidUpdate. Check the render method of %s.', ReactCurrentOwner.current && ReactCurrentOwner.current.getName() || 'ReactCompositeComponent') : void 0;
25981
25982 !(container && (container.nodeType === ELEMENT_NODE_TYPE || container.nodeType === DOC_NODE_TYPE || container.nodeType === DOCUMENT_FRAGMENT_NODE_TYPE)) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'unmountComponentAtNode(...): Target container is not a DOM element.') : invariant(false) : void 0;
25983
25984 var prevComponent = getTopLevelWrapperInContainer(container);
25985 if (!prevComponent) {
25986 // Check if the node being unmounted was rendered by React, but isn't a
25987 // root node.
25988 var containerHasNonRootReactChild = hasNonRootReactChild(container);
25989
25990 // Check if the container itself is a React root node.
25991 var isContainerReactRoot = container.nodeType === 1 && container.hasAttribute(ROOT_ATTR_NAME);
25992
25993 if (process.env.NODE_ENV !== 'production') {
25994 process.env.NODE_ENV !== 'production' ? warning(!containerHasNonRootReactChild, 'unmountComponentAtNode(): The node you\'re attempting to unmount ' + 'was rendered by React and is not a top-level container. %s', isContainerReactRoot ? 'You may have accidentally passed in a React root node instead ' + 'of its container.' : 'Instead, have the parent component update its state and ' + 'rerender in order to remove this component.') : void 0;
25995 }
25996
25997 return false;
25998 }
25999 delete instancesByReactRootID[prevComponent._instance.rootID];
26000 ReactUpdates.batchedUpdates(unmountComponentFromNode, prevComponent, container, false);
26001 return true;
26002 },
26003
26004 _mountImageIntoNode: function (markup, container, instance, shouldReuseMarkup, transaction) {
26005 !(container && (container.nodeType === ELEMENT_NODE_TYPE || container.nodeType === DOC_NODE_TYPE || container.nodeType === DOCUMENT_FRAGMENT_NODE_TYPE)) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'mountComponentIntoNode(...): Target container is not valid.') : invariant(false) : void 0;
26006
26007 if (shouldReuseMarkup) {
26008 var rootElement = getReactRootElementInContainer(container);
26009 if (ReactMarkupChecksum.canReuseMarkup(markup, rootElement)) {
26010 ReactDOMComponentTree.precacheNode(instance, rootElement);
26011 return;
26012 } else {
26013 var checksum = rootElement.getAttribute(ReactMarkupChecksum.CHECKSUM_ATTR_NAME);
26014 rootElement.removeAttribute(ReactMarkupChecksum.CHECKSUM_ATTR_NAME);
26015
26016 var rootMarkup = rootElement.outerHTML;
26017 rootElement.setAttribute(ReactMarkupChecksum.CHECKSUM_ATTR_NAME, checksum);
26018
26019 var normalizedMarkup = markup;
26020 if (process.env.NODE_ENV !== 'production') {
26021 // because rootMarkup is retrieved from the DOM, various normalizations
26022 // will have occurred which will not be present in `markup`. Here,
26023 // insert markup into a <div> or <iframe> depending on the container
26024 // type to perform the same normalizations before comparing.
26025 var normalizer;
26026 if (container.nodeType === ELEMENT_NODE_TYPE) {
26027 normalizer = document.createElement('div');
26028 normalizer.innerHTML = markup;
26029 normalizedMarkup = normalizer.innerHTML;
26030 } else {
26031 normalizer = document.createElement('iframe');
26032 document.body.appendChild(normalizer);
26033 normalizer.contentDocument.write(markup);
26034 normalizedMarkup = normalizer.contentDocument.documentElement.outerHTML;
26035 document.body.removeChild(normalizer);
26036 }
26037 }
26038
26039 var diffIndex = firstDifferenceIndex(normalizedMarkup, rootMarkup);
26040 var difference = ' (client) ' + normalizedMarkup.substring(diffIndex - 20, diffIndex + 20) + '\n (server) ' + rootMarkup.substring(diffIndex - 20, diffIndex + 20);
26041
26042 !(container.nodeType !== DOC_NODE_TYPE) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'You\'re trying to render a component to the document using ' + 'server rendering but the checksum was invalid. This usually ' + 'means you rendered a different component type or props on ' + 'the client from the one on the server, or your render() ' + 'methods are impure. React cannot handle this case due to ' + 'cross-browser quirks by rendering at the document root. You ' + 'should look for environment dependent code in your components ' + 'and ensure the props are the same client and server side:\n%s', difference) : invariant(false) : void 0;
26043
26044 if (process.env.NODE_ENV !== 'production') {
26045 process.env.NODE_ENV !== 'production' ? warning(false, 'React attempted to reuse markup in a container but the ' + 'checksum was invalid. This generally means that you are ' + 'using server rendering and the markup generated on the ' + 'server was not what the client was expecting. React injected ' + 'new markup to compensate which works but you have lost many ' + 'of the benefits of server rendering. Instead, figure out ' + 'why the markup being generated is different on the client ' + 'or server:\n%s', difference) : void 0;
26046 }
26047 }
26048 }
26049
26050 !(container.nodeType !== DOC_NODE_TYPE) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'You\'re trying to render a component to the document but ' + 'you didn\'t use server rendering. We can\'t do this ' + 'without using server rendering due to cross-browser quirks. ' + 'See ReactDOMServer.renderToString() for server rendering.') : invariant(false) : void 0;
26051
26052 if (transaction.useCreateElement) {
26053 while (container.lastChild) {
26054 container.removeChild(container.lastChild);
26055 }
26056 DOMLazyTree.insertTreeBefore(container, markup, null);
26057 } else {
26058 setInnerHTML(container, markup);
26059 ReactDOMComponentTree.precacheNode(instance, container.firstChild);
26060 }
26061
26062 if (process.env.NODE_ENV !== 'production') {
26063 var nativeNode = ReactDOMComponentTree.getInstanceFromNode(container.firstChild);
26064 if (nativeNode._debugID !== 0) {
26065 ReactInstrumentation.debugTool.onNativeOperation(nativeNode._debugID, 'mount', markup.toString());
26066 }
26067 }
26068 }
26069};
26070
26071module.exports = ReactMount;
26072}).call(this,require(91))
26073},{"166":166,"168":168,"185":185,"194":194,"199":199,"200":200,"204":204,"218":218,"224":224,"228":228,"230":230,"243":243,"246":246,"247":247,"285":285,"291":291,"293":293,"38":38,"45":45,"55":55,"91":91}],232:[function(require,module,exports){
26074(function (process){
26075/**
26076 * Copyright 2013-present, Facebook, Inc.
26077 * All rights reserved.
26078 *
26079 * This source code is licensed under the BSD-style license found in the
26080 * LICENSE file in the root directory of this source tree. An additional grant
26081 * of patent rights can be found in the PATENTS file in the same directory.
26082 *
26083 * @providesModule ReactMultiChild
26084 */
26085
26086'use strict';
26087
26088var ReactComponentEnvironment = require(191);
26089var ReactInstrumentation = require(228);
26090var ReactMultiChildUpdateTypes = require(233);
26091
26092var ReactCurrentOwner = require(194);
26093var ReactReconciler = require(243);
26094var ReactChildReconciler = require(186);
26095
26096var emptyFunction = require(37);
26097var flattenChildren = require(274);
26098var invariant = require(45);
26099
26100/**
26101 * Make an update for markup to be rendered and inserted at a supplied index.
26102 *
26103 * @param {string} markup Markup that renders into an element.
26104 * @param {number} toIndex Destination index.
26105 * @private
26106 */
26107function makeInsertMarkup(markup, afterNode, toIndex) {
26108 // NOTE: Null values reduce hidden classes.
26109 return {
26110 type: ReactMultiChildUpdateTypes.INSERT_MARKUP,
26111 content: markup,
26112 fromIndex: null,
26113 fromNode: null,
26114 toIndex: toIndex,
26115 afterNode: afterNode
26116 };
26117}
26118
26119/**
26120 * Make an update for moving an existing element to another index.
26121 *
26122 * @param {number} fromIndex Source index of the existing element.
26123 * @param {number} toIndex Destination index of the element.
26124 * @private
26125 */
26126function makeMove(child, afterNode, toIndex) {
26127 // NOTE: Null values reduce hidden classes.
26128 return {
26129 type: ReactMultiChildUpdateTypes.MOVE_EXISTING,
26130 content: null,
26131 fromIndex: child._mountIndex,
26132 fromNode: ReactReconciler.getNativeNode(child),
26133 toIndex: toIndex,
26134 afterNode: afterNode
26135 };
26136}
26137
26138/**
26139 * Make an update for removing an element at an index.
26140 *
26141 * @param {number} fromIndex Index of the element to remove.
26142 * @private
26143 */
26144function makeRemove(child, node) {
26145 // NOTE: Null values reduce hidden classes.
26146 return {
26147 type: ReactMultiChildUpdateTypes.REMOVE_NODE,
26148 content: null,
26149 fromIndex: child._mountIndex,
26150 fromNode: node,
26151 toIndex: null,
26152 afterNode: null
26153 };
26154}
26155
26156/**
26157 * Make an update for setting the markup of a node.
26158 *
26159 * @param {string} markup Markup that renders into an element.
26160 * @private
26161 */
26162function makeSetMarkup(markup) {
26163 // NOTE: Null values reduce hidden classes.
26164 return {
26165 type: ReactMultiChildUpdateTypes.SET_MARKUP,
26166 content: markup,
26167 fromIndex: null,
26168 fromNode: null,
26169 toIndex: null,
26170 afterNode: null
26171 };
26172}
26173
26174/**
26175 * Make an update for setting the text content.
26176 *
26177 * @param {string} textContent Text content to set.
26178 * @private
26179 */
26180function makeTextContent(textContent) {
26181 // NOTE: Null values reduce hidden classes.
26182 return {
26183 type: ReactMultiChildUpdateTypes.TEXT_CONTENT,
26184 content: textContent,
26185 fromIndex: null,
26186 fromNode: null,
26187 toIndex: null,
26188 afterNode: null
26189 };
26190}
26191
26192/**
26193 * Push an update, if any, onto the queue. Creates a new queue if none is
26194 * passed and always returns the queue. Mutative.
26195 */
26196function enqueue(queue, update) {
26197 if (update) {
26198 queue = queue || [];
26199 queue.push(update);
26200 }
26201 return queue;
26202}
26203
26204/**
26205 * Processes any enqueued updates.
26206 *
26207 * @private
26208 */
26209function processQueue(inst, updateQueue) {
26210 ReactComponentEnvironment.processChildrenUpdates(inst, updateQueue);
26211}
26212
26213var setChildrenForInstrumentation = emptyFunction;
26214if (process.env.NODE_ENV !== 'production') {
26215 setChildrenForInstrumentation = function (children) {
26216 ReactInstrumentation.debugTool.onSetChildren(this._debugID, children ? Object.keys(children).map(function (key) {
26217 return children[key]._debugID;
26218 }) : []);
26219 };
26220}
26221
26222/**
26223 * ReactMultiChild are capable of reconciling multiple children.
26224 *
26225 * @class ReactMultiChild
26226 * @internal
26227 */
26228var ReactMultiChild = {
26229
26230 /**
26231 * Provides common functionality for components that must reconcile multiple
26232 * children. This is used by `ReactDOMComponent` to mount, update, and
26233 * unmount child components.
26234 *
26235 * @lends {ReactMultiChild.prototype}
26236 */
26237 Mixin: {
26238
26239 _reconcilerInstantiateChildren: function (nestedChildren, transaction, context) {
26240 if (process.env.NODE_ENV !== 'production') {
26241 if (this._currentElement) {
26242 try {
26243 ReactCurrentOwner.current = this._currentElement._owner;
26244 return ReactChildReconciler.instantiateChildren(nestedChildren, transaction, context);
26245 } finally {
26246 ReactCurrentOwner.current = null;
26247 }
26248 }
26249 }
26250 return ReactChildReconciler.instantiateChildren(nestedChildren, transaction, context);
26251 },
26252
26253 _reconcilerUpdateChildren: function (prevChildren, nextNestedChildrenElements, removedNodes, transaction, context) {
26254 var nextChildren;
26255 if (process.env.NODE_ENV !== 'production') {
26256 if (this._currentElement) {
26257 try {
26258 ReactCurrentOwner.current = this._currentElement._owner;
26259 nextChildren = flattenChildren(nextNestedChildrenElements);
26260 } finally {
26261 ReactCurrentOwner.current = null;
26262 }
26263 ReactChildReconciler.updateChildren(prevChildren, nextChildren, removedNodes, transaction, context);
26264 return nextChildren;
26265 }
26266 }
26267 nextChildren = flattenChildren(nextNestedChildrenElements);
26268 ReactChildReconciler.updateChildren(prevChildren, nextChildren, removedNodes, transaction, context);
26269 return nextChildren;
26270 },
26271
26272 /**
26273 * Generates a "mount image" for each of the supplied children. In the case
26274 * of `ReactDOMComponent`, a mount image is a string of markup.
26275 *
26276 * @param {?object} nestedChildren Nested child maps.
26277 * @return {array} An array of mounted representations.
26278 * @internal
26279 */
26280 mountChildren: function (nestedChildren, transaction, context) {
26281 var children = this._reconcilerInstantiateChildren(nestedChildren, transaction, context);
26282 this._renderedChildren = children;
26283
26284 var mountImages = [];
26285 var index = 0;
26286 for (var name in children) {
26287 if (children.hasOwnProperty(name)) {
26288 var child = children[name];
26289 var mountImage = ReactReconciler.mountComponent(child, transaction, this, this._nativeContainerInfo, context);
26290 child._mountIndex = index++;
26291 mountImages.push(mountImage);
26292 }
26293 }
26294
26295 if (process.env.NODE_ENV !== 'production') {
26296 setChildrenForInstrumentation.call(this, children);
26297 }
26298
26299 return mountImages;
26300 },
26301
26302 /**
26303 * Replaces any rendered children with a text content string.
26304 *
26305 * @param {string} nextContent String of content.
26306 * @internal
26307 */
26308 updateTextContent: function (nextContent) {
26309 var prevChildren = this._renderedChildren;
26310 // Remove any rendered children.
26311 ReactChildReconciler.unmountChildren(prevChildren, false);
26312 for (var name in prevChildren) {
26313 if (prevChildren.hasOwnProperty(name)) {
26314 !false ? process.env.NODE_ENV !== 'production' ? invariant(false, 'updateTextContent called on non-empty component.') : invariant(false) : void 0;
26315 }
26316 }
26317 // Set new text content.
26318 var updates = [makeTextContent(nextContent)];
26319 processQueue(this, updates);
26320 },
26321
26322 /**
26323 * Replaces any rendered children with a markup string.
26324 *
26325 * @param {string} nextMarkup String of markup.
26326 * @internal
26327 */
26328 updateMarkup: function (nextMarkup) {
26329 var prevChildren = this._renderedChildren;
26330 // Remove any rendered children.
26331 ReactChildReconciler.unmountChildren(prevChildren, false);
26332 for (var name in prevChildren) {
26333 if (prevChildren.hasOwnProperty(name)) {
26334 !false ? process.env.NODE_ENV !== 'production' ? invariant(false, 'updateTextContent called on non-empty component.') : invariant(false) : void 0;
26335 }
26336 }
26337 var updates = [makeSetMarkup(nextMarkup)];
26338 processQueue(this, updates);
26339 },
26340
26341 /**
26342 * Updates the rendered children with new children.
26343 *
26344 * @param {?object} nextNestedChildrenElements Nested child element maps.
26345 * @param {ReactReconcileTransaction} transaction
26346 * @internal
26347 */
26348 updateChildren: function (nextNestedChildrenElements, transaction, context) {
26349 // Hook used by React ART
26350 this._updateChildren(nextNestedChildrenElements, transaction, context);
26351 },
26352
26353 /**
26354 * @param {?object} nextNestedChildrenElements Nested child element maps.
26355 * @param {ReactReconcileTransaction} transaction
26356 * @final
26357 * @protected
26358 */
26359 _updateChildren: function (nextNestedChildrenElements, transaction, context) {
26360 var prevChildren = this._renderedChildren;
26361 var removedNodes = {};
26362 var nextChildren = this._reconcilerUpdateChildren(prevChildren, nextNestedChildrenElements, removedNodes, transaction, context);
26363 if (!nextChildren && !prevChildren) {
26364 return;
26365 }
26366 var updates = null;
26367 var name;
26368 // `nextIndex` will increment for each child in `nextChildren`, but
26369 // `lastIndex` will be the last index visited in `prevChildren`.
26370 var lastIndex = 0;
26371 var nextIndex = 0;
26372 var lastPlacedNode = null;
26373 for (name in nextChildren) {
26374 if (!nextChildren.hasOwnProperty(name)) {
26375 continue;
26376 }
26377 var prevChild = prevChildren && prevChildren[name];
26378 var nextChild = nextChildren[name];
26379 if (prevChild === nextChild) {
26380 updates = enqueue(updates, this.moveChild(prevChild, lastPlacedNode, nextIndex, lastIndex));
26381 lastIndex = Math.max(prevChild._mountIndex, lastIndex);
26382 prevChild._mountIndex = nextIndex;
26383 } else {
26384 if (prevChild) {
26385 // Update `lastIndex` before `_mountIndex` gets unset by unmounting.
26386 lastIndex = Math.max(prevChild._mountIndex, lastIndex);
26387 // The `removedNodes` loop below will actually remove the child.
26388 }
26389 // The child must be instantiated before it's mounted.
26390 updates = enqueue(updates, this._mountChildAtIndex(nextChild, lastPlacedNode, nextIndex, transaction, context));
26391 }
26392 nextIndex++;
26393 lastPlacedNode = ReactReconciler.getNativeNode(nextChild);
26394 }
26395 // Remove children that are no longer present.
26396 for (name in removedNodes) {
26397 if (removedNodes.hasOwnProperty(name)) {
26398 updates = enqueue(updates, this._unmountChild(prevChildren[name], removedNodes[name]));
26399 }
26400 }
26401 if (updates) {
26402 processQueue(this, updates);
26403 }
26404 this._renderedChildren = nextChildren;
26405
26406 if (process.env.NODE_ENV !== 'production') {
26407 setChildrenForInstrumentation.call(this, nextChildren);
26408 }
26409 },
26410
26411 /**
26412 * Unmounts all rendered children. This should be used to clean up children
26413 * when this component is unmounted. It does not actually perform any
26414 * backend operations.
26415 *
26416 * @internal
26417 */
26418 unmountChildren: function (safely) {
26419 var renderedChildren = this._renderedChildren;
26420 ReactChildReconciler.unmountChildren(renderedChildren, safely);
26421 this._renderedChildren = null;
26422 },
26423
26424 /**
26425 * Moves a child component to the supplied index.
26426 *
26427 * @param {ReactComponent} child Component to move.
26428 * @param {number} toIndex Destination index of the element.
26429 * @param {number} lastIndex Last index visited of the siblings of `child`.
26430 * @protected
26431 */
26432 moveChild: function (child, afterNode, toIndex, lastIndex) {
26433 // If the index of `child` is less than `lastIndex`, then it needs to
26434 // be moved. Otherwise, we do not need to move it because a child will be
26435 // inserted or moved before `child`.
26436 if (child._mountIndex < lastIndex) {
26437 return makeMove(child, afterNode, toIndex);
26438 }
26439 },
26440
26441 /**
26442 * Creates a child component.
26443 *
26444 * @param {ReactComponent} child Component to create.
26445 * @param {string} mountImage Markup to insert.
26446 * @protected
26447 */
26448 createChild: function (child, afterNode, mountImage) {
26449 return makeInsertMarkup(mountImage, afterNode, child._mountIndex);
26450 },
26451
26452 /**
26453 * Removes a child component.
26454 *
26455 * @param {ReactComponent} child Child to remove.
26456 * @protected
26457 */
26458 removeChild: function (child, node) {
26459 return makeRemove(child, node);
26460 },
26461
26462 /**
26463 * Mounts a child with the supplied name.
26464 *
26465 * NOTE: This is part of `updateChildren` and is here for readability.
26466 *
26467 * @param {ReactComponent} child Component to mount.
26468 * @param {string} name Name of the child.
26469 * @param {number} index Index at which to insert the child.
26470 * @param {ReactReconcileTransaction} transaction
26471 * @private
26472 */
26473 _mountChildAtIndex: function (child, afterNode, index, transaction, context) {
26474 var mountImage = ReactReconciler.mountComponent(child, transaction, this, this._nativeContainerInfo, context);
26475 child._mountIndex = index;
26476 return this.createChild(child, afterNode, mountImage);
26477 },
26478
26479 /**
26480 * Unmounts a rendered child.
26481 *
26482 * NOTE: This is part of `updateChildren` and is here for readability.
26483 *
26484 * @param {ReactComponent} child Component to unmount.
26485 * @private
26486 */
26487 _unmountChild: function (child, node) {
26488 var update = this.removeChild(child, node);
26489 child._mountIndex = null;
26490 return update;
26491 }
26492
26493 }
26494
26495};
26496
26497module.exports = ReactMultiChild;
26498}).call(this,require(91))
26499},{"186":186,"191":191,"194":194,"228":228,"233":233,"243":243,"274":274,"37":37,"45":45,"91":91}],233:[function(require,module,exports){
26500/**
26501 * Copyright 2013-present, Facebook, Inc.
26502 * All rights reserved.
26503 *
26504 * This source code is licensed under the BSD-style license found in the
26505 * LICENSE file in the root directory of this source tree. An additional grant
26506 * of patent rights can be found in the PATENTS file in the same directory.
26507 *
26508 * @providesModule ReactMultiChildUpdateTypes
26509 */
26510
26511'use strict';
26512
26513var keyMirror = require(48);
26514
26515/**
26516 * When a component's children are updated, a series of update configuration
26517 * objects are created in order to batch and serialize the required changes.
26518 *
26519 * Enumerates all the possible types of update configurations.
26520 *
26521 * @internal
26522 */
26523var ReactMultiChildUpdateTypes = keyMirror({
26524 INSERT_MARKUP: null,
26525 MOVE_EXISTING: null,
26526 REMOVE_NODE: null,
26527 SET_MARKUP: null,
26528 TEXT_CONTENT: null
26529});
26530
26531module.exports = ReactMultiChildUpdateTypes;
26532},{"48":48}],234:[function(require,module,exports){
26533(function (process){
26534/**
26535 * Copyright 2014-present, Facebook, Inc.
26536 * All rights reserved.
26537 *
26538 * This source code is licensed under the BSD-style license found in the
26539 * LICENSE file in the root directory of this source tree. An additional grant
26540 * of patent rights can be found in the PATENTS file in the same directory.
26541 *
26542 * @providesModule ReactNativeComponent
26543 */
26544
26545'use strict';
26546
26547var _assign = require(296);
26548
26549var invariant = require(45);
26550
26551var autoGenerateWrapperClass = null;
26552var genericComponentClass = null;
26553// This registry keeps track of wrapper classes around native tags.
26554var tagToComponentClass = {};
26555var textComponentClass = null;
26556
26557var ReactNativeComponentInjection = {
26558 // This accepts a class that receives the tag string. This is a catch all
26559 // that can render any kind of tag.
26560 injectGenericComponentClass: function (componentClass) {
26561 genericComponentClass = componentClass;
26562 },
26563 // This accepts a text component class that takes the text string to be
26564 // rendered as props.
26565 injectTextComponentClass: function (componentClass) {
26566 textComponentClass = componentClass;
26567 },
26568 // This accepts a keyed object with classes as values. Each key represents a
26569 // tag. That particular tag will use this class instead of the generic one.
26570 injectComponentClasses: function (componentClasses) {
26571 _assign(tagToComponentClass, componentClasses);
26572 }
26573};
26574
26575/**
26576 * Get a composite component wrapper class for a specific tag.
26577 *
26578 * @param {ReactElement} element The tag for which to get the class.
26579 * @return {function} The React class constructor function.
26580 */
26581function getComponentClassForElement(element) {
26582 if (typeof element.type === 'function') {
26583 return element.type;
26584 }
26585 var tag = element.type;
26586 var componentClass = tagToComponentClass[tag];
26587 if (componentClass == null) {
26588 tagToComponentClass[tag] = componentClass = autoGenerateWrapperClass(tag);
26589 }
26590 return componentClass;
26591}
26592
26593/**
26594 * Get a native internal component class for a specific tag.
26595 *
26596 * @param {ReactElement} element The element to create.
26597 * @return {function} The internal class constructor function.
26598 */
26599function createInternalComponent(element) {
26600 !genericComponentClass ? process.env.NODE_ENV !== 'production' ? invariant(false, 'There is no registered component for the tag %s', element.type) : invariant(false) : void 0;
26601 return new genericComponentClass(element);
26602}
26603
26604/**
26605 * @param {ReactText} text
26606 * @return {ReactComponent}
26607 */
26608function createInstanceForText(text) {
26609 return new textComponentClass(text);
26610}
26611
26612/**
26613 * @param {ReactComponent} component
26614 * @return {boolean}
26615 */
26616function isTextComponent(component) {
26617 return component instanceof textComponentClass;
26618}
26619
26620var ReactNativeComponent = {
26621 getComponentClassForElement: getComponentClassForElement,
26622 createInternalComponent: createInternalComponent,
26623 createInstanceForText: createInstanceForText,
26624 isTextComponent: isTextComponent,
26625 injection: ReactNativeComponentInjection
26626};
26627
26628module.exports = ReactNativeComponent;
26629}).call(this,require(91))
26630},{"296":296,"45":45,"91":91}],235:[function(require,module,exports){
26631/**
26632 * Copyright 2016-present, Facebook, Inc.
26633 * All rights reserved.
26634 *
26635 * This source code is licensed under the BSD-style license found in the
26636 * LICENSE file in the root directory of this source tree. An additional grant
26637 * of patent rights can be found in the PATENTS file in the same directory.
26638 *
26639 * @providesModule ReactNativeOperationHistoryDevtool
26640 */
26641
26642'use strict';
26643
26644var history = [];
26645
26646var ReactNativeOperationHistoryDevtool = {
26647 onNativeOperation: function (debugID, type, payload) {
26648 history.push({
26649 instanceID: debugID,
26650 type: type,
26651 payload: payload
26652 });
26653 },
26654 clearHistory: function () {
26655 if (ReactNativeOperationHistoryDevtool._preventClearing) {
26656 // Should only be used for tests.
26657 return;
26658 }
26659
26660 history = [];
26661 },
26662 getHistory: function () {
26663 return history;
26664 }
26665};
26666
26667module.exports = ReactNativeOperationHistoryDevtool;
26668},{}],236:[function(require,module,exports){
26669(function (process){
26670/**
26671 * Copyright 2013-present, Facebook, Inc.
26672 * All rights reserved.
26673 *
26674 * This source code is licensed under the BSD-style license found in the
26675 * LICENSE file in the root directory of this source tree. An additional grant
26676 * of patent rights can be found in the PATENTS file in the same directory.
26677 *
26678 * @providesModule ReactNodeTypes
26679 */
26680
26681'use strict';
26682
26683var ReactElement = require(218);
26684
26685var invariant = require(45);
26686
26687var ReactNodeTypes = {
26688 NATIVE: 0,
26689 COMPOSITE: 1,
26690 EMPTY: 2,
26691
26692 getType: function (node) {
26693 if (node === null || node === false) {
26694 return ReactNodeTypes.EMPTY;
26695 } else if (ReactElement.isValidElement(node)) {
26696 if (typeof node.type === 'function') {
26697 return ReactNodeTypes.COMPOSITE;
26698 } else {
26699 return ReactNodeTypes.NATIVE;
26700 }
26701 }
26702 !false ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Unexpected node: %s', node) : invariant(false) : void 0;
26703 }
26704};
26705
26706module.exports = ReactNodeTypes;
26707}).call(this,require(91))
26708},{"218":218,"45":45,"91":91}],237:[function(require,module,exports){
26709(function (process){
26710/**
26711 * Copyright 2015-present, Facebook, Inc.
26712 * All rights reserved.
26713 *
26714 * This source code is licensed under the BSD-style license found in the
26715 * LICENSE file in the root directory of this source tree. An additional grant
26716 * of patent rights can be found in the PATENTS file in the same directory.
26717 *
26718 * @providesModule ReactNoopUpdateQueue
26719 */
26720
26721'use strict';
26722
26723var warning = require(55);
26724
26725function warnTDZ(publicInstance, callerName) {
26726 if (process.env.NODE_ENV !== 'production') {
26727 process.env.NODE_ENV !== 'production' ? warning(false, '%s(...): Can only update a mounted or mounting component. ' + 'This usually means you called %s() on an unmounted component. ' + 'This is a no-op. Please check the code for the %s component.', callerName, callerName, publicInstance.constructor && publicInstance.constructor.displayName || '') : void 0;
26728 }
26729}
26730
26731/**
26732 * This is the abstract API for an update queue.
26733 */
26734var ReactNoopUpdateQueue = {
26735
26736 /**
26737 * Checks whether or not this composite component is mounted.
26738 * @param {ReactClass} publicInstance The instance we want to test.
26739 * @return {boolean} True if mounted, false otherwise.
26740 * @protected
26741 * @final
26742 */
26743 isMounted: function (publicInstance) {
26744 return false;
26745 },
26746
26747 /**
26748 * Enqueue a callback that will be executed after all the pending updates
26749 * have processed.
26750 *
26751 * @param {ReactClass} publicInstance The instance to use as `this` context.
26752 * @param {?function} callback Called after state is updated.
26753 * @internal
26754 */
26755 enqueueCallback: function (publicInstance, callback) {},
26756
26757 /**
26758 * Forces an update. This should only be invoked when it is known with
26759 * certainty that we are **not** in a DOM transaction.
26760 *
26761 * You may want to call this when you know that some deeper aspect of the
26762 * component's state has changed but `setState` was not called.
26763 *
26764 * This will not invoke `shouldComponentUpdate`, but it will invoke
26765 * `componentWillUpdate` and `componentDidUpdate`.
26766 *
26767 * @param {ReactClass} publicInstance The instance that should rerender.
26768 * @internal
26769 */
26770 enqueueForceUpdate: function (publicInstance) {
26771 warnTDZ(publicInstance, 'forceUpdate');
26772 },
26773
26774 /**
26775 * Replaces all of the state. Always use this or `setState` to mutate state.
26776 * You should treat `this.state` as immutable.
26777 *
26778 * There is no guarantee that `this.state` will be immediately updated, so
26779 * accessing `this.state` after calling this method may return the old value.
26780 *
26781 * @param {ReactClass} publicInstance The instance that should rerender.
26782 * @param {object} completeState Next state.
26783 * @internal
26784 */
26785 enqueueReplaceState: function (publicInstance, completeState) {
26786 warnTDZ(publicInstance, 'replaceState');
26787 },
26788
26789 /**
26790 * Sets a subset of the state. This only exists because _pendingState is
26791 * internal. This provides a merging strategy that is not available to deep
26792 * properties which is confusing. TODO: Expose pendingState or don't use it
26793 * during the merge.
26794 *
26795 * @param {ReactClass} publicInstance The instance that should rerender.
26796 * @param {object} partialState Next partial state to be merged with state.
26797 * @internal
26798 */
26799 enqueueSetState: function (publicInstance, partialState) {
26800 warnTDZ(publicInstance, 'setState');
26801 }
26802};
26803
26804module.exports = ReactNoopUpdateQueue;
26805}).call(this,require(91))
26806},{"55":55,"91":91}],238:[function(require,module,exports){
26807(function (process){
26808/**
26809 * Copyright 2013-present, Facebook, Inc.
26810 * All rights reserved.
26811 *
26812 * This source code is licensed under the BSD-style license found in the
26813 * LICENSE file in the root directory of this source tree. An additional grant
26814 * of patent rights can be found in the PATENTS file in the same directory.
26815 *
26816 * @providesModule ReactOwner
26817 */
26818
26819'use strict';
26820
26821var invariant = require(45);
26822
26823/**
26824 * ReactOwners are capable of storing references to owned components.
26825 *
26826 * All components are capable of //being// referenced by owner components, but
26827 * only ReactOwner components are capable of //referencing// owned components.
26828 * The named reference is known as a "ref".
26829 *
26830 * Refs are available when mounted and updated during reconciliation.
26831 *
26832 * var MyComponent = React.createClass({
26833 * render: function() {
26834 * return (
26835 * <div onClick={this.handleClick}>
26836 * <CustomComponent ref="custom" />
26837 * </div>
26838 * );
26839 * },
26840 * handleClick: function() {
26841 * this.refs.custom.handleClick();
26842 * },
26843 * componentDidMount: function() {
26844 * this.refs.custom.initialize();
26845 * }
26846 * });
26847 *
26848 * Refs should rarely be used. When refs are used, they should only be done to
26849 * control data that is not handled by React's data flow.
26850 *
26851 * @class ReactOwner
26852 */
26853var ReactOwner = {
26854
26855 /**
26856 * @param {?object} object
26857 * @return {boolean} True if `object` is a valid owner.
26858 * @final
26859 */
26860 isValidOwner: function (object) {
26861 return !!(object && typeof object.attachRef === 'function' && typeof object.detachRef === 'function');
26862 },
26863
26864 /**
26865 * Adds a component by ref to an owner component.
26866 *
26867 * @param {ReactComponent} component Component to reference.
26868 * @param {string} ref Name by which to refer to the component.
26869 * @param {ReactOwner} owner Component on which to record the ref.
26870 * @final
26871 * @internal
26872 */
26873 addComponentAsRefTo: function (component, ref, owner) {
26874 !ReactOwner.isValidOwner(owner) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'addComponentAsRefTo(...): Only a ReactOwner can have refs. You might ' + 'be adding a ref to a component that was not created inside a component\'s ' + '`render` method, or you have multiple copies of React loaded ' + '(details: https://fb.me/react-refs-must-have-owner).') : invariant(false) : void 0;
26875 owner.attachRef(ref, component);
26876 },
26877
26878 /**
26879 * Removes a component by ref from an owner component.
26880 *
26881 * @param {ReactComponent} component Component to dereference.
26882 * @param {string} ref Name of the ref to remove.
26883 * @param {ReactOwner} owner Component on which the ref is recorded.
26884 * @final
26885 * @internal
26886 */
26887 removeComponentAsRefFrom: function (component, ref, owner) {
26888 !ReactOwner.isValidOwner(owner) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'removeComponentAsRefFrom(...): Only a ReactOwner can have refs. You might ' + 'be removing a ref to a component that was not created inside a component\'s ' + '`render` method, or you have multiple copies of React loaded ' + '(details: https://fb.me/react-refs-must-have-owner).') : invariant(false) : void 0;
26889 var ownerPublicInstance = owner.getPublicInstance();
26890 // Check that `component`'s owner is still alive and that `component` is still the current ref
26891 // because we do not want to detach the ref if another component stole it.
26892 if (ownerPublicInstance && ownerPublicInstance.refs[ref] === component.getPublicInstance()) {
26893 owner.detachRef(ref);
26894 }
26895 }
26896
26897};
26898
26899module.exports = ReactOwner;
26900}).call(this,require(91))
26901},{"45":45,"91":91}],239:[function(require,module,exports){
26902(function (process){
26903/**
26904 * Copyright 2013-present, Facebook, Inc.
26905 * All rights reserved.
26906 *
26907 * This source code is licensed under the BSD-style license found in the
26908 * LICENSE file in the root directory of this source tree. An additional grant
26909 * of patent rights can be found in the PATENTS file in the same directory.
26910 *
26911 * @providesModule ReactPropTypeLocationNames
26912 */
26913
26914'use strict';
26915
26916var ReactPropTypeLocationNames = {};
26917
26918if (process.env.NODE_ENV !== 'production') {
26919 ReactPropTypeLocationNames = {
26920 prop: 'prop',
26921 context: 'context',
26922 childContext: 'child context'
26923 };
26924}
26925
26926module.exports = ReactPropTypeLocationNames;
26927}).call(this,require(91))
26928},{"91":91}],240:[function(require,module,exports){
26929/**
26930 * Copyright 2013-present, Facebook, Inc.
26931 * All rights reserved.
26932 *
26933 * This source code is licensed under the BSD-style license found in the
26934 * LICENSE file in the root directory of this source tree. An additional grant
26935 * of patent rights can be found in the PATENTS file in the same directory.
26936 *
26937 * @providesModule ReactPropTypeLocations
26938 */
26939
26940'use strict';
26941
26942var keyMirror = require(48);
26943
26944var ReactPropTypeLocations = keyMirror({
26945 prop: null,
26946 context: null,
26947 childContext: null
26948});
26949
26950module.exports = ReactPropTypeLocations;
26951},{"48":48}],241:[function(require,module,exports){
26952/**
26953 * Copyright 2013-present, Facebook, Inc.
26954 * All rights reserved.
26955 *
26956 * This source code is licensed under the BSD-style license found in the
26957 * LICENSE file in the root directory of this source tree. An additional grant
26958 * of patent rights can be found in the PATENTS file in the same directory.
26959 *
26960 * @providesModule ReactPropTypes
26961 */
26962
26963'use strict';
26964
26965var ReactElement = require(218);
26966var ReactPropTypeLocationNames = require(239);
26967
26968var emptyFunction = require(37);
26969var getIteratorFn = require(280);
26970
26971/**
26972 * Collection of methods that allow declaration and validation of props that are
26973 * supplied to React components. Example usage:
26974 *
26975 * var Props = require('ReactPropTypes');
26976 * var MyArticle = React.createClass({
26977 * propTypes: {
26978 * // An optional string prop named "description".
26979 * description: Props.string,
26980 *
26981 * // A required enum prop named "category".
26982 * category: Props.oneOf(['News','Photos']).isRequired,
26983 *
26984 * // A prop named "dialog" that requires an instance of Dialog.
26985 * dialog: Props.instanceOf(Dialog).isRequired
26986 * },
26987 * render: function() { ... }
26988 * });
26989 *
26990 * A more formal specification of how these methods are used:
26991 *
26992 * type := array|bool|func|object|number|string|oneOf([...])|instanceOf(...)
26993 * decl := ReactPropTypes.{type}(.isRequired)?
26994 *
26995 * Each and every declaration produces a function with the same signature. This
26996 * allows the creation of custom validation functions. For example:
26997 *
26998 * var MyLink = React.createClass({
26999 * propTypes: {
27000 * // An optional string or URI prop named "href".
27001 * href: function(props, propName, componentName) {
27002 * var propValue = props[propName];
27003 * if (propValue != null && typeof propValue !== 'string' &&
27004 * !(propValue instanceof URI)) {
27005 * return new Error(
27006 * 'Expected a string or an URI for ' + propName + ' in ' +
27007 * componentName
27008 * );
27009 * }
27010 * }
27011 * },
27012 * render: function() {...}
27013 * });
27014 *
27015 * @internal
27016 */
27017
27018var ANONYMOUS = '<<anonymous>>';
27019
27020var ReactPropTypes = {
27021 array: createPrimitiveTypeChecker('array'),
27022 bool: createPrimitiveTypeChecker('boolean'),
27023 func: createPrimitiveTypeChecker('function'),
27024 number: createPrimitiveTypeChecker('number'),
27025 object: createPrimitiveTypeChecker('object'),
27026 string: createPrimitiveTypeChecker('string'),
27027
27028 any: createAnyTypeChecker(),
27029 arrayOf: createArrayOfTypeChecker,
27030 element: createElementTypeChecker(),
27031 instanceOf: createInstanceTypeChecker,
27032 node: createNodeChecker(),
27033 objectOf: createObjectOfTypeChecker,
27034 oneOf: createEnumTypeChecker,
27035 oneOfType: createUnionTypeChecker,
27036 shape: createShapeTypeChecker
27037};
27038
27039/**
27040 * inlined Object.is polyfill to avoid requiring consumers ship their own
27041 * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is
27042 */
27043/*eslint-disable no-self-compare*/
27044function is(x, y) {
27045 // SameValue algorithm
27046 if (x === y) {
27047 // Steps 1-5, 7-10
27048 // Steps 6.b-6.e: +0 != -0
27049 return x !== 0 || 1 / x === 1 / y;
27050 } else {
27051 // Step 6.a: NaN == NaN
27052 return x !== x && y !== y;
27053 }
27054}
27055/*eslint-enable no-self-compare*/
27056
27057function createChainableTypeChecker(validate) {
27058 function checkType(isRequired, props, propName, componentName, location, propFullName) {
27059 componentName = componentName || ANONYMOUS;
27060 propFullName = propFullName || propName;
27061 if (props[propName] == null) {
27062 var locationName = ReactPropTypeLocationNames[location];
27063 if (isRequired) {
27064 return new Error('Required ' + locationName + ' `' + propFullName + '` was not specified in ' + ('`' + componentName + '`.'));
27065 }
27066 return null;
27067 } else {
27068 return validate(props, propName, componentName, location, propFullName);
27069 }
27070 }
27071
27072 var chainedCheckType = checkType.bind(null, false);
27073 chainedCheckType.isRequired = checkType.bind(null, true);
27074
27075 return chainedCheckType;
27076}
27077
27078function createPrimitiveTypeChecker(expectedType) {
27079 function validate(props, propName, componentName, location, propFullName) {
27080 var propValue = props[propName];
27081 var propType = getPropType(propValue);
27082 if (propType !== expectedType) {
27083 var locationName = ReactPropTypeLocationNames[location];
27084 // `propValue` being instance of, say, date/regexp, pass the 'object'
27085 // check, but we can offer a more precise error message here rather than
27086 // 'of type `object`'.
27087 var preciseType = getPreciseType(propValue);
27088
27089 return new Error('Invalid ' + locationName + ' `' + propFullName + '` of type ' + ('`' + preciseType + '` supplied to `' + componentName + '`, expected ') + ('`' + expectedType + '`.'));
27090 }
27091 return null;
27092 }
27093 return createChainableTypeChecker(validate);
27094}
27095
27096function createAnyTypeChecker() {
27097 return createChainableTypeChecker(emptyFunction.thatReturns(null));
27098}
27099
27100function createArrayOfTypeChecker(typeChecker) {
27101 function validate(props, propName, componentName, location, propFullName) {
27102 if (typeof typeChecker !== 'function') {
27103 return new Error('Property `' + propFullName + '` of component `' + componentName + '` has invalid PropType notation inside arrayOf.');
27104 }
27105 var propValue = props[propName];
27106 if (!Array.isArray(propValue)) {
27107 var locationName = ReactPropTypeLocationNames[location];
27108 var propType = getPropType(propValue);
27109 return new Error('Invalid ' + locationName + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected an array.'));
27110 }
27111 for (var i = 0; i < propValue.length; i++) {
27112 var error = typeChecker(propValue, i, componentName, location, propFullName + '[' + i + ']');
27113 if (error instanceof Error) {
27114 return error;
27115 }
27116 }
27117 return null;
27118 }
27119 return createChainableTypeChecker(validate);
27120}
27121
27122function createElementTypeChecker() {
27123 function validate(props, propName, componentName, location, propFullName) {
27124 if (!ReactElement.isValidElement(props[propName])) {
27125 var locationName = ReactPropTypeLocationNames[location];
27126 return new Error('Invalid ' + locationName + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`, expected a single ReactElement.'));
27127 }
27128 return null;
27129 }
27130 return createChainableTypeChecker(validate);
27131}
27132
27133function createInstanceTypeChecker(expectedClass) {
27134 function validate(props, propName, componentName, location, propFullName) {
27135 if (!(props[propName] instanceof expectedClass)) {
27136 var locationName = ReactPropTypeLocationNames[location];
27137 var expectedClassName = expectedClass.name || ANONYMOUS;
27138 var actualClassName = getClassName(props[propName]);
27139 return new Error('Invalid ' + locationName + ' `' + propFullName + '` of type ' + ('`' + actualClassName + '` supplied to `' + componentName + '`, expected ') + ('instance of `' + expectedClassName + '`.'));
27140 }
27141 return null;
27142 }
27143 return createChainableTypeChecker(validate);
27144}
27145
27146function createEnumTypeChecker(expectedValues) {
27147 if (!Array.isArray(expectedValues)) {
27148 return createChainableTypeChecker(function () {
27149 return new Error('Invalid argument supplied to oneOf, expected an instance of array.');
27150 });
27151 }
27152
27153 function validate(props, propName, componentName, location, propFullName) {
27154 var propValue = props[propName];
27155 for (var i = 0; i < expectedValues.length; i++) {
27156 if (is(propValue, expectedValues[i])) {
27157 return null;
27158 }
27159 }
27160
27161 var locationName = ReactPropTypeLocationNames[location];
27162 var valuesString = JSON.stringify(expectedValues);
27163 return new Error('Invalid ' + locationName + ' `' + propFullName + '` of value `' + propValue + '` ' + ('supplied to `' + componentName + '`, expected one of ' + valuesString + '.'));
27164 }
27165 return createChainableTypeChecker(validate);
27166}
27167
27168function createObjectOfTypeChecker(typeChecker) {
27169 function validate(props, propName, componentName, location, propFullName) {
27170 if (typeof typeChecker !== 'function') {
27171 return new Error('Property `' + propFullName + '` of component `' + componentName + '` has invalid PropType notation inside objectOf.');
27172 }
27173 var propValue = props[propName];
27174 var propType = getPropType(propValue);
27175 if (propType !== 'object') {
27176 var locationName = ReactPropTypeLocationNames[location];
27177 return new Error('Invalid ' + locationName + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected an object.'));
27178 }
27179 for (var key in propValue) {
27180 if (propValue.hasOwnProperty(key)) {
27181 var error = typeChecker(propValue, key, componentName, location, propFullName + '.' + key);
27182 if (error instanceof Error) {
27183 return error;
27184 }
27185 }
27186 }
27187 return null;
27188 }
27189 return createChainableTypeChecker(validate);
27190}
27191
27192function createUnionTypeChecker(arrayOfTypeCheckers) {
27193 if (!Array.isArray(arrayOfTypeCheckers)) {
27194 return createChainableTypeChecker(function () {
27195 return new Error('Invalid argument supplied to oneOfType, expected an instance of array.');
27196 });
27197 }
27198
27199 function validate(props, propName, componentName, location, propFullName) {
27200 for (var i = 0; i < arrayOfTypeCheckers.length; i++) {
27201 var checker = arrayOfTypeCheckers[i];
27202 if (checker(props, propName, componentName, location, propFullName) == null) {
27203 return null;
27204 }
27205 }
27206
27207 var locationName = ReactPropTypeLocationNames[location];
27208 return new Error('Invalid ' + locationName + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`.'));
27209 }
27210 return createChainableTypeChecker(validate);
27211}
27212
27213function createNodeChecker() {
27214 function validate(props, propName, componentName, location, propFullName) {
27215 if (!isNode(props[propName])) {
27216 var locationName = ReactPropTypeLocationNames[location];
27217 return new Error('Invalid ' + locationName + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`, expected a ReactNode.'));
27218 }
27219 return null;
27220 }
27221 return createChainableTypeChecker(validate);
27222}
27223
27224function createShapeTypeChecker(shapeTypes) {
27225 function validate(props, propName, componentName, location, propFullName) {
27226 var propValue = props[propName];
27227 var propType = getPropType(propValue);
27228 if (propType !== 'object') {
27229 var locationName = ReactPropTypeLocationNames[location];
27230 return new Error('Invalid ' + locationName + ' `' + propFullName + '` of type `' + propType + '` ' + ('supplied to `' + componentName + '`, expected `object`.'));
27231 }
27232 for (var key in shapeTypes) {
27233 var checker = shapeTypes[key];
27234 if (!checker) {
27235 continue;
27236 }
27237 var error = checker(propValue, key, componentName, location, propFullName + '.' + key);
27238 if (error) {
27239 return error;
27240 }
27241 }
27242 return null;
27243 }
27244 return createChainableTypeChecker(validate);
27245}
27246
27247function isNode(propValue) {
27248 switch (typeof propValue) {
27249 case 'number':
27250 case 'string':
27251 case 'undefined':
27252 return true;
27253 case 'boolean':
27254 return !propValue;
27255 case 'object':
27256 if (Array.isArray(propValue)) {
27257 return propValue.every(isNode);
27258 }
27259 if (propValue === null || ReactElement.isValidElement(propValue)) {
27260 return true;
27261 }
27262
27263 var iteratorFn = getIteratorFn(propValue);
27264 if (iteratorFn) {
27265 var iterator = iteratorFn.call(propValue);
27266 var step;
27267 if (iteratorFn !== propValue.entries) {
27268 while (!(step = iterator.next()).done) {
27269 if (!isNode(step.value)) {
27270 return false;
27271 }
27272 }
27273 } else {
27274 // Iterator will provide entry [k,v] tuples rather than values.
27275 while (!(step = iterator.next()).done) {
27276 var entry = step.value;
27277 if (entry) {
27278 if (!isNode(entry[1])) {
27279 return false;
27280 }
27281 }
27282 }
27283 }
27284 } else {
27285 return false;
27286 }
27287
27288 return true;
27289 default:
27290 return false;
27291 }
27292}
27293
27294// Equivalent of `typeof` but with special handling for array and regexp.
27295function getPropType(propValue) {
27296 var propType = typeof propValue;
27297 if (Array.isArray(propValue)) {
27298 return 'array';
27299 }
27300 if (propValue instanceof RegExp) {
27301 // Old webkits (at least until Android 4.0) return 'function' rather than
27302 // 'object' for typeof a RegExp. We'll normalize this here so that /bla/
27303 // passes PropTypes.object.
27304 return 'object';
27305 }
27306 return propType;
27307}
27308
27309// This handles more types than `getPropType`. Only used for error messages.
27310// See `createPrimitiveTypeChecker`.
27311function getPreciseType(propValue) {
27312 var propType = getPropType(propValue);
27313 if (propType === 'object') {
27314 if (propValue instanceof Date) {
27315 return 'date';
27316 } else if (propValue instanceof RegExp) {
27317 return 'regexp';
27318 }
27319 }
27320 return propType;
27321}
27322
27323// Returns class name of the object, if any.
27324function getClassName(propValue) {
27325 if (!propValue.constructor || !propValue.constructor.name) {
27326 return ANONYMOUS;
27327 }
27328 return propValue.constructor.name;
27329}
27330
27331module.exports = ReactPropTypes;
27332},{"218":218,"239":239,"280":280,"37":37}],242:[function(require,module,exports){
27333/**
27334 * Copyright 2013-present, Facebook, Inc.
27335 * All rights reserved.
27336 *
27337 * This source code is licensed under the BSD-style license found in the
27338 * LICENSE file in the root directory of this source tree. An additional grant
27339 * of patent rights can be found in the PATENTS file in the same directory.
27340 *
27341 * @providesModule ReactReconcileTransaction
27342 */
27343
27344'use strict';
27345
27346var _assign = require(296);
27347
27348var CallbackQueue = require(163);
27349var PooledClass = require(183);
27350var ReactBrowserEventEmitter = require(185);
27351var ReactInputSelection = require(226);
27352var Transaction = require(265);
27353
27354/**
27355 * Ensures that, when possible, the selection range (currently selected text
27356 * input) is not disturbed by performing the transaction.
27357 */
27358var SELECTION_RESTORATION = {
27359 /**
27360 * @return {Selection} Selection information.
27361 */
27362 initialize: ReactInputSelection.getSelectionInformation,
27363 /**
27364 * @param {Selection} sel Selection information returned from `initialize`.
27365 */
27366 close: ReactInputSelection.restoreSelection
27367};
27368
27369/**
27370 * Suppresses events (blur/focus) that could be inadvertently dispatched due to
27371 * high level DOM manipulations (like temporarily removing a text input from the
27372 * DOM).
27373 */
27374var EVENT_SUPPRESSION = {
27375 /**
27376 * @return {boolean} The enabled status of `ReactBrowserEventEmitter` before
27377 * the reconciliation.
27378 */
27379 initialize: function () {
27380 var currentlyEnabled = ReactBrowserEventEmitter.isEnabled();
27381 ReactBrowserEventEmitter.setEnabled(false);
27382 return currentlyEnabled;
27383 },
27384
27385 /**
27386 * @param {boolean} previouslyEnabled Enabled status of
27387 * `ReactBrowserEventEmitter` before the reconciliation occurred. `close`
27388 * restores the previous value.
27389 */
27390 close: function (previouslyEnabled) {
27391 ReactBrowserEventEmitter.setEnabled(previouslyEnabled);
27392 }
27393};
27394
27395/**
27396 * Provides a queue for collecting `componentDidMount` and
27397 * `componentDidUpdate` callbacks during the transaction.
27398 */
27399var ON_DOM_READY_QUEUEING = {
27400 /**
27401 * Initializes the internal `onDOMReady` queue.
27402 */
27403 initialize: function () {
27404 this.reactMountReady.reset();
27405 },
27406
27407 /**
27408 * After DOM is flushed, invoke all registered `onDOMReady` callbacks.
27409 */
27410 close: function () {
27411 this.reactMountReady.notifyAll();
27412 }
27413};
27414
27415/**
27416 * Executed within the scope of the `Transaction` instance. Consider these as
27417 * being member methods, but with an implied ordering while being isolated from
27418 * each other.
27419 */
27420var TRANSACTION_WRAPPERS = [SELECTION_RESTORATION, EVENT_SUPPRESSION, ON_DOM_READY_QUEUEING];
27421
27422/**
27423 * Currently:
27424 * - The order that these are listed in the transaction is critical:
27425 * - Suppresses events.
27426 * - Restores selection range.
27427 *
27428 * Future:
27429 * - Restore document/overflow scroll positions that were unintentionally
27430 * modified via DOM insertions above the top viewport boundary.
27431 * - Implement/integrate with customized constraint based layout system and keep
27432 * track of which dimensions must be remeasured.
27433 *
27434 * @class ReactReconcileTransaction
27435 */
27436function ReactReconcileTransaction(useCreateElement) {
27437 this.reinitializeTransaction();
27438 // Only server-side rendering really needs this option (see
27439 // `ReactServerRendering`), but server-side uses
27440 // `ReactServerRenderingTransaction` instead. This option is here so that it's
27441 // accessible and defaults to false when `ReactDOMComponent` and
27442 // `ReactTextComponent` checks it in `mountComponent`.`
27443 this.renderToStaticMarkup = false;
27444 this.reactMountReady = CallbackQueue.getPooled(null);
27445 this.useCreateElement = useCreateElement;
27446}
27447
27448var Mixin = {
27449 /**
27450 * @see Transaction
27451 * @abstract
27452 * @final
27453 * @return {array<object>} List of operation wrap procedures.
27454 * TODO: convert to array<TransactionWrapper>
27455 */
27456 getTransactionWrappers: function () {
27457 return TRANSACTION_WRAPPERS;
27458 },
27459
27460 /**
27461 * @return {object} The queue to collect `onDOMReady` callbacks with.
27462 */
27463 getReactMountReady: function () {
27464 return this.reactMountReady;
27465 },
27466
27467 /**
27468 * Save current transaction state -- if the return value from this method is
27469 * passed to `rollback`, the transaction will be reset to that state.
27470 */
27471 checkpoint: function () {
27472 // reactMountReady is the our only stateful wrapper
27473 return this.reactMountReady.checkpoint();
27474 },
27475
27476 rollback: function (checkpoint) {
27477 this.reactMountReady.rollback(checkpoint);
27478 },
27479
27480 /**
27481 * `PooledClass` looks for this, and will invoke this before allowing this
27482 * instance to be reused.
27483 */
27484 destructor: function () {
27485 CallbackQueue.release(this.reactMountReady);
27486 this.reactMountReady = null;
27487 }
27488};
27489
27490_assign(ReactReconcileTransaction.prototype, Transaction.Mixin, Mixin);
27491
27492PooledClass.addPoolingTo(ReactReconcileTransaction);
27493
27494module.exports = ReactReconcileTransaction;
27495},{"163":163,"183":183,"185":185,"226":226,"265":265,"296":296}],243:[function(require,module,exports){
27496(function (process){
27497/**
27498 * Copyright 2013-present, Facebook, Inc.
27499 * All rights reserved.
27500 *
27501 * This source code is licensed under the BSD-style license found in the
27502 * LICENSE file in the root directory of this source tree. An additional grant
27503 * of patent rights can be found in the PATENTS file in the same directory.
27504 *
27505 * @providesModule ReactReconciler
27506 */
27507
27508'use strict';
27509
27510var ReactRef = require(244);
27511var ReactInstrumentation = require(228);
27512
27513var invariant = require(45);
27514
27515/**
27516 * Helper to call ReactRef.attachRefs with this composite component, split out
27517 * to avoid allocations in the transaction mount-ready queue.
27518 */
27519function attachRefs() {
27520 ReactRef.attachRefs(this, this._currentElement);
27521}
27522
27523var ReactReconciler = {
27524
27525 /**
27526 * Initializes the component, renders markup, and registers event listeners.
27527 *
27528 * @param {ReactComponent} internalInstance
27529 * @param {ReactReconcileTransaction|ReactServerRenderingTransaction} transaction
27530 * @param {?object} the containing native component instance
27531 * @param {?object} info about the native container
27532 * @return {?string} Rendered markup to be inserted into the DOM.
27533 * @final
27534 * @internal
27535 */
27536 mountComponent: function (internalInstance, transaction, nativeParent, nativeContainerInfo, context) {
27537 if (process.env.NODE_ENV !== 'production') {
27538 if (internalInstance._debugID !== 0) {
27539 ReactInstrumentation.debugTool.onBeginReconcilerTimer(internalInstance._debugID, 'mountComponent');
27540 }
27541 }
27542 var markup = internalInstance.mountComponent(transaction, nativeParent, nativeContainerInfo, context);
27543 if (internalInstance._currentElement && internalInstance._currentElement.ref != null) {
27544 transaction.getReactMountReady().enqueue(attachRefs, internalInstance);
27545 }
27546 if (process.env.NODE_ENV !== 'production') {
27547 if (internalInstance._debugID !== 0) {
27548 ReactInstrumentation.debugTool.onEndReconcilerTimer(internalInstance._debugID, 'mountComponent');
27549 ReactInstrumentation.debugTool.onMountComponent(internalInstance._debugID);
27550 }
27551 }
27552 return markup;
27553 },
27554
27555 /**
27556 * Returns a value that can be passed to
27557 * ReactComponentEnvironment.replaceNodeWithMarkup.
27558 */
27559 getNativeNode: function (internalInstance) {
27560 return internalInstance.getNativeNode();
27561 },
27562
27563 /**
27564 * Releases any resources allocated by `mountComponent`.
27565 *
27566 * @final
27567 * @internal
27568 */
27569 unmountComponent: function (internalInstance, safely) {
27570 if (process.env.NODE_ENV !== 'production') {
27571 if (internalInstance._debugID !== 0) {
27572 ReactInstrumentation.debugTool.onBeginReconcilerTimer(internalInstance._debugID, 'unmountComponent');
27573 }
27574 }
27575 ReactRef.detachRefs(internalInstance, internalInstance._currentElement);
27576 internalInstance.unmountComponent(safely);
27577 if (process.env.NODE_ENV !== 'production') {
27578 if (internalInstance._debugID !== 0) {
27579 ReactInstrumentation.debugTool.onEndReconcilerTimer(internalInstance._debugID, 'unmountComponent');
27580 ReactInstrumentation.debugTool.onUnmountComponent(internalInstance._debugID);
27581 }
27582 }
27583 },
27584
27585 /**
27586 * Update a component using a new element.
27587 *
27588 * @param {ReactComponent} internalInstance
27589 * @param {ReactElement} nextElement
27590 * @param {ReactReconcileTransaction} transaction
27591 * @param {object} context
27592 * @internal
27593 */
27594 receiveComponent: function (internalInstance, nextElement, transaction, context) {
27595 var prevElement = internalInstance._currentElement;
27596
27597 if (nextElement === prevElement && context === internalInstance._context) {
27598 // Since elements are immutable after the owner is rendered,
27599 // we can do a cheap identity compare here to determine if this is a
27600 // superfluous reconcile. It's possible for state to be mutable but such
27601 // change should trigger an update of the owner which would recreate
27602 // the element. We explicitly check for the existence of an owner since
27603 // it's possible for an element created outside a composite to be
27604 // deeply mutated and reused.
27605
27606 // TODO: Bailing out early is just a perf optimization right?
27607 // TODO: Removing the return statement should affect correctness?
27608 return;
27609 }
27610
27611 if (process.env.NODE_ENV !== 'production') {
27612 if (internalInstance._debugID !== 0) {
27613 ReactInstrumentation.debugTool.onBeginReconcilerTimer(internalInstance._debugID, 'receiveComponent');
27614 }
27615 }
27616
27617 var refsChanged = ReactRef.shouldUpdateRefs(prevElement, nextElement);
27618
27619 if (refsChanged) {
27620 ReactRef.detachRefs(internalInstance, prevElement);
27621 }
27622
27623 internalInstance.receiveComponent(nextElement, transaction, context);
27624
27625 if (refsChanged && internalInstance._currentElement && internalInstance._currentElement.ref != null) {
27626 transaction.getReactMountReady().enqueue(attachRefs, internalInstance);
27627 }
27628
27629 if (process.env.NODE_ENV !== 'production') {
27630 if (internalInstance._debugID !== 0) {
27631 ReactInstrumentation.debugTool.onEndReconcilerTimer(internalInstance._debugID, 'receiveComponent');
27632 ReactInstrumentation.debugTool.onUpdateComponent(internalInstance._debugID);
27633 }
27634 }
27635 },
27636
27637 /**
27638 * Flush any dirty changes in a component.
27639 *
27640 * @param {ReactComponent} internalInstance
27641 * @param {ReactReconcileTransaction} transaction
27642 * @internal
27643 */
27644 performUpdateIfNecessary: function (internalInstance, transaction, updateBatchNumber) {
27645 if (internalInstance._updateBatchNumber !== updateBatchNumber) {
27646 // The component's enqueued batch number should always be the current
27647 // batch or the following one.
27648 !(internalInstance._updateBatchNumber == null || internalInstance._updateBatchNumber === updateBatchNumber + 1) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'performUpdateIfNecessary: Unexpected batch number (current %s, ' + 'pending %s)', updateBatchNumber, internalInstance._updateBatchNumber) : invariant(false) : void 0;
27649 return;
27650 }
27651 if (process.env.NODE_ENV !== 'production') {
27652 if (internalInstance._debugID !== 0) {
27653 ReactInstrumentation.debugTool.onBeginReconcilerTimer(internalInstance._debugID, 'performUpdateIfNecessary');
27654 }
27655 }
27656 internalInstance.performUpdateIfNecessary(transaction);
27657 if (process.env.NODE_ENV !== 'production') {
27658 if (internalInstance._debugID !== 0) {
27659 ReactInstrumentation.debugTool.onEndReconcilerTimer(internalInstance._debugID, 'performUpdateIfNecessary');
27660 ReactInstrumentation.debugTool.onUpdateComponent(internalInstance._debugID);
27661 }
27662 }
27663 }
27664
27665};
27666
27667module.exports = ReactReconciler;
27668}).call(this,require(91))
27669},{"228":228,"244":244,"45":45,"91":91}],244:[function(require,module,exports){
27670/**
27671 * Copyright 2013-present, Facebook, Inc.
27672 * All rights reserved.
27673 *
27674 * This source code is licensed under the BSD-style license found in the
27675 * LICENSE file in the root directory of this source tree. An additional grant
27676 * of patent rights can be found in the PATENTS file in the same directory.
27677 *
27678 * @providesModule ReactRef
27679 */
27680
27681'use strict';
27682
27683var ReactOwner = require(238);
27684
27685var ReactRef = {};
27686
27687function attachRef(ref, component, owner) {
27688 if (typeof ref === 'function') {
27689 ref(component.getPublicInstance());
27690 } else {
27691 // Legacy ref
27692 ReactOwner.addComponentAsRefTo(component, ref, owner);
27693 }
27694}
27695
27696function detachRef(ref, component, owner) {
27697 if (typeof ref === 'function') {
27698 ref(null);
27699 } else {
27700 // Legacy ref
27701 ReactOwner.removeComponentAsRefFrom(component, ref, owner);
27702 }
27703}
27704
27705ReactRef.attachRefs = function (instance, element) {
27706 if (element === null || element === false) {
27707 return;
27708 }
27709 var ref = element.ref;
27710 if (ref != null) {
27711 attachRef(ref, instance, element._owner);
27712 }
27713};
27714
27715ReactRef.shouldUpdateRefs = function (prevElement, nextElement) {
27716 // If either the owner or a `ref` has changed, make sure the newest owner
27717 // has stored a reference to `this`, and the previous owner (if different)
27718 // has forgotten the reference to `this`. We use the element instead
27719 // of the public this.props because the post processing cannot determine
27720 // a ref. The ref conceptually lives on the element.
27721
27722 // TODO: Should this even be possible? The owner cannot change because
27723 // it's forbidden by shouldUpdateReactComponent. The ref can change
27724 // if you swap the keys of but not the refs. Reconsider where this check
27725 // is made. It probably belongs where the key checking and
27726 // instantiateReactComponent is done.
27727
27728 var prevEmpty = prevElement === null || prevElement === false;
27729 var nextEmpty = nextElement === null || nextElement === false;
27730
27731 return(
27732 // This has a few false positives w/r/t empty components.
27733 prevEmpty || nextEmpty || nextElement._owner !== prevElement._owner || nextElement.ref !== prevElement.ref
27734 );
27735};
27736
27737ReactRef.detachRefs = function (instance, element) {
27738 if (element === null || element === false) {
27739 return;
27740 }
27741 var ref = element.ref;
27742 if (ref != null) {
27743 detachRef(ref, instance, element._owner);
27744 }
27745};
27746
27747module.exports = ReactRef;
27748},{"238":238}],245:[function(require,module,exports){
27749/**
27750 * Copyright 2014-present, Facebook, Inc.
27751 * All rights reserved.
27752 *
27753 * This source code is licensed under the BSD-style license found in the
27754 * LICENSE file in the root directory of this source tree. An additional grant
27755 * of patent rights can be found in the PATENTS file in the same directory.
27756 *
27757 * @providesModule ReactServerRenderingTransaction
27758 */
27759
27760'use strict';
27761
27762var _assign = require(296);
27763
27764var PooledClass = require(183);
27765var Transaction = require(265);
27766
27767/**
27768 * Executed within the scope of the `Transaction` instance. Consider these as
27769 * being member methods, but with an implied ordering while being isolated from
27770 * each other.
27771 */
27772var TRANSACTION_WRAPPERS = [];
27773
27774var noopCallbackQueue = {
27775 enqueue: function () {}
27776};
27777
27778/**
27779 * @class ReactServerRenderingTransaction
27780 * @param {boolean} renderToStaticMarkup
27781 */
27782function ReactServerRenderingTransaction(renderToStaticMarkup) {
27783 this.reinitializeTransaction();
27784 this.renderToStaticMarkup = renderToStaticMarkup;
27785 this.useCreateElement = false;
27786}
27787
27788var Mixin = {
27789 /**
27790 * @see Transaction
27791 * @abstract
27792 * @final
27793 * @return {array} Empty list of operation wrap procedures.
27794 */
27795 getTransactionWrappers: function () {
27796 return TRANSACTION_WRAPPERS;
27797 },
27798
27799 /**
27800 * @return {object} The queue to collect `onDOMReady` callbacks with.
27801 */
27802 getReactMountReady: function () {
27803 return noopCallbackQueue;
27804 },
27805
27806 /**
27807 * `PooledClass` looks for this, and will invoke this before allowing this
27808 * instance to be reused.
27809 */
27810 destructor: function () {},
27811
27812 checkpoint: function () {},
27813
27814 rollback: function () {}
27815};
27816
27817_assign(ReactServerRenderingTransaction.prototype, Transaction.Mixin, Mixin);
27818
27819PooledClass.addPoolingTo(ReactServerRenderingTransaction);
27820
27821module.exports = ReactServerRenderingTransaction;
27822},{"183":183,"265":265,"296":296}],246:[function(require,module,exports){
27823(function (process){
27824/**
27825 * Copyright 2015-present, Facebook, Inc.
27826 * All rights reserved.
27827 *
27828 * This source code is licensed under the BSD-style license found in the
27829 * LICENSE file in the root directory of this source tree. An additional grant
27830 * of patent rights can be found in the PATENTS file in the same directory.
27831 *
27832 * @providesModule ReactUpdateQueue
27833 */
27834
27835'use strict';
27836
27837var ReactCurrentOwner = require(194);
27838var ReactInstanceMap = require(227);
27839var ReactUpdates = require(247);
27840
27841var invariant = require(45);
27842var warning = require(55);
27843
27844function enqueueUpdate(internalInstance) {
27845 ReactUpdates.enqueueUpdate(internalInstance);
27846}
27847
27848function formatUnexpectedArgument(arg) {
27849 var type = typeof arg;
27850 if (type !== 'object') {
27851 return type;
27852 }
27853 var displayName = arg.constructor && arg.constructor.name || type;
27854 var keys = Object.keys(arg);
27855 if (keys.length > 0 && keys.length < 20) {
27856 return displayName + ' (keys: ' + keys.join(', ') + ')';
27857 }
27858 return displayName;
27859}
27860
27861function getInternalInstanceReadyForUpdate(publicInstance, callerName) {
27862 var internalInstance = ReactInstanceMap.get(publicInstance);
27863 if (!internalInstance) {
27864 if (process.env.NODE_ENV !== 'production') {
27865 // Only warn when we have a callerName. Otherwise we should be silent.
27866 // We're probably calling from enqueueCallback. We don't want to warn
27867 // there because we already warned for the corresponding lifecycle method.
27868 process.env.NODE_ENV !== 'production' ? warning(!callerName, '%s(...): Can only update a mounted or mounting component. ' + 'This usually means you called %s() on an unmounted component. ' + 'This is a no-op. Please check the code for the %s component.', callerName, callerName, publicInstance.constructor.displayName) : void 0;
27869 }
27870 return null;
27871 }
27872
27873 if (process.env.NODE_ENV !== 'production') {
27874 process.env.NODE_ENV !== 'production' ? warning(ReactCurrentOwner.current == null, '%s(...): Cannot update during an existing state transition (such as ' + 'within `render` or another component\'s constructor). Render methods ' + 'should be a pure function of props and state; constructor ' + 'side-effects are an anti-pattern, but can be moved to ' + '`componentWillMount`.', callerName) : void 0;
27875 }
27876
27877 return internalInstance;
27878}
27879
27880/**
27881 * ReactUpdateQueue allows for state updates to be scheduled into a later
27882 * reconciliation step.
27883 */
27884var ReactUpdateQueue = {
27885
27886 /**
27887 * Checks whether or not this composite component is mounted.
27888 * @param {ReactClass} publicInstance The instance we want to test.
27889 * @return {boolean} True if mounted, false otherwise.
27890 * @protected
27891 * @final
27892 */
27893 isMounted: function (publicInstance) {
27894 if (process.env.NODE_ENV !== 'production') {
27895 var owner = ReactCurrentOwner.current;
27896 if (owner !== null) {
27897 process.env.NODE_ENV !== 'production' ? warning(owner._warnedAboutRefsInRender, '%s is accessing isMounted inside its render() function. ' + 'render() should be a pure function of props and state. It should ' + 'never access something that requires stale data from the previous ' + 'render, such as refs. Move this logic to componentDidMount and ' + 'componentDidUpdate instead.', owner.getName() || 'A component') : void 0;
27898 owner._warnedAboutRefsInRender = true;
27899 }
27900 }
27901 var internalInstance = ReactInstanceMap.get(publicInstance);
27902 if (internalInstance) {
27903 // During componentWillMount and render this will still be null but after
27904 // that will always render to something. At least for now. So we can use
27905 // this hack.
27906 return !!internalInstance._renderedComponent;
27907 } else {
27908 return false;
27909 }
27910 },
27911
27912 /**
27913 * Enqueue a callback that will be executed after all the pending updates
27914 * have processed.
27915 *
27916 * @param {ReactClass} publicInstance The instance to use as `this` context.
27917 * @param {?function} callback Called after state is updated.
27918 * @param {string} callerName Name of the calling function in the public API.
27919 * @internal
27920 */
27921 enqueueCallback: function (publicInstance, callback, callerName) {
27922 ReactUpdateQueue.validateCallback(callback, callerName);
27923 var internalInstance = getInternalInstanceReadyForUpdate(publicInstance);
27924
27925 // Previously we would throw an error if we didn't have an internal
27926 // instance. Since we want to make it a no-op instead, we mirror the same
27927 // behavior we have in other enqueue* methods.
27928 // We also need to ignore callbacks in componentWillMount. See
27929 // enqueueUpdates.
27930 if (!internalInstance) {
27931 return null;
27932 }
27933
27934 if (internalInstance._pendingCallbacks) {
27935 internalInstance._pendingCallbacks.push(callback);
27936 } else {
27937 internalInstance._pendingCallbacks = [callback];
27938 }
27939 // TODO: The callback here is ignored when setState is called from
27940 // componentWillMount. Either fix it or disallow doing so completely in
27941 // favor of getInitialState. Alternatively, we can disallow
27942 // componentWillMount during server-side rendering.
27943 enqueueUpdate(internalInstance);
27944 },
27945
27946 enqueueCallbackInternal: function (internalInstance, callback) {
27947 if (internalInstance._pendingCallbacks) {
27948 internalInstance._pendingCallbacks.push(callback);
27949 } else {
27950 internalInstance._pendingCallbacks = [callback];
27951 }
27952 enqueueUpdate(internalInstance);
27953 },
27954
27955 /**
27956 * Forces an update. This should only be invoked when it is known with
27957 * certainty that we are **not** in a DOM transaction.
27958 *
27959 * You may want to call this when you know that some deeper aspect of the
27960 * component's state has changed but `setState` was not called.
27961 *
27962 * This will not invoke `shouldComponentUpdate`, but it will invoke
27963 * `componentWillUpdate` and `componentDidUpdate`.
27964 *
27965 * @param {ReactClass} publicInstance The instance that should rerender.
27966 * @internal
27967 */
27968 enqueueForceUpdate: function (publicInstance) {
27969 var internalInstance = getInternalInstanceReadyForUpdate(publicInstance, 'forceUpdate');
27970
27971 if (!internalInstance) {
27972 return;
27973 }
27974
27975 internalInstance._pendingForceUpdate = true;
27976
27977 enqueueUpdate(internalInstance);
27978 },
27979
27980 /**
27981 * Replaces all of the state. Always use this or `setState` to mutate state.
27982 * You should treat `this.state` as immutable.
27983 *
27984 * There is no guarantee that `this.state` will be immediately updated, so
27985 * accessing `this.state` after calling this method may return the old value.
27986 *
27987 * @param {ReactClass} publicInstance The instance that should rerender.
27988 * @param {object} completeState Next state.
27989 * @internal
27990 */
27991 enqueueReplaceState: function (publicInstance, completeState) {
27992 var internalInstance = getInternalInstanceReadyForUpdate(publicInstance, 'replaceState');
27993
27994 if (!internalInstance) {
27995 return;
27996 }
27997
27998 internalInstance._pendingStateQueue = [completeState];
27999 internalInstance._pendingReplaceState = true;
28000
28001 enqueueUpdate(internalInstance);
28002 },
28003
28004 /**
28005 * Sets a subset of the state. This only exists because _pendingState is
28006 * internal. This provides a merging strategy that is not available to deep
28007 * properties which is confusing. TODO: Expose pendingState or don't use it
28008 * during the merge.
28009 *
28010 * @param {ReactClass} publicInstance The instance that should rerender.
28011 * @param {object} partialState Next partial state to be merged with state.
28012 * @internal
28013 */
28014 enqueueSetState: function (publicInstance, partialState) {
28015 var internalInstance = getInternalInstanceReadyForUpdate(publicInstance, 'setState');
28016
28017 if (!internalInstance) {
28018 return;
28019 }
28020
28021 var queue = internalInstance._pendingStateQueue || (internalInstance._pendingStateQueue = []);
28022 queue.push(partialState);
28023
28024 enqueueUpdate(internalInstance);
28025 },
28026
28027 enqueueElementInternal: function (internalInstance, newElement) {
28028 internalInstance._pendingElement = newElement;
28029 enqueueUpdate(internalInstance);
28030 },
28031
28032 validateCallback: function (callback, callerName) {
28033 !(!callback || typeof callback === 'function') ? process.env.NODE_ENV !== 'production' ? invariant(false, '%s(...): Expected the last optional `callback` argument to be a ' + 'function. Instead received: %s.', callerName, formatUnexpectedArgument(callback)) : invariant(false) : void 0;
28034 }
28035
28036};
28037
28038module.exports = ReactUpdateQueue;
28039}).call(this,require(91))
28040},{"194":194,"227":227,"247":247,"45":45,"55":55,"91":91}],247:[function(require,module,exports){
28041(function (process){
28042/**
28043 * Copyright 2013-present, Facebook, Inc.
28044 * All rights reserved.
28045 *
28046 * This source code is licensed under the BSD-style license found in the
28047 * LICENSE file in the root directory of this source tree. An additional grant
28048 * of patent rights can be found in the PATENTS file in the same directory.
28049 *
28050 * @providesModule ReactUpdates
28051 */
28052
28053'use strict';
28054
28055var _assign = require(296);
28056
28057var CallbackQueue = require(163);
28058var PooledClass = require(183);
28059var ReactFeatureFlags = require(224);
28060var ReactInstrumentation = require(228);
28061var ReactReconciler = require(243);
28062var Transaction = require(265);
28063
28064var invariant = require(45);
28065
28066var dirtyComponents = [];
28067var updateBatchNumber = 0;
28068var asapCallbackQueue = CallbackQueue.getPooled();
28069var asapEnqueued = false;
28070
28071var batchingStrategy = null;
28072
28073function ensureInjected() {
28074 !(ReactUpdates.ReactReconcileTransaction && batchingStrategy) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactUpdates: must inject a reconcile transaction class and batching ' + 'strategy') : invariant(false) : void 0;
28075}
28076
28077var NESTED_UPDATES = {
28078 initialize: function () {
28079 this.dirtyComponentsLength = dirtyComponents.length;
28080 },
28081 close: function () {
28082 if (this.dirtyComponentsLength !== dirtyComponents.length) {
28083 // Additional updates were enqueued by componentDidUpdate handlers or
28084 // similar; before our own UPDATE_QUEUEING wrapper closes, we want to run
28085 // these new updates so that if A's componentDidUpdate calls setState on
28086 // B, B will update before the callback A's updater provided when calling
28087 // setState.
28088 dirtyComponents.splice(0, this.dirtyComponentsLength);
28089 flushBatchedUpdates();
28090 } else {
28091 dirtyComponents.length = 0;
28092 }
28093 }
28094};
28095
28096var UPDATE_QUEUEING = {
28097 initialize: function () {
28098 this.callbackQueue.reset();
28099 },
28100 close: function () {
28101 this.callbackQueue.notifyAll();
28102 }
28103};
28104
28105var TRANSACTION_WRAPPERS = [NESTED_UPDATES, UPDATE_QUEUEING];
28106
28107function ReactUpdatesFlushTransaction() {
28108 this.reinitializeTransaction();
28109 this.dirtyComponentsLength = null;
28110 this.callbackQueue = CallbackQueue.getPooled();
28111 this.reconcileTransaction = ReactUpdates.ReactReconcileTransaction.getPooled(
28112 /* useCreateElement */true);
28113}
28114
28115_assign(ReactUpdatesFlushTransaction.prototype, Transaction.Mixin, {
28116 getTransactionWrappers: function () {
28117 return TRANSACTION_WRAPPERS;
28118 },
28119
28120 destructor: function () {
28121 this.dirtyComponentsLength = null;
28122 CallbackQueue.release(this.callbackQueue);
28123 this.callbackQueue = null;
28124 ReactUpdates.ReactReconcileTransaction.release(this.reconcileTransaction);
28125 this.reconcileTransaction = null;
28126 },
28127
28128 perform: function (method, scope, a) {
28129 // Essentially calls `this.reconcileTransaction.perform(method, scope, a)`
28130 // with this transaction's wrappers around it.
28131 return Transaction.Mixin.perform.call(this, this.reconcileTransaction.perform, this.reconcileTransaction, method, scope, a);
28132 }
28133});
28134
28135PooledClass.addPoolingTo(ReactUpdatesFlushTransaction);
28136
28137function batchedUpdates(callback, a, b, c, d, e) {
28138 ensureInjected();
28139 batchingStrategy.batchedUpdates(callback, a, b, c, d, e);
28140}
28141
28142/**
28143 * Array comparator for ReactComponents by mount ordering.
28144 *
28145 * @param {ReactComponent} c1 first component you're comparing
28146 * @param {ReactComponent} c2 second component you're comparing
28147 * @return {number} Return value usable by Array.prototype.sort().
28148 */
28149function mountOrderComparator(c1, c2) {
28150 return c1._mountOrder - c2._mountOrder;
28151}
28152
28153function runBatchedUpdates(transaction) {
28154 var len = transaction.dirtyComponentsLength;
28155 !(len === dirtyComponents.length) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Expected flush transaction\'s stored dirty-components length (%s) to ' + 'match dirty-components array length (%s).', len, dirtyComponents.length) : invariant(false) : void 0;
28156
28157 // Since reconciling a component higher in the owner hierarchy usually (not
28158 // always -- see shouldComponentUpdate()) will reconcile children, reconcile
28159 // them before their children by sorting the array.
28160 dirtyComponents.sort(mountOrderComparator);
28161
28162 // Any updates enqueued while reconciling must be performed after this entire
28163 // batch. Otherwise, if dirtyComponents is [A, B] where A has children B and
28164 // C, B could update twice in a single batch if C's render enqueues an update
28165 // to B (since B would have already updated, we should skip it, and the only
28166 // way we can know to do so is by checking the batch counter).
28167 updateBatchNumber++;
28168
28169 for (var i = 0; i < len; i++) {
28170 // If a component is unmounted before pending changes apply, it will still
28171 // be here, but we assume that it has cleared its _pendingCallbacks and
28172 // that performUpdateIfNecessary is a noop.
28173 var component = dirtyComponents[i];
28174
28175 // If performUpdateIfNecessary happens to enqueue any new updates, we
28176 // shouldn't execute the callbacks until the next render happens, so
28177 // stash the callbacks first
28178 var callbacks = component._pendingCallbacks;
28179 component._pendingCallbacks = null;
28180
28181 var markerName;
28182 if (ReactFeatureFlags.logTopLevelRenders) {
28183 var namedComponent = component;
28184 // Duck type TopLevelWrapper. This is probably always true.
28185 if (component._currentElement.props === component._renderedComponent._currentElement) {
28186 namedComponent = component._renderedComponent;
28187 }
28188 markerName = 'React update: ' + namedComponent.getName();
28189 console.time(markerName);
28190 }
28191
28192 ReactReconciler.performUpdateIfNecessary(component, transaction.reconcileTransaction, updateBatchNumber);
28193
28194 if (markerName) {
28195 console.timeEnd(markerName);
28196 }
28197
28198 if (callbacks) {
28199 for (var j = 0; j < callbacks.length; j++) {
28200 transaction.callbackQueue.enqueue(callbacks[j], component.getPublicInstance());
28201 }
28202 }
28203 }
28204}
28205
28206var flushBatchedUpdates = function () {
28207 if (process.env.NODE_ENV !== 'production') {
28208 ReactInstrumentation.debugTool.onBeginFlush();
28209 }
28210
28211 // ReactUpdatesFlushTransaction's wrappers will clear the dirtyComponents
28212 // array and perform any updates enqueued by mount-ready handlers (i.e.,
28213 // componentDidUpdate) but we need to check here too in order to catch
28214 // updates enqueued by setState callbacks and asap calls.
28215 while (dirtyComponents.length || asapEnqueued) {
28216 if (dirtyComponents.length) {
28217 var transaction = ReactUpdatesFlushTransaction.getPooled();
28218 transaction.perform(runBatchedUpdates, null, transaction);
28219 ReactUpdatesFlushTransaction.release(transaction);
28220 }
28221
28222 if (asapEnqueued) {
28223 asapEnqueued = false;
28224 var queue = asapCallbackQueue;
28225 asapCallbackQueue = CallbackQueue.getPooled();
28226 queue.notifyAll();
28227 CallbackQueue.release(queue);
28228 }
28229 }
28230
28231 if (process.env.NODE_ENV !== 'production') {
28232 ReactInstrumentation.debugTool.onEndFlush();
28233 }
28234};
28235
28236/**
28237 * Mark a component as needing a rerender, adding an optional callback to a
28238 * list of functions which will be executed once the rerender occurs.
28239 */
28240function enqueueUpdate(component) {
28241 ensureInjected();
28242
28243 // Various parts of our code (such as ReactCompositeComponent's
28244 // _renderValidatedComponent) assume that calls to render aren't nested;
28245 // verify that that's the case. (This is called by each top-level update
28246 // function, like setProps, setState, forceUpdate, etc.; creation and
28247 // destruction of top-level components is guarded in ReactMount.)
28248
28249 if (!batchingStrategy.isBatchingUpdates) {
28250 batchingStrategy.batchedUpdates(enqueueUpdate, component);
28251 return;
28252 }
28253
28254 dirtyComponents.push(component);
28255 if (component._updateBatchNumber == null) {
28256 component._updateBatchNumber = updateBatchNumber + 1;
28257 }
28258}
28259
28260/**
28261 * Enqueue a callback to be run at the end of the current batching cycle. Throws
28262 * if no updates are currently being performed.
28263 */
28264function asap(callback, context) {
28265 !batchingStrategy.isBatchingUpdates ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactUpdates.asap: Can\'t enqueue an asap callback in a context where' + 'updates are not being batched.') : invariant(false) : void 0;
28266 asapCallbackQueue.enqueue(callback, context);
28267 asapEnqueued = true;
28268}
28269
28270var ReactUpdatesInjection = {
28271 injectReconcileTransaction: function (ReconcileTransaction) {
28272 !ReconcileTransaction ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactUpdates: must provide a reconcile transaction class') : invariant(false) : void 0;
28273 ReactUpdates.ReactReconcileTransaction = ReconcileTransaction;
28274 },
28275
28276 injectBatchingStrategy: function (_batchingStrategy) {
28277 !_batchingStrategy ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactUpdates: must provide a batching strategy') : invariant(false) : void 0;
28278 !(typeof _batchingStrategy.batchedUpdates === 'function') ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactUpdates: must provide a batchedUpdates() function') : invariant(false) : void 0;
28279 !(typeof _batchingStrategy.isBatchingUpdates === 'boolean') ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactUpdates: must provide an isBatchingUpdates boolean attribute') : invariant(false) : void 0;
28280 batchingStrategy = _batchingStrategy;
28281 }
28282};
28283
28284var ReactUpdates = {
28285 /**
28286 * React references `ReactReconcileTransaction` using this property in order
28287 * to allow dependency injection.
28288 *
28289 * @internal
28290 */
28291 ReactReconcileTransaction: null,
28292
28293 batchedUpdates: batchedUpdates,
28294 enqueueUpdate: enqueueUpdate,
28295 flushBatchedUpdates: flushBatchedUpdates,
28296 injection: ReactUpdatesInjection,
28297 asap: asap
28298};
28299
28300module.exports = ReactUpdates;
28301}).call(this,require(91))
28302},{"163":163,"183":183,"224":224,"228":228,"243":243,"265":265,"296":296,"45":45,"91":91}],248:[function(require,module,exports){
28303/**
28304 * Copyright 2013-present, Facebook, Inc.
28305 * All rights reserved.
28306 *
28307 * This source code is licensed under the BSD-style license found in the
28308 * LICENSE file in the root directory of this source tree. An additional grant
28309 * of patent rights can be found in the PATENTS file in the same directory.
28310 *
28311 * @providesModule ReactVersion
28312 */
28313
28314'use strict';
28315
28316module.exports = '15.1.0';
28317},{}],249:[function(require,module,exports){
28318/**
28319 * Copyright 2013-present, Facebook, Inc.
28320 * All rights reserved.
28321 *
28322 * This source code is licensed under the BSD-style license found in the
28323 * LICENSE file in the root directory of this source tree. An additional grant
28324 * of patent rights can be found in the PATENTS file in the same directory.
28325 *
28326 * @providesModule SVGDOMPropertyConfig
28327 */
28328
28329'use strict';
28330
28331var NS = {
28332 xlink: 'http://www.w3.org/1999/xlink',
28333 xml: 'http://www.w3.org/XML/1998/namespace'
28334};
28335
28336// We use attributes for everything SVG so let's avoid some duplication and run
28337// code instead.
28338// The following are all specified in the HTML config already so we exclude here.
28339// - class (as className)
28340// - color
28341// - height
28342// - id
28343// - lang
28344// - max
28345// - media
28346// - method
28347// - min
28348// - name
28349// - style
28350// - target
28351// - type
28352// - width
28353var ATTRS = {
28354 accentHeight: 'accent-height',
28355 accumulate: 0,
28356 additive: 0,
28357 alignmentBaseline: 'alignment-baseline',
28358 allowReorder: 'allowReorder',
28359 alphabetic: 0,
28360 amplitude: 0,
28361 arabicForm: 'arabic-form',
28362 ascent: 0,
28363 attributeName: 'attributeName',
28364 attributeType: 'attributeType',
28365 autoReverse: 'autoReverse',
28366 azimuth: 0,
28367 baseFrequency: 'baseFrequency',
28368 baseProfile: 'baseProfile',
28369 baselineShift: 'baseline-shift',
28370 bbox: 0,
28371 begin: 0,
28372 bias: 0,
28373 by: 0,
28374 calcMode: 'calcMode',
28375 capHeight: 'cap-height',
28376 clip: 0,
28377 clipPath: 'clip-path',
28378 clipRule: 'clip-rule',
28379 clipPathUnits: 'clipPathUnits',
28380 colorInterpolation: 'color-interpolation',
28381 colorInterpolationFilters: 'color-interpolation-filters',
28382 colorProfile: 'color-profile',
28383 colorRendering: 'color-rendering',
28384 contentScriptType: 'contentScriptType',
28385 contentStyleType: 'contentStyleType',
28386 cursor: 0,
28387 cx: 0,
28388 cy: 0,
28389 d: 0,
28390 decelerate: 0,
28391 descent: 0,
28392 diffuseConstant: 'diffuseConstant',
28393 direction: 0,
28394 display: 0,
28395 divisor: 0,
28396 dominantBaseline: 'dominant-baseline',
28397 dur: 0,
28398 dx: 0,
28399 dy: 0,
28400 edgeMode: 'edgeMode',
28401 elevation: 0,
28402 enableBackground: 'enable-background',
28403 end: 0,
28404 exponent: 0,
28405 externalResourcesRequired: 'externalResourcesRequired',
28406 fill: 0,
28407 fillOpacity: 'fill-opacity',
28408 fillRule: 'fill-rule',
28409 filter: 0,
28410 filterRes: 'filterRes',
28411 filterUnits: 'filterUnits',
28412 floodColor: 'flood-color',
28413 floodOpacity: 'flood-opacity',
28414 focusable: 0,
28415 fontFamily: 'font-family',
28416 fontSize: 'font-size',
28417 fontSizeAdjust: 'font-size-adjust',
28418 fontStretch: 'font-stretch',
28419 fontStyle: 'font-style',
28420 fontVariant: 'font-variant',
28421 fontWeight: 'font-weight',
28422 format: 0,
28423 from: 0,
28424 fx: 0,
28425 fy: 0,
28426 g1: 0,
28427 g2: 0,
28428 glyphName: 'glyph-name',
28429 glyphOrientationHorizontal: 'glyph-orientation-horizontal',
28430 glyphOrientationVertical: 'glyph-orientation-vertical',
28431 glyphRef: 'glyphRef',
28432 gradientTransform: 'gradientTransform',
28433 gradientUnits: 'gradientUnits',
28434 hanging: 0,
28435 horizAdvX: 'horiz-adv-x',
28436 horizOriginX: 'horiz-origin-x',
28437 ideographic: 0,
28438 imageRendering: 'image-rendering',
28439 'in': 0,
28440 in2: 0,
28441 intercept: 0,
28442 k: 0,
28443 k1: 0,
28444 k2: 0,
28445 k3: 0,
28446 k4: 0,
28447 kernelMatrix: 'kernelMatrix',
28448 kernelUnitLength: 'kernelUnitLength',
28449 kerning: 0,
28450 keyPoints: 'keyPoints',
28451 keySplines: 'keySplines',
28452 keyTimes: 'keyTimes',
28453 lengthAdjust: 'lengthAdjust',
28454 letterSpacing: 'letter-spacing',
28455 lightingColor: 'lighting-color',
28456 limitingConeAngle: 'limitingConeAngle',
28457 local: 0,
28458 markerEnd: 'marker-end',
28459 markerMid: 'marker-mid',
28460 markerStart: 'marker-start',
28461 markerHeight: 'markerHeight',
28462 markerUnits: 'markerUnits',
28463 markerWidth: 'markerWidth',
28464 mask: 0,
28465 maskContentUnits: 'maskContentUnits',
28466 maskUnits: 'maskUnits',
28467 mathematical: 0,
28468 mode: 0,
28469 numOctaves: 'numOctaves',
28470 offset: 0,
28471 opacity: 0,
28472 operator: 0,
28473 order: 0,
28474 orient: 0,
28475 orientation: 0,
28476 origin: 0,
28477 overflow: 0,
28478 overlinePosition: 'overline-position',
28479 overlineThickness: 'overline-thickness',
28480 paintOrder: 'paint-order',
28481 panose1: 'panose-1',
28482 pathLength: 'pathLength',
28483 patternContentUnits: 'patternContentUnits',
28484 patternTransform: 'patternTransform',
28485 patternUnits: 'patternUnits',
28486 pointerEvents: 'pointer-events',
28487 points: 0,
28488 pointsAtX: 'pointsAtX',
28489 pointsAtY: 'pointsAtY',
28490 pointsAtZ: 'pointsAtZ',
28491 preserveAlpha: 'preserveAlpha',
28492 preserveAspectRatio: 'preserveAspectRatio',
28493 primitiveUnits: 'primitiveUnits',
28494 r: 0,
28495 radius: 0,
28496 refX: 'refX',
28497 refY: 'refY',
28498 renderingIntent: 'rendering-intent',
28499 repeatCount: 'repeatCount',
28500 repeatDur: 'repeatDur',
28501 requiredExtensions: 'requiredExtensions',
28502 requiredFeatures: 'requiredFeatures',
28503 restart: 0,
28504 result: 0,
28505 rotate: 0,
28506 rx: 0,
28507 ry: 0,
28508 scale: 0,
28509 seed: 0,
28510 shapeRendering: 'shape-rendering',
28511 slope: 0,
28512 spacing: 0,
28513 specularConstant: 'specularConstant',
28514 specularExponent: 'specularExponent',
28515 speed: 0,
28516 spreadMethod: 'spreadMethod',
28517 startOffset: 'startOffset',
28518 stdDeviation: 'stdDeviation',
28519 stemh: 0,
28520 stemv: 0,
28521 stitchTiles: 'stitchTiles',
28522 stopColor: 'stop-color',
28523 stopOpacity: 'stop-opacity',
28524 strikethroughPosition: 'strikethrough-position',
28525 strikethroughThickness: 'strikethrough-thickness',
28526 string: 0,
28527 stroke: 0,
28528 strokeDasharray: 'stroke-dasharray',
28529 strokeDashoffset: 'stroke-dashoffset',
28530 strokeLinecap: 'stroke-linecap',
28531 strokeLinejoin: 'stroke-linejoin',
28532 strokeMiterlimit: 'stroke-miterlimit',
28533 strokeOpacity: 'stroke-opacity',
28534 strokeWidth: 'stroke-width',
28535 surfaceScale: 'surfaceScale',
28536 systemLanguage: 'systemLanguage',
28537 tableValues: 'tableValues',
28538 targetX: 'targetX',
28539 targetY: 'targetY',
28540 textAnchor: 'text-anchor',
28541 textDecoration: 'text-decoration',
28542 textRendering: 'text-rendering',
28543 textLength: 'textLength',
28544 to: 0,
28545 transform: 0,
28546 u1: 0,
28547 u2: 0,
28548 underlinePosition: 'underline-position',
28549 underlineThickness: 'underline-thickness',
28550 unicode: 0,
28551 unicodeBidi: 'unicode-bidi',
28552 unicodeRange: 'unicode-range',
28553 unitsPerEm: 'units-per-em',
28554 vAlphabetic: 'v-alphabetic',
28555 vHanging: 'v-hanging',
28556 vIdeographic: 'v-ideographic',
28557 vMathematical: 'v-mathematical',
28558 values: 0,
28559 vectorEffect: 'vector-effect',
28560 version: 0,
28561 vertAdvY: 'vert-adv-y',
28562 vertOriginX: 'vert-origin-x',
28563 vertOriginY: 'vert-origin-y',
28564 viewBox: 'viewBox',
28565 viewTarget: 'viewTarget',
28566 visibility: 0,
28567 widths: 0,
28568 wordSpacing: 'word-spacing',
28569 writingMode: 'writing-mode',
28570 x: 0,
28571 xHeight: 'x-height',
28572 x1: 0,
28573 x2: 0,
28574 xChannelSelector: 'xChannelSelector',
28575 xlinkActuate: 'xlink:actuate',
28576 xlinkArcrole: 'xlink:arcrole',
28577 xlinkHref: 'xlink:href',
28578 xlinkRole: 'xlink:role',
28579 xlinkShow: 'xlink:show',
28580 xlinkTitle: 'xlink:title',
28581 xlinkType: 'xlink:type',
28582 xmlBase: 'xml:base',
28583 xmlLang: 'xml:lang',
28584 xmlSpace: 'xml:space',
28585 y: 0,
28586 y1: 0,
28587 y2: 0,
28588 yChannelSelector: 'yChannelSelector',
28589 z: 0,
28590 zoomAndPan: 'zoomAndPan'
28591};
28592
28593var SVGDOMPropertyConfig = {
28594 Properties: {},
28595 DOMAttributeNamespaces: {
28596 xlinkActuate: NS.xlink,
28597 xlinkArcrole: NS.xlink,
28598 xlinkHref: NS.xlink,
28599 xlinkRole: NS.xlink,
28600 xlinkShow: NS.xlink,
28601 xlinkTitle: NS.xlink,
28602 xlinkType: NS.xlink,
28603 xmlBase: NS.xml,
28604 xmlLang: NS.xml,
28605 xmlSpace: NS.xml
28606 },
28607 DOMAttributeNames: {}
28608};
28609
28610Object.keys(ATTRS).forEach(function (key) {
28611 SVGDOMPropertyConfig.Properties[key] = 0;
28612 if (ATTRS[key]) {
28613 SVGDOMPropertyConfig.DOMAttributeNames[key] = ATTRS[key];
28614 }
28615});
28616
28617module.exports = SVGDOMPropertyConfig;
28618},{}],250:[function(require,module,exports){
28619/**
28620 * Copyright 2013-present, Facebook, Inc.
28621 * All rights reserved.
28622 *
28623 * This source code is licensed under the BSD-style license found in the
28624 * LICENSE file in the root directory of this source tree. An additional grant
28625 * of patent rights can be found in the PATENTS file in the same directory.
28626 *
28627 * @providesModule SelectEventPlugin
28628 */
28629
28630'use strict';
28631
28632var EventConstants = require(174);
28633var EventPropagators = require(178);
28634var ExecutionEnvironment = require(31);
28635var ReactDOMComponentTree = require(199);
28636var ReactInputSelection = require(226);
28637var SyntheticEvent = require(256);
28638
28639var getActiveElement = require(40);
28640var isTextInputElement = require(287);
28641var keyOf = require(49);
28642var shallowEqual = require(54);
28643
28644var topLevelTypes = EventConstants.topLevelTypes;
28645
28646var skipSelectionChangeEvent = ExecutionEnvironment.canUseDOM && 'documentMode' in document && document.documentMode <= 11;
28647
28648var eventTypes = {
28649 select: {
28650 phasedRegistrationNames: {
28651 bubbled: keyOf({ onSelect: null }),
28652 captured: keyOf({ onSelectCapture: null })
28653 },
28654 dependencies: [topLevelTypes.topBlur, topLevelTypes.topContextMenu, topLevelTypes.topFocus, topLevelTypes.topKeyDown, topLevelTypes.topMouseDown, topLevelTypes.topMouseUp, topLevelTypes.topSelectionChange]
28655 }
28656};
28657
28658var activeElement = null;
28659var activeElementInst = null;
28660var lastSelection = null;
28661var mouseDown = false;
28662
28663// Track whether a listener exists for this plugin. If none exist, we do
28664// not extract events. See #3639.
28665var hasListener = false;
28666var ON_SELECT_KEY = keyOf({ onSelect: null });
28667
28668/**
28669 * Get an object which is a unique representation of the current selection.
28670 *
28671 * The return value will not be consistent across nodes or browsers, but
28672 * two identical selections on the same node will return identical objects.
28673 *
28674 * @param {DOMElement} node
28675 * @return {object}
28676 */
28677function getSelection(node) {
28678 if ('selectionStart' in node && ReactInputSelection.hasSelectionCapabilities(node)) {
28679 return {
28680 start: node.selectionStart,
28681 end: node.selectionEnd
28682 };
28683 } else if (window.getSelection) {
28684 var selection = window.getSelection();
28685 return {
28686 anchorNode: selection.anchorNode,
28687 anchorOffset: selection.anchorOffset,
28688 focusNode: selection.focusNode,
28689 focusOffset: selection.focusOffset
28690 };
28691 } else if (document.selection) {
28692 var range = document.selection.createRange();
28693 return {
28694 parentElement: range.parentElement(),
28695 text: range.text,
28696 top: range.boundingTop,
28697 left: range.boundingLeft
28698 };
28699 }
28700}
28701
28702/**
28703 * Poll selection to see whether it's changed.
28704 *
28705 * @param {object} nativeEvent
28706 * @return {?SyntheticEvent}
28707 */
28708function constructSelectEvent(nativeEvent, nativeEventTarget) {
28709 // Ensure we have the right element, and that the user is not dragging a
28710 // selection (this matches native `select` event behavior). In HTML5, select
28711 // fires only on input and textarea thus if there's no focused element we
28712 // won't dispatch.
28713 if (mouseDown || activeElement == null || activeElement !== getActiveElement()) {
28714 return null;
28715 }
28716
28717 // Only fire when selection has actually changed.
28718 var currentSelection = getSelection(activeElement);
28719 if (!lastSelection || !shallowEqual(lastSelection, currentSelection)) {
28720 lastSelection = currentSelection;
28721
28722 var syntheticEvent = SyntheticEvent.getPooled(eventTypes.select, activeElementInst, nativeEvent, nativeEventTarget);
28723
28724 syntheticEvent.type = 'select';
28725 syntheticEvent.target = activeElement;
28726
28727 EventPropagators.accumulateTwoPhaseDispatches(syntheticEvent);
28728
28729 return syntheticEvent;
28730 }
28731
28732 return null;
28733}
28734
28735/**
28736 * This plugin creates an `onSelect` event that normalizes select events
28737 * across form elements.
28738 *
28739 * Supported elements are:
28740 * - input (see `isTextInputElement`)
28741 * - textarea
28742 * - contentEditable
28743 *
28744 * This differs from native browser implementations in the following ways:
28745 * - Fires on contentEditable fields as well as inputs.
28746 * - Fires for collapsed selection.
28747 * - Fires after user input.
28748 */
28749var SelectEventPlugin = {
28750
28751 eventTypes: eventTypes,
28752
28753 extractEvents: function (topLevelType, targetInst, nativeEvent, nativeEventTarget) {
28754 if (!hasListener) {
28755 return null;
28756 }
28757
28758 var targetNode = targetInst ? ReactDOMComponentTree.getNodeFromInstance(targetInst) : window;
28759
28760 switch (topLevelType) {
28761 // Track the input node that has focus.
28762 case topLevelTypes.topFocus:
28763 if (isTextInputElement(targetNode) || targetNode.contentEditable === 'true') {
28764 activeElement = targetNode;
28765 activeElementInst = targetInst;
28766 lastSelection = null;
28767 }
28768 break;
28769 case topLevelTypes.topBlur:
28770 activeElement = null;
28771 activeElementInst = null;
28772 lastSelection = null;
28773 break;
28774
28775 // Don't fire the event while the user is dragging. This matches the
28776 // semantics of the native select event.
28777 case topLevelTypes.topMouseDown:
28778 mouseDown = true;
28779 break;
28780 case topLevelTypes.topContextMenu:
28781 case topLevelTypes.topMouseUp:
28782 mouseDown = false;
28783 return constructSelectEvent(nativeEvent, nativeEventTarget);
28784
28785 // Chrome and IE fire non-standard event when selection is changed (and
28786 // sometimes when it hasn't). IE's event fires out of order with respect
28787 // to key and input events on deletion, so we discard it.
28788 //
28789 // Firefox doesn't support selectionchange, so check selection status
28790 // after each key entry. The selection changes after keydown and before
28791 // keyup, but we check on keydown as well in the case of holding down a
28792 // key, when multiple keydown events are fired but only one keyup is.
28793 // This is also our approach for IE handling, for the reason above.
28794 case topLevelTypes.topSelectionChange:
28795 if (skipSelectionChangeEvent) {
28796 break;
28797 }
28798 // falls through
28799 case topLevelTypes.topKeyDown:
28800 case topLevelTypes.topKeyUp:
28801 return constructSelectEvent(nativeEvent, nativeEventTarget);
28802 }
28803
28804 return null;
28805 },
28806
28807 didPutListener: function (inst, registrationName, listener) {
28808 if (registrationName === ON_SELECT_KEY) {
28809 hasListener = true;
28810 }
28811 }
28812};
28813
28814module.exports = SelectEventPlugin;
28815},{"174":174,"178":178,"199":199,"226":226,"256":256,"287":287,"31":31,"40":40,"49":49,"54":54}],251:[function(require,module,exports){
28816(function (process){
28817/**
28818 * Copyright 2013-present, Facebook, Inc.
28819 * All rights reserved.
28820 *
28821 * This source code is licensed under the BSD-style license found in the
28822 * LICENSE file in the root directory of this source tree. An additional grant
28823 * of patent rights can be found in the PATENTS file in the same directory.
28824 *
28825 * @providesModule SimpleEventPlugin
28826 */
28827
28828'use strict';
28829
28830var EventConstants = require(174);
28831var EventListener = require(30);
28832var EventPropagators = require(178);
28833var ReactDOMComponentTree = require(199);
28834var SyntheticAnimationEvent = require(252);
28835var SyntheticClipboardEvent = require(253);
28836var SyntheticEvent = require(256);
28837var SyntheticFocusEvent = require(257);
28838var SyntheticKeyboardEvent = require(259);
28839var SyntheticMouseEvent = require(260);
28840var SyntheticDragEvent = require(255);
28841var SyntheticTouchEvent = require(261);
28842var SyntheticTransitionEvent = require(262);
28843var SyntheticUIEvent = require(263);
28844var SyntheticWheelEvent = require(264);
28845
28846var emptyFunction = require(37);
28847var getEventCharCode = require(276);
28848var invariant = require(45);
28849var keyOf = require(49);
28850
28851var topLevelTypes = EventConstants.topLevelTypes;
28852
28853var eventTypes = {
28854 abort: {
28855 phasedRegistrationNames: {
28856 bubbled: keyOf({ onAbort: true }),
28857 captured: keyOf({ onAbortCapture: true })
28858 }
28859 },
28860 animationEnd: {
28861 phasedRegistrationNames: {
28862 bubbled: keyOf({ onAnimationEnd: true }),
28863 captured: keyOf({ onAnimationEndCapture: true })
28864 }
28865 },
28866 animationIteration: {
28867 phasedRegistrationNames: {
28868 bubbled: keyOf({ onAnimationIteration: true }),
28869 captured: keyOf({ onAnimationIterationCapture: true })
28870 }
28871 },
28872 animationStart: {
28873 phasedRegistrationNames: {
28874 bubbled: keyOf({ onAnimationStart: true }),
28875 captured: keyOf({ onAnimationStartCapture: true })
28876 }
28877 },
28878 blur: {
28879 phasedRegistrationNames: {
28880 bubbled: keyOf({ onBlur: true }),
28881 captured: keyOf({ onBlurCapture: true })
28882 }
28883 },
28884 canPlay: {
28885 phasedRegistrationNames: {
28886 bubbled: keyOf({ onCanPlay: true }),
28887 captured: keyOf({ onCanPlayCapture: true })
28888 }
28889 },
28890 canPlayThrough: {
28891 phasedRegistrationNames: {
28892 bubbled: keyOf({ onCanPlayThrough: true }),
28893 captured: keyOf({ onCanPlayThroughCapture: true })
28894 }
28895 },
28896 click: {
28897 phasedRegistrationNames: {
28898 bubbled: keyOf({ onClick: true }),
28899 captured: keyOf({ onClickCapture: true })
28900 }
28901 },
28902 contextMenu: {
28903 phasedRegistrationNames: {
28904 bubbled: keyOf({ onContextMenu: true }),
28905 captured: keyOf({ onContextMenuCapture: true })
28906 }
28907 },
28908 copy: {
28909 phasedRegistrationNames: {
28910 bubbled: keyOf({ onCopy: true }),
28911 captured: keyOf({ onCopyCapture: true })
28912 }
28913 },
28914 cut: {
28915 phasedRegistrationNames: {
28916 bubbled: keyOf({ onCut: true }),
28917 captured: keyOf({ onCutCapture: true })
28918 }
28919 },
28920 doubleClick: {
28921 phasedRegistrationNames: {
28922 bubbled: keyOf({ onDoubleClick: true }),
28923 captured: keyOf({ onDoubleClickCapture: true })
28924 }
28925 },
28926 drag: {
28927 phasedRegistrationNames: {
28928 bubbled: keyOf({ onDrag: true }),
28929 captured: keyOf({ onDragCapture: true })
28930 }
28931 },
28932 dragEnd: {
28933 phasedRegistrationNames: {
28934 bubbled: keyOf({ onDragEnd: true }),
28935 captured: keyOf({ onDragEndCapture: true })
28936 }
28937 },
28938 dragEnter: {
28939 phasedRegistrationNames: {
28940 bubbled: keyOf({ onDragEnter: true }),
28941 captured: keyOf({ onDragEnterCapture: true })
28942 }
28943 },
28944 dragExit: {
28945 phasedRegistrationNames: {
28946 bubbled: keyOf({ onDragExit: true }),
28947 captured: keyOf({ onDragExitCapture: true })
28948 }
28949 },
28950 dragLeave: {
28951 phasedRegistrationNames: {
28952 bubbled: keyOf({ onDragLeave: true }),
28953 captured: keyOf({ onDragLeaveCapture: true })
28954 }
28955 },
28956 dragOver: {
28957 phasedRegistrationNames: {
28958 bubbled: keyOf({ onDragOver: true }),
28959 captured: keyOf({ onDragOverCapture: true })
28960 }
28961 },
28962 dragStart: {
28963 phasedRegistrationNames: {
28964 bubbled: keyOf({ onDragStart: true }),
28965 captured: keyOf({ onDragStartCapture: true })
28966 }
28967 },
28968 drop: {
28969 phasedRegistrationNames: {
28970 bubbled: keyOf({ onDrop: true }),
28971 captured: keyOf({ onDropCapture: true })
28972 }
28973 },
28974 durationChange: {
28975 phasedRegistrationNames: {
28976 bubbled: keyOf({ onDurationChange: true }),
28977 captured: keyOf({ onDurationChangeCapture: true })
28978 }
28979 },
28980 emptied: {
28981 phasedRegistrationNames: {
28982 bubbled: keyOf({ onEmptied: true }),
28983 captured: keyOf({ onEmptiedCapture: true })
28984 }
28985 },
28986 encrypted: {
28987 phasedRegistrationNames: {
28988 bubbled: keyOf({ onEncrypted: true }),
28989 captured: keyOf({ onEncryptedCapture: true })
28990 }
28991 },
28992 ended: {
28993 phasedRegistrationNames: {
28994 bubbled: keyOf({ onEnded: true }),
28995 captured: keyOf({ onEndedCapture: true })
28996 }
28997 },
28998 error: {
28999 phasedRegistrationNames: {
29000 bubbled: keyOf({ onError: true }),
29001 captured: keyOf({ onErrorCapture: true })
29002 }
29003 },
29004 focus: {
29005 phasedRegistrationNames: {
29006 bubbled: keyOf({ onFocus: true }),
29007 captured: keyOf({ onFocusCapture: true })
29008 }
29009 },
29010 input: {
29011 phasedRegistrationNames: {
29012 bubbled: keyOf({ onInput: true }),
29013 captured: keyOf({ onInputCapture: true })
29014 }
29015 },
29016 invalid: {
29017 phasedRegistrationNames: {
29018 bubbled: keyOf({ onInvalid: true }),
29019 captured: keyOf({ onInvalidCapture: true })
29020 }
29021 },
29022 keyDown: {
29023 phasedRegistrationNames: {
29024 bubbled: keyOf({ onKeyDown: true }),
29025 captured: keyOf({ onKeyDownCapture: true })
29026 }
29027 },
29028 keyPress: {
29029 phasedRegistrationNames: {
29030 bubbled: keyOf({ onKeyPress: true }),
29031 captured: keyOf({ onKeyPressCapture: true })
29032 }
29033 },
29034 keyUp: {
29035 phasedRegistrationNames: {
29036 bubbled: keyOf({ onKeyUp: true }),
29037 captured: keyOf({ onKeyUpCapture: true })
29038 }
29039 },
29040 load: {
29041 phasedRegistrationNames: {
29042 bubbled: keyOf({ onLoad: true }),
29043 captured: keyOf({ onLoadCapture: true })
29044 }
29045 },
29046 loadedData: {
29047 phasedRegistrationNames: {
29048 bubbled: keyOf({ onLoadedData: true }),
29049 captured: keyOf({ onLoadedDataCapture: true })
29050 }
29051 },
29052 loadedMetadata: {
29053 phasedRegistrationNames: {
29054 bubbled: keyOf({ onLoadedMetadata: true }),
29055 captured: keyOf({ onLoadedMetadataCapture: true })
29056 }
29057 },
29058 loadStart: {
29059 phasedRegistrationNames: {
29060 bubbled: keyOf({ onLoadStart: true }),
29061 captured: keyOf({ onLoadStartCapture: true })
29062 }
29063 },
29064 // Note: We do not allow listening to mouseOver events. Instead, use the
29065 // onMouseEnter/onMouseLeave created by `EnterLeaveEventPlugin`.
29066 mouseDown: {
29067 phasedRegistrationNames: {
29068 bubbled: keyOf({ onMouseDown: true }),
29069 captured: keyOf({ onMouseDownCapture: true })
29070 }
29071 },
29072 mouseMove: {
29073 phasedRegistrationNames: {
29074 bubbled: keyOf({ onMouseMove: true }),
29075 captured: keyOf({ onMouseMoveCapture: true })
29076 }
29077 },
29078 mouseOut: {
29079 phasedRegistrationNames: {
29080 bubbled: keyOf({ onMouseOut: true }),
29081 captured: keyOf({ onMouseOutCapture: true })
29082 }
29083 },
29084 mouseOver: {
29085 phasedRegistrationNames: {
29086 bubbled: keyOf({ onMouseOver: true }),
29087 captured: keyOf({ onMouseOverCapture: true })
29088 }
29089 },
29090 mouseUp: {
29091 phasedRegistrationNames: {
29092 bubbled: keyOf({ onMouseUp: true }),
29093 captured: keyOf({ onMouseUpCapture: true })
29094 }
29095 },
29096 paste: {
29097 phasedRegistrationNames: {
29098 bubbled: keyOf({ onPaste: true }),
29099 captured: keyOf({ onPasteCapture: true })
29100 }
29101 },
29102 pause: {
29103 phasedRegistrationNames: {
29104 bubbled: keyOf({ onPause: true }),
29105 captured: keyOf({ onPauseCapture: true })
29106 }
29107 },
29108 play: {
29109 phasedRegistrationNames: {
29110 bubbled: keyOf({ onPlay: true }),
29111 captured: keyOf({ onPlayCapture: true })
29112 }
29113 },
29114 playing: {
29115 phasedRegistrationNames: {
29116 bubbled: keyOf({ onPlaying: true }),
29117 captured: keyOf({ onPlayingCapture: true })
29118 }
29119 },
29120 progress: {
29121 phasedRegistrationNames: {
29122 bubbled: keyOf({ onProgress: true }),
29123 captured: keyOf({ onProgressCapture: true })
29124 }
29125 },
29126 rateChange: {
29127 phasedRegistrationNames: {
29128 bubbled: keyOf({ onRateChange: true }),
29129 captured: keyOf({ onRateChangeCapture: true })
29130 }
29131 },
29132 reset: {
29133 phasedRegistrationNames: {
29134 bubbled: keyOf({ onReset: true }),
29135 captured: keyOf({ onResetCapture: true })
29136 }
29137 },
29138 scroll: {
29139 phasedRegistrationNames: {
29140 bubbled: keyOf({ onScroll: true }),
29141 captured: keyOf({ onScrollCapture: true })
29142 }
29143 },
29144 seeked: {
29145 phasedRegistrationNames: {
29146 bubbled: keyOf({ onSeeked: true }),
29147 captured: keyOf({ onSeekedCapture: true })
29148 }
29149 },
29150 seeking: {
29151 phasedRegistrationNames: {
29152 bubbled: keyOf({ onSeeking: true }),
29153 captured: keyOf({ onSeekingCapture: true })
29154 }
29155 },
29156 stalled: {
29157 phasedRegistrationNames: {
29158 bubbled: keyOf({ onStalled: true }),
29159 captured: keyOf({ onStalledCapture: true })
29160 }
29161 },
29162 submit: {
29163 phasedRegistrationNames: {
29164 bubbled: keyOf({ onSubmit: true }),
29165 captured: keyOf({ onSubmitCapture: true })
29166 }
29167 },
29168 suspend: {
29169 phasedRegistrationNames: {
29170 bubbled: keyOf({ onSuspend: true }),
29171 captured: keyOf({ onSuspendCapture: true })
29172 }
29173 },
29174 timeUpdate: {
29175 phasedRegistrationNames: {
29176 bubbled: keyOf({ onTimeUpdate: true }),
29177 captured: keyOf({ onTimeUpdateCapture: true })
29178 }
29179 },
29180 touchCancel: {
29181 phasedRegistrationNames: {
29182 bubbled: keyOf({ onTouchCancel: true }),
29183 captured: keyOf({ onTouchCancelCapture: true })
29184 }
29185 },
29186 touchEnd: {
29187 phasedRegistrationNames: {
29188 bubbled: keyOf({ onTouchEnd: true }),
29189 captured: keyOf({ onTouchEndCapture: true })
29190 }
29191 },
29192 touchMove: {
29193 phasedRegistrationNames: {
29194 bubbled: keyOf({ onTouchMove: true }),
29195 captured: keyOf({ onTouchMoveCapture: true })
29196 }
29197 },
29198 touchStart: {
29199 phasedRegistrationNames: {
29200 bubbled: keyOf({ onTouchStart: true }),
29201 captured: keyOf({ onTouchStartCapture: true })
29202 }
29203 },
29204 transitionEnd: {
29205 phasedRegistrationNames: {
29206 bubbled: keyOf({ onTransitionEnd: true }),
29207 captured: keyOf({ onTransitionEndCapture: true })
29208 }
29209 },
29210 volumeChange: {
29211 phasedRegistrationNames: {
29212 bubbled: keyOf({ onVolumeChange: true }),
29213 captured: keyOf({ onVolumeChangeCapture: true })
29214 }
29215 },
29216 waiting: {
29217 phasedRegistrationNames: {
29218 bubbled: keyOf({ onWaiting: true }),
29219 captured: keyOf({ onWaitingCapture: true })
29220 }
29221 },
29222 wheel: {
29223 phasedRegistrationNames: {
29224 bubbled: keyOf({ onWheel: true }),
29225 captured: keyOf({ onWheelCapture: true })
29226 }
29227 }
29228};
29229
29230var topLevelEventsToDispatchConfig = {
29231 topAbort: eventTypes.abort,
29232 topAnimationEnd: eventTypes.animationEnd,
29233 topAnimationIteration: eventTypes.animationIteration,
29234 topAnimationStart: eventTypes.animationStart,
29235 topBlur: eventTypes.blur,
29236 topCanPlay: eventTypes.canPlay,
29237 topCanPlayThrough: eventTypes.canPlayThrough,
29238 topClick: eventTypes.click,
29239 topContextMenu: eventTypes.contextMenu,
29240 topCopy: eventTypes.copy,
29241 topCut: eventTypes.cut,
29242 topDoubleClick: eventTypes.doubleClick,
29243 topDrag: eventTypes.drag,
29244 topDragEnd: eventTypes.dragEnd,
29245 topDragEnter: eventTypes.dragEnter,
29246 topDragExit: eventTypes.dragExit,
29247 topDragLeave: eventTypes.dragLeave,
29248 topDragOver: eventTypes.dragOver,
29249 topDragStart: eventTypes.dragStart,
29250 topDrop: eventTypes.drop,
29251 topDurationChange: eventTypes.durationChange,
29252 topEmptied: eventTypes.emptied,
29253 topEncrypted: eventTypes.encrypted,
29254 topEnded: eventTypes.ended,
29255 topError: eventTypes.error,
29256 topFocus: eventTypes.focus,
29257 topInput: eventTypes.input,
29258 topInvalid: eventTypes.invalid,
29259 topKeyDown: eventTypes.keyDown,
29260 topKeyPress: eventTypes.keyPress,
29261 topKeyUp: eventTypes.keyUp,
29262 topLoad: eventTypes.load,
29263 topLoadedData: eventTypes.loadedData,
29264 topLoadedMetadata: eventTypes.loadedMetadata,
29265 topLoadStart: eventTypes.loadStart,
29266 topMouseDown: eventTypes.mouseDown,
29267 topMouseMove: eventTypes.mouseMove,
29268 topMouseOut: eventTypes.mouseOut,
29269 topMouseOver: eventTypes.mouseOver,
29270 topMouseUp: eventTypes.mouseUp,
29271 topPaste: eventTypes.paste,
29272 topPause: eventTypes.pause,
29273 topPlay: eventTypes.play,
29274 topPlaying: eventTypes.playing,
29275 topProgress: eventTypes.progress,
29276 topRateChange: eventTypes.rateChange,
29277 topReset: eventTypes.reset,
29278 topScroll: eventTypes.scroll,
29279 topSeeked: eventTypes.seeked,
29280 topSeeking: eventTypes.seeking,
29281 topStalled: eventTypes.stalled,
29282 topSubmit: eventTypes.submit,
29283 topSuspend: eventTypes.suspend,
29284 topTimeUpdate: eventTypes.timeUpdate,
29285 topTouchCancel: eventTypes.touchCancel,
29286 topTouchEnd: eventTypes.touchEnd,
29287 topTouchMove: eventTypes.touchMove,
29288 topTouchStart: eventTypes.touchStart,
29289 topTransitionEnd: eventTypes.transitionEnd,
29290 topVolumeChange: eventTypes.volumeChange,
29291 topWaiting: eventTypes.waiting,
29292 topWheel: eventTypes.wheel
29293};
29294
29295for (var type in topLevelEventsToDispatchConfig) {
29296 topLevelEventsToDispatchConfig[type].dependencies = [type];
29297}
29298
29299var ON_CLICK_KEY = keyOf({ onClick: null });
29300var onClickListeners = {};
29301
29302var SimpleEventPlugin = {
29303
29304 eventTypes: eventTypes,
29305
29306 extractEvents: function (topLevelType, targetInst, nativeEvent, nativeEventTarget) {
29307 var dispatchConfig = topLevelEventsToDispatchConfig[topLevelType];
29308 if (!dispatchConfig) {
29309 return null;
29310 }
29311 var EventConstructor;
29312 switch (topLevelType) {
29313 case topLevelTypes.topAbort:
29314 case topLevelTypes.topCanPlay:
29315 case topLevelTypes.topCanPlayThrough:
29316 case topLevelTypes.topDurationChange:
29317 case topLevelTypes.topEmptied:
29318 case topLevelTypes.topEncrypted:
29319 case topLevelTypes.topEnded:
29320 case topLevelTypes.topError:
29321 case topLevelTypes.topInput:
29322 case topLevelTypes.topInvalid:
29323 case topLevelTypes.topLoad:
29324 case topLevelTypes.topLoadedData:
29325 case topLevelTypes.topLoadedMetadata:
29326 case topLevelTypes.topLoadStart:
29327 case topLevelTypes.topPause:
29328 case topLevelTypes.topPlay:
29329 case topLevelTypes.topPlaying:
29330 case topLevelTypes.topProgress:
29331 case topLevelTypes.topRateChange:
29332 case topLevelTypes.topReset:
29333 case topLevelTypes.topSeeked:
29334 case topLevelTypes.topSeeking:
29335 case topLevelTypes.topStalled:
29336 case topLevelTypes.topSubmit:
29337 case topLevelTypes.topSuspend:
29338 case topLevelTypes.topTimeUpdate:
29339 case topLevelTypes.topVolumeChange:
29340 case topLevelTypes.topWaiting:
29341 // HTML Events
29342 // @see http://www.w3.org/TR/html5/index.html#events-0
29343 EventConstructor = SyntheticEvent;
29344 break;
29345 case topLevelTypes.topKeyPress:
29346 // Firefox creates a keypress event for function keys too. This removes
29347 // the unwanted keypress events. Enter is however both printable and
29348 // non-printable. One would expect Tab to be as well (but it isn't).
29349 if (getEventCharCode(nativeEvent) === 0) {
29350 return null;
29351 }
29352 /* falls through */
29353 case topLevelTypes.topKeyDown:
29354 case topLevelTypes.topKeyUp:
29355 EventConstructor = SyntheticKeyboardEvent;
29356 break;
29357 case topLevelTypes.topBlur:
29358 case topLevelTypes.topFocus:
29359 EventConstructor = SyntheticFocusEvent;
29360 break;
29361 case topLevelTypes.topClick:
29362 // Firefox creates a click event on right mouse clicks. This removes the
29363 // unwanted click events.
29364 if (nativeEvent.button === 2) {
29365 return null;
29366 }
29367 /* falls through */
29368 case topLevelTypes.topContextMenu:
29369 case topLevelTypes.topDoubleClick:
29370 case topLevelTypes.topMouseDown:
29371 case topLevelTypes.topMouseMove:
29372 case topLevelTypes.topMouseOut:
29373 case topLevelTypes.topMouseOver:
29374 case topLevelTypes.topMouseUp:
29375 EventConstructor = SyntheticMouseEvent;
29376 break;
29377 case topLevelTypes.topDrag:
29378 case topLevelTypes.topDragEnd:
29379 case topLevelTypes.topDragEnter:
29380 case topLevelTypes.topDragExit:
29381 case topLevelTypes.topDragLeave:
29382 case topLevelTypes.topDragOver:
29383 case topLevelTypes.topDragStart:
29384 case topLevelTypes.topDrop:
29385 EventConstructor = SyntheticDragEvent;
29386 break;
29387 case topLevelTypes.topTouchCancel:
29388 case topLevelTypes.topTouchEnd:
29389 case topLevelTypes.topTouchMove:
29390 case topLevelTypes.topTouchStart:
29391 EventConstructor = SyntheticTouchEvent;
29392 break;
29393 case topLevelTypes.topAnimationEnd:
29394 case topLevelTypes.topAnimationIteration:
29395 case topLevelTypes.topAnimationStart:
29396 EventConstructor = SyntheticAnimationEvent;
29397 break;
29398 case topLevelTypes.topTransitionEnd:
29399 EventConstructor = SyntheticTransitionEvent;
29400 break;
29401 case topLevelTypes.topScroll:
29402 EventConstructor = SyntheticUIEvent;
29403 break;
29404 case topLevelTypes.topWheel:
29405 EventConstructor = SyntheticWheelEvent;
29406 break;
29407 case topLevelTypes.topCopy:
29408 case topLevelTypes.topCut:
29409 case topLevelTypes.topPaste:
29410 EventConstructor = SyntheticClipboardEvent;
29411 break;
29412 }
29413 !EventConstructor ? process.env.NODE_ENV !== 'production' ? invariant(false, 'SimpleEventPlugin: Unhandled event type, `%s`.', topLevelType) : invariant(false) : void 0;
29414 var event = EventConstructor.getPooled(dispatchConfig, targetInst, nativeEvent, nativeEventTarget);
29415 EventPropagators.accumulateTwoPhaseDispatches(event);
29416 return event;
29417 },
29418
29419 didPutListener: function (inst, registrationName, listener) {
29420 // Mobile Safari does not fire properly bubble click events on
29421 // non-interactive elements, which means delegated click listeners do not
29422 // fire. The workaround for this bug involves attaching an empty click
29423 // listener on the target node.
29424 if (registrationName === ON_CLICK_KEY) {
29425 var id = inst._rootNodeID;
29426 var node = ReactDOMComponentTree.getNodeFromInstance(inst);
29427 if (!onClickListeners[id]) {
29428 onClickListeners[id] = EventListener.listen(node, 'click', emptyFunction);
29429 }
29430 }
29431 },
29432
29433 willDeleteListener: function (inst, registrationName) {
29434 if (registrationName === ON_CLICK_KEY) {
29435 var id = inst._rootNodeID;
29436 onClickListeners[id].remove();
29437 delete onClickListeners[id];
29438 }
29439 }
29440
29441};
29442
29443module.exports = SimpleEventPlugin;
29444}).call(this,require(91))
29445},{"174":174,"178":178,"199":199,"252":252,"253":253,"255":255,"256":256,"257":257,"259":259,"260":260,"261":261,"262":262,"263":263,"264":264,"276":276,"30":30,"37":37,"45":45,"49":49,"91":91}],252:[function(require,module,exports){
29446/**
29447 * Copyright 2013-present, Facebook, Inc.
29448 * All rights reserved.
29449 *
29450 * This source code is licensed under the BSD-style license found in the
29451 * LICENSE file in the root directory of this source tree. An additional grant
29452 * of patent rights can be found in the PATENTS file in the same directory.
29453 *
29454 * @providesModule SyntheticAnimationEvent
29455 */
29456
29457'use strict';
29458
29459var SyntheticEvent = require(256);
29460
29461/**
29462 * @interface Event
29463 * @see http://www.w3.org/TR/css3-animations/#AnimationEvent-interface
29464 * @see https://developer.mozilla.org/en-US/docs/Web/API/AnimationEvent
29465 */
29466var AnimationEventInterface = {
29467 animationName: null,
29468 elapsedTime: null,
29469 pseudoElement: null
29470};
29471
29472/**
29473 * @param {object} dispatchConfig Configuration used to dispatch this event.
29474 * @param {string} dispatchMarker Marker identifying the event target.
29475 * @param {object} nativeEvent Native browser event.
29476 * @extends {SyntheticEvent}
29477 */
29478function SyntheticAnimationEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) {
29479 return SyntheticEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget);
29480}
29481
29482SyntheticEvent.augmentClass(SyntheticAnimationEvent, AnimationEventInterface);
29483
29484module.exports = SyntheticAnimationEvent;
29485},{"256":256}],253:[function(require,module,exports){
29486/**
29487 * Copyright 2013-present, Facebook, Inc.
29488 * All rights reserved.
29489 *
29490 * This source code is licensed under the BSD-style license found in the
29491 * LICENSE file in the root directory of this source tree. An additional grant
29492 * of patent rights can be found in the PATENTS file in the same directory.
29493 *
29494 * @providesModule SyntheticClipboardEvent
29495 */
29496
29497'use strict';
29498
29499var SyntheticEvent = require(256);
29500
29501/**
29502 * @interface Event
29503 * @see http://www.w3.org/TR/clipboard-apis/
29504 */
29505var ClipboardEventInterface = {
29506 clipboardData: function (event) {
29507 return 'clipboardData' in event ? event.clipboardData : window.clipboardData;
29508 }
29509};
29510
29511/**
29512 * @param {object} dispatchConfig Configuration used to dispatch this event.
29513 * @param {string} dispatchMarker Marker identifying the event target.
29514 * @param {object} nativeEvent Native browser event.
29515 * @extends {SyntheticUIEvent}
29516 */
29517function SyntheticClipboardEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) {
29518 return SyntheticEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget);
29519}
29520
29521SyntheticEvent.augmentClass(SyntheticClipboardEvent, ClipboardEventInterface);
29522
29523module.exports = SyntheticClipboardEvent;
29524},{"256":256}],254:[function(require,module,exports){
29525/**
29526 * Copyright 2013-present, Facebook, Inc.
29527 * All rights reserved.
29528 *
29529 * This source code is licensed under the BSD-style license found in the
29530 * LICENSE file in the root directory of this source tree. An additional grant
29531 * of patent rights can be found in the PATENTS file in the same directory.
29532 *
29533 * @providesModule SyntheticCompositionEvent
29534 */
29535
29536'use strict';
29537
29538var SyntheticEvent = require(256);
29539
29540/**
29541 * @interface Event
29542 * @see http://www.w3.org/TR/DOM-Level-3-Events/#events-compositionevents
29543 */
29544var CompositionEventInterface = {
29545 data: null
29546};
29547
29548/**
29549 * @param {object} dispatchConfig Configuration used to dispatch this event.
29550 * @param {string} dispatchMarker Marker identifying the event target.
29551 * @param {object} nativeEvent Native browser event.
29552 * @extends {SyntheticUIEvent}
29553 */
29554function SyntheticCompositionEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) {
29555 return SyntheticEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget);
29556}
29557
29558SyntheticEvent.augmentClass(SyntheticCompositionEvent, CompositionEventInterface);
29559
29560module.exports = SyntheticCompositionEvent;
29561},{"256":256}],255:[function(require,module,exports){
29562/**
29563 * Copyright 2013-present, Facebook, Inc.
29564 * All rights reserved.
29565 *
29566 * This source code is licensed under the BSD-style license found in the
29567 * LICENSE file in the root directory of this source tree. An additional grant
29568 * of patent rights can be found in the PATENTS file in the same directory.
29569 *
29570 * @providesModule SyntheticDragEvent
29571 */
29572
29573'use strict';
29574
29575var SyntheticMouseEvent = require(260);
29576
29577/**
29578 * @interface DragEvent
29579 * @see http://www.w3.org/TR/DOM-Level-3-Events/
29580 */
29581var DragEventInterface = {
29582 dataTransfer: null
29583};
29584
29585/**
29586 * @param {object} dispatchConfig Configuration used to dispatch this event.
29587 * @param {string} dispatchMarker Marker identifying the event target.
29588 * @param {object} nativeEvent Native browser event.
29589 * @extends {SyntheticUIEvent}
29590 */
29591function SyntheticDragEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) {
29592 return SyntheticMouseEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget);
29593}
29594
29595SyntheticMouseEvent.augmentClass(SyntheticDragEvent, DragEventInterface);
29596
29597module.exports = SyntheticDragEvent;
29598},{"260":260}],256:[function(require,module,exports){
29599(function (process){
29600/**
29601 * Copyright 2013-present, Facebook, Inc.
29602 * All rights reserved.
29603 *
29604 * This source code is licensed under the BSD-style license found in the
29605 * LICENSE file in the root directory of this source tree. An additional grant
29606 * of patent rights can be found in the PATENTS file in the same directory.
29607 *
29608 * @providesModule SyntheticEvent
29609 */
29610
29611'use strict';
29612
29613var _assign = require(296);
29614
29615var PooledClass = require(183);
29616
29617var emptyFunction = require(37);
29618var warning = require(55);
29619
29620var didWarnForAddedNewProperty = false;
29621var isProxySupported = typeof Proxy === 'function';
29622
29623var shouldBeReleasedProperties = ['dispatchConfig', '_targetInst', 'nativeEvent', 'isDefaultPrevented', 'isPropagationStopped', '_dispatchListeners', '_dispatchInstances'];
29624
29625/**
29626 * @interface Event
29627 * @see http://www.w3.org/TR/DOM-Level-3-Events/
29628 */
29629var EventInterface = {
29630 type: null,
29631 target: null,
29632 // currentTarget is set when dispatching; no use in copying it here
29633 currentTarget: emptyFunction.thatReturnsNull,
29634 eventPhase: null,
29635 bubbles: null,
29636 cancelable: null,
29637 timeStamp: function (event) {
29638 return event.timeStamp || Date.now();
29639 },
29640 defaultPrevented: null,
29641 isTrusted: null
29642};
29643
29644/**
29645 * Synthetic events are dispatched by event plugins, typically in response to a
29646 * top-level event delegation handler.
29647 *
29648 * These systems should generally use pooling to reduce the frequency of garbage
29649 * collection. The system should check `isPersistent` to determine whether the
29650 * event should be released into the pool after being dispatched. Users that
29651 * need a persisted event should invoke `persist`.
29652 *
29653 * Synthetic events (and subclasses) implement the DOM Level 3 Events API by
29654 * normalizing browser quirks. Subclasses do not necessarily have to implement a
29655 * DOM interface; custom application-specific events can also subclass this.
29656 *
29657 * @param {object} dispatchConfig Configuration used to dispatch this event.
29658 * @param {*} targetInst Marker identifying the event target.
29659 * @param {object} nativeEvent Native browser event.
29660 * @param {DOMEventTarget} nativeEventTarget Target node.
29661 */
29662function SyntheticEvent(dispatchConfig, targetInst, nativeEvent, nativeEventTarget) {
29663 if (process.env.NODE_ENV !== 'production') {
29664 // these have a getter/setter for warnings
29665 delete this.nativeEvent;
29666 delete this.preventDefault;
29667 delete this.stopPropagation;
29668 }
29669
29670 this.dispatchConfig = dispatchConfig;
29671 this._targetInst = targetInst;
29672 this.nativeEvent = nativeEvent;
29673
29674 var Interface = this.constructor.Interface;
29675 for (var propName in Interface) {
29676 if (!Interface.hasOwnProperty(propName)) {
29677 continue;
29678 }
29679 if (process.env.NODE_ENV !== 'production') {
29680 delete this[propName]; // this has a getter/setter for warnings
29681 }
29682 var normalize = Interface[propName];
29683 if (normalize) {
29684 this[propName] = normalize(nativeEvent);
29685 } else {
29686 if (propName === 'target') {
29687 this.target = nativeEventTarget;
29688 } else {
29689 this[propName] = nativeEvent[propName];
29690 }
29691 }
29692 }
29693
29694 var defaultPrevented = nativeEvent.defaultPrevented != null ? nativeEvent.defaultPrevented : nativeEvent.returnValue === false;
29695 if (defaultPrevented) {
29696 this.isDefaultPrevented = emptyFunction.thatReturnsTrue;
29697 } else {
29698 this.isDefaultPrevented = emptyFunction.thatReturnsFalse;
29699 }
29700 this.isPropagationStopped = emptyFunction.thatReturnsFalse;
29701 return this;
29702}
29703
29704_assign(SyntheticEvent.prototype, {
29705
29706 preventDefault: function () {
29707 this.defaultPrevented = true;
29708 var event = this.nativeEvent;
29709 if (!event) {
29710 return;
29711 }
29712
29713 if (event.preventDefault) {
29714 event.preventDefault();
29715 } else {
29716 event.returnValue = false;
29717 }
29718 this.isDefaultPrevented = emptyFunction.thatReturnsTrue;
29719 },
29720
29721 stopPropagation: function () {
29722 var event = this.nativeEvent;
29723 if (!event) {
29724 return;
29725 }
29726
29727 if (event.stopPropagation) {
29728 event.stopPropagation();
29729 } else {
29730 event.cancelBubble = true;
29731 }
29732 this.isPropagationStopped = emptyFunction.thatReturnsTrue;
29733 },
29734
29735 /**
29736 * We release all dispatched `SyntheticEvent`s after each event loop, adding
29737 * them back into the pool. This allows a way to hold onto a reference that
29738 * won't be added back into the pool.
29739 */
29740 persist: function () {
29741 this.isPersistent = emptyFunction.thatReturnsTrue;
29742 },
29743
29744 /**
29745 * Checks if this event should be released back into the pool.
29746 *
29747 * @return {boolean} True if this should not be released, false otherwise.
29748 */
29749 isPersistent: emptyFunction.thatReturnsFalse,
29750
29751 /**
29752 * `PooledClass` looks for `destructor` on each instance it releases.
29753 */
29754 destructor: function () {
29755 var Interface = this.constructor.Interface;
29756 for (var propName in Interface) {
29757 if (process.env.NODE_ENV !== 'production') {
29758 Object.defineProperty(this, propName, getPooledWarningPropertyDefinition(propName, Interface[propName]));
29759 } else {
29760 this[propName] = null;
29761 }
29762 }
29763 for (var i = 0; i < shouldBeReleasedProperties.length; i++) {
29764 this[shouldBeReleasedProperties[i]] = null;
29765 }
29766 if (process.env.NODE_ENV !== 'production') {
29767 var noop = require(37);
29768 Object.defineProperty(this, 'nativeEvent', getPooledWarningPropertyDefinition('nativeEvent', null));
29769 Object.defineProperty(this, 'preventDefault', getPooledWarningPropertyDefinition('preventDefault', noop));
29770 Object.defineProperty(this, 'stopPropagation', getPooledWarningPropertyDefinition('stopPropagation', noop));
29771 }
29772 }
29773
29774});
29775
29776SyntheticEvent.Interface = EventInterface;
29777
29778if (process.env.NODE_ENV !== 'production') {
29779 if (isProxySupported) {
29780 /*eslint-disable no-func-assign */
29781 SyntheticEvent = new Proxy(SyntheticEvent, {
29782 construct: function (target, args) {
29783 return this.apply(target, Object.create(target.prototype), args);
29784 },
29785 apply: function (constructor, that, args) {
29786 return new Proxy(constructor.apply(that, args), {
29787 set: function (target, prop, value) {
29788 if (prop !== 'isPersistent' && !target.constructor.Interface.hasOwnProperty(prop) && shouldBeReleasedProperties.indexOf(prop) === -1) {
29789 process.env.NODE_ENV !== 'production' ? warning(didWarnForAddedNewProperty || target.isPersistent(), 'This synthetic event is reused for performance reasons. If you\'re ' + 'seeing this, you\'re adding a new property in the synthetic event object. ' + 'The property is never released. See ' + 'https://fb.me/react-event-pooling for more information.') : void 0;
29790 didWarnForAddedNewProperty = true;
29791 }
29792 target[prop] = value;
29793 return true;
29794 }
29795 });
29796 }
29797 });
29798 /*eslint-enable no-func-assign */
29799 }
29800}
29801/**
29802 * Helper to reduce boilerplate when creating subclasses.
29803 *
29804 * @param {function} Class
29805 * @param {?object} Interface
29806 */
29807SyntheticEvent.augmentClass = function (Class, Interface) {
29808 var Super = this;
29809
29810 var E = function () {};
29811 E.prototype = Super.prototype;
29812 var prototype = new E();
29813
29814 _assign(prototype, Class.prototype);
29815 Class.prototype = prototype;
29816 Class.prototype.constructor = Class;
29817
29818 Class.Interface = _assign({}, Super.Interface, Interface);
29819 Class.augmentClass = Super.augmentClass;
29820
29821 PooledClass.addPoolingTo(Class, PooledClass.fourArgumentPooler);
29822};
29823
29824PooledClass.addPoolingTo(SyntheticEvent, PooledClass.fourArgumentPooler);
29825
29826module.exports = SyntheticEvent;
29827
29828/**
29829 * Helper to nullify syntheticEvent instance properties when destructing
29830 *
29831 * @param {object} SyntheticEvent
29832 * @param {String} propName
29833 * @return {object} defineProperty object
29834 */
29835function getPooledWarningPropertyDefinition(propName, getVal) {
29836 var isFunction = typeof getVal === 'function';
29837 return {
29838 configurable: true,
29839 set: set,
29840 get: get
29841 };
29842
29843 function set(val) {
29844 var action = isFunction ? 'setting the method' : 'setting the property';
29845 warn(action, 'This is effectively a no-op');
29846 return val;
29847 }
29848
29849 function get() {
29850 var action = isFunction ? 'accessing the method' : 'accessing the property';
29851 var result = isFunction ? 'This is a no-op function' : 'This is set to null';
29852 warn(action, result);
29853 return getVal;
29854 }
29855
29856 function warn(action, result) {
29857 var warningCondition = false;
29858 process.env.NODE_ENV !== 'production' ? warning(warningCondition, 'This synthetic event is reused for performance reasons. If you\'re seeing this, ' + 'you\'re %s `%s` on a released/nullified synthetic event. %s. ' + 'If you must keep the original synthetic event around, use event.persist(). ' + 'See https://fb.me/react-event-pooling for more information.', action, propName, result) : void 0;
29859 }
29860}
29861}).call(this,require(91))
29862},{"183":183,"296":296,"37":37,"55":55,"91":91}],257:[function(require,module,exports){
29863/**
29864 * Copyright 2013-present, Facebook, Inc.
29865 * All rights reserved.
29866 *
29867 * This source code is licensed under the BSD-style license found in the
29868 * LICENSE file in the root directory of this source tree. An additional grant
29869 * of patent rights can be found in the PATENTS file in the same directory.
29870 *
29871 * @providesModule SyntheticFocusEvent
29872 */
29873
29874'use strict';
29875
29876var SyntheticUIEvent = require(263);
29877
29878/**
29879 * @interface FocusEvent
29880 * @see http://www.w3.org/TR/DOM-Level-3-Events/
29881 */
29882var FocusEventInterface = {
29883 relatedTarget: null
29884};
29885
29886/**
29887 * @param {object} dispatchConfig Configuration used to dispatch this event.
29888 * @param {string} dispatchMarker Marker identifying the event target.
29889 * @param {object} nativeEvent Native browser event.
29890 * @extends {SyntheticUIEvent}
29891 */
29892function SyntheticFocusEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) {
29893 return SyntheticUIEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget);
29894}
29895
29896SyntheticUIEvent.augmentClass(SyntheticFocusEvent, FocusEventInterface);
29897
29898module.exports = SyntheticFocusEvent;
29899},{"263":263}],258:[function(require,module,exports){
29900/**
29901 * Copyright 2013-present, Facebook, Inc.
29902 * All rights reserved.
29903 *
29904 * This source code is licensed under the BSD-style license found in the
29905 * LICENSE file in the root directory of this source tree. An additional grant
29906 * of patent rights can be found in the PATENTS file in the same directory.
29907 *
29908 * @providesModule SyntheticInputEvent
29909 */
29910
29911'use strict';
29912
29913var SyntheticEvent = require(256);
29914
29915/**
29916 * @interface Event
29917 * @see http://www.w3.org/TR/2013/WD-DOM-Level-3-Events-20131105
29918 * /#events-inputevents
29919 */
29920var InputEventInterface = {
29921 data: null
29922};
29923
29924/**
29925 * @param {object} dispatchConfig Configuration used to dispatch this event.
29926 * @param {string} dispatchMarker Marker identifying the event target.
29927 * @param {object} nativeEvent Native browser event.
29928 * @extends {SyntheticUIEvent}
29929 */
29930function SyntheticInputEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) {
29931 return SyntheticEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget);
29932}
29933
29934SyntheticEvent.augmentClass(SyntheticInputEvent, InputEventInterface);
29935
29936module.exports = SyntheticInputEvent;
29937},{"256":256}],259:[function(require,module,exports){
29938/**
29939 * Copyright 2013-present, Facebook, Inc.
29940 * All rights reserved.
29941 *
29942 * This source code is licensed under the BSD-style license found in the
29943 * LICENSE file in the root directory of this source tree. An additional grant
29944 * of patent rights can be found in the PATENTS file in the same directory.
29945 *
29946 * @providesModule SyntheticKeyboardEvent
29947 */
29948
29949'use strict';
29950
29951var SyntheticUIEvent = require(263);
29952
29953var getEventCharCode = require(276);
29954var getEventKey = require(277);
29955var getEventModifierState = require(278);
29956
29957/**
29958 * @interface KeyboardEvent
29959 * @see http://www.w3.org/TR/DOM-Level-3-Events/
29960 */
29961var KeyboardEventInterface = {
29962 key: getEventKey,
29963 location: null,
29964 ctrlKey: null,
29965 shiftKey: null,
29966 altKey: null,
29967 metaKey: null,
29968 repeat: null,
29969 locale: null,
29970 getModifierState: getEventModifierState,
29971 // Legacy Interface
29972 charCode: function (event) {
29973 // `charCode` is the result of a KeyPress event and represents the value of
29974 // the actual printable character.
29975
29976 // KeyPress is deprecated, but its replacement is not yet final and not
29977 // implemented in any major browser. Only KeyPress has charCode.
29978 if (event.type === 'keypress') {
29979 return getEventCharCode(event);
29980 }
29981 return 0;
29982 },
29983 keyCode: function (event) {
29984 // `keyCode` is the result of a KeyDown/Up event and represents the value of
29985 // physical keyboard key.
29986
29987 // The actual meaning of the value depends on the users' keyboard layout
29988 // which cannot be detected. Assuming that it is a US keyboard layout
29989 // provides a surprisingly accurate mapping for US and European users.
29990 // Due to this, it is left to the user to implement at this time.
29991 if (event.type === 'keydown' || event.type === 'keyup') {
29992 return event.keyCode;
29993 }
29994 return 0;
29995 },
29996 which: function (event) {
29997 // `which` is an alias for either `keyCode` or `charCode` depending on the
29998 // type of the event.
29999 if (event.type === 'keypress') {
30000 return getEventCharCode(event);
30001 }
30002 if (event.type === 'keydown' || event.type === 'keyup') {
30003 return event.keyCode;
30004 }
30005 return 0;
30006 }
30007};
30008
30009/**
30010 * @param {object} dispatchConfig Configuration used to dispatch this event.
30011 * @param {string} dispatchMarker Marker identifying the event target.
30012 * @param {object} nativeEvent Native browser event.
30013 * @extends {SyntheticUIEvent}
30014 */
30015function SyntheticKeyboardEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) {
30016 return SyntheticUIEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget);
30017}
30018
30019SyntheticUIEvent.augmentClass(SyntheticKeyboardEvent, KeyboardEventInterface);
30020
30021module.exports = SyntheticKeyboardEvent;
30022},{"263":263,"276":276,"277":277,"278":278}],260:[function(require,module,exports){
30023/**
30024 * Copyright 2013-present, Facebook, Inc.
30025 * All rights reserved.
30026 *
30027 * This source code is licensed under the BSD-style license found in the
30028 * LICENSE file in the root directory of this source tree. An additional grant
30029 * of patent rights can be found in the PATENTS file in the same directory.
30030 *
30031 * @providesModule SyntheticMouseEvent
30032 */
30033
30034'use strict';
30035
30036var SyntheticUIEvent = require(263);
30037var ViewportMetrics = require(266);
30038
30039var getEventModifierState = require(278);
30040
30041/**
30042 * @interface MouseEvent
30043 * @see http://www.w3.org/TR/DOM-Level-3-Events/
30044 */
30045var MouseEventInterface = {
30046 screenX: null,
30047 screenY: null,
30048 clientX: null,
30049 clientY: null,
30050 ctrlKey: null,
30051 shiftKey: null,
30052 altKey: null,
30053 metaKey: null,
30054 getModifierState: getEventModifierState,
30055 button: function (event) {
30056 // Webkit, Firefox, IE9+
30057 // which: 1 2 3
30058 // button: 0 1 2 (standard)
30059 var button = event.button;
30060 if ('which' in event) {
30061 return button;
30062 }
30063 // IE<9
30064 // which: undefined
30065 // button: 0 0 0
30066 // button: 1 4 2 (onmouseup)
30067 return button === 2 ? 2 : button === 4 ? 1 : 0;
30068 },
30069 buttons: null,
30070 relatedTarget: function (event) {
30071 return event.relatedTarget || (event.fromElement === event.srcElement ? event.toElement : event.fromElement);
30072 },
30073 // "Proprietary" Interface.
30074 pageX: function (event) {
30075 return 'pageX' in event ? event.pageX : event.clientX + ViewportMetrics.currentScrollLeft;
30076 },
30077 pageY: function (event) {
30078 return 'pageY' in event ? event.pageY : event.clientY + ViewportMetrics.currentScrollTop;
30079 }
30080};
30081
30082/**
30083 * @param {object} dispatchConfig Configuration used to dispatch this event.
30084 * @param {string} dispatchMarker Marker identifying the event target.
30085 * @param {object} nativeEvent Native browser event.
30086 * @extends {SyntheticUIEvent}
30087 */
30088function SyntheticMouseEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) {
30089 return SyntheticUIEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget);
30090}
30091
30092SyntheticUIEvent.augmentClass(SyntheticMouseEvent, MouseEventInterface);
30093
30094module.exports = SyntheticMouseEvent;
30095},{"263":263,"266":266,"278":278}],261:[function(require,module,exports){
30096/**
30097 * Copyright 2013-present, Facebook, Inc.
30098 * All rights reserved.
30099 *
30100 * This source code is licensed under the BSD-style license found in the
30101 * LICENSE file in the root directory of this source tree. An additional grant
30102 * of patent rights can be found in the PATENTS file in the same directory.
30103 *
30104 * @providesModule SyntheticTouchEvent
30105 */
30106
30107'use strict';
30108
30109var SyntheticUIEvent = require(263);
30110
30111var getEventModifierState = require(278);
30112
30113/**
30114 * @interface TouchEvent
30115 * @see http://www.w3.org/TR/touch-events/
30116 */
30117var TouchEventInterface = {
30118 touches: null,
30119 targetTouches: null,
30120 changedTouches: null,
30121 altKey: null,
30122 metaKey: null,
30123 ctrlKey: null,
30124 shiftKey: null,
30125 getModifierState: getEventModifierState
30126};
30127
30128/**
30129 * @param {object} dispatchConfig Configuration used to dispatch this event.
30130 * @param {string} dispatchMarker Marker identifying the event target.
30131 * @param {object} nativeEvent Native browser event.
30132 * @extends {SyntheticUIEvent}
30133 */
30134function SyntheticTouchEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) {
30135 return SyntheticUIEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget);
30136}
30137
30138SyntheticUIEvent.augmentClass(SyntheticTouchEvent, TouchEventInterface);
30139
30140module.exports = SyntheticTouchEvent;
30141},{"263":263,"278":278}],262:[function(require,module,exports){
30142/**
30143 * Copyright 2013-present, Facebook, Inc.
30144 * All rights reserved.
30145 *
30146 * This source code is licensed under the BSD-style license found in the
30147 * LICENSE file in the root directory of this source tree. An additional grant
30148 * of patent rights can be found in the PATENTS file in the same directory.
30149 *
30150 * @providesModule SyntheticTransitionEvent
30151 */
30152
30153'use strict';
30154
30155var SyntheticEvent = require(256);
30156
30157/**
30158 * @interface Event
30159 * @see http://www.w3.org/TR/2009/WD-css3-transitions-20090320/#transition-events-
30160 * @see https://developer.mozilla.org/en-US/docs/Web/API/TransitionEvent
30161 */
30162var TransitionEventInterface = {
30163 propertyName: null,
30164 elapsedTime: null,
30165 pseudoElement: null
30166};
30167
30168/**
30169 * @param {object} dispatchConfig Configuration used to dispatch this event.
30170 * @param {string} dispatchMarker Marker identifying the event target.
30171 * @param {object} nativeEvent Native browser event.
30172 * @extends {SyntheticEvent}
30173 */
30174function SyntheticTransitionEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) {
30175 return SyntheticEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget);
30176}
30177
30178SyntheticEvent.augmentClass(SyntheticTransitionEvent, TransitionEventInterface);
30179
30180module.exports = SyntheticTransitionEvent;
30181},{"256":256}],263:[function(require,module,exports){
30182/**
30183 * Copyright 2013-present, Facebook, Inc.
30184 * All rights reserved.
30185 *
30186 * This source code is licensed under the BSD-style license found in the
30187 * LICENSE file in the root directory of this source tree. An additional grant
30188 * of patent rights can be found in the PATENTS file in the same directory.
30189 *
30190 * @providesModule SyntheticUIEvent
30191 */
30192
30193'use strict';
30194
30195var SyntheticEvent = require(256);
30196
30197var getEventTarget = require(279);
30198
30199/**
30200 * @interface UIEvent
30201 * @see http://www.w3.org/TR/DOM-Level-3-Events/
30202 */
30203var UIEventInterface = {
30204 view: function (event) {
30205 if (event.view) {
30206 return event.view;
30207 }
30208
30209 var target = getEventTarget(event);
30210 if (target != null && target.window === target) {
30211 // target is a window object
30212 return target;
30213 }
30214
30215 var doc = target.ownerDocument;
30216 // TODO: Figure out why `ownerDocument` is sometimes undefined in IE8.
30217 if (doc) {
30218 return doc.defaultView || doc.parentWindow;
30219 } else {
30220 return window;
30221 }
30222 },
30223 detail: function (event) {
30224 return event.detail || 0;
30225 }
30226};
30227
30228/**
30229 * @param {object} dispatchConfig Configuration used to dispatch this event.
30230 * @param {string} dispatchMarker Marker identifying the event target.
30231 * @param {object} nativeEvent Native browser event.
30232 * @extends {SyntheticEvent}
30233 */
30234function SyntheticUIEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) {
30235 return SyntheticEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget);
30236}
30237
30238SyntheticEvent.augmentClass(SyntheticUIEvent, UIEventInterface);
30239
30240module.exports = SyntheticUIEvent;
30241},{"256":256,"279":279}],264:[function(require,module,exports){
30242/**
30243 * Copyright 2013-present, Facebook, Inc.
30244 * All rights reserved.
30245 *
30246 * This source code is licensed under the BSD-style license found in the
30247 * LICENSE file in the root directory of this source tree. An additional grant
30248 * of patent rights can be found in the PATENTS file in the same directory.
30249 *
30250 * @providesModule SyntheticWheelEvent
30251 */
30252
30253'use strict';
30254
30255var SyntheticMouseEvent = require(260);
30256
30257/**
30258 * @interface WheelEvent
30259 * @see http://www.w3.org/TR/DOM-Level-3-Events/
30260 */
30261var WheelEventInterface = {
30262 deltaX: function (event) {
30263 return 'deltaX' in event ? event.deltaX :
30264 // Fallback to `wheelDeltaX` for Webkit and normalize (right is positive).
30265 'wheelDeltaX' in event ? -event.wheelDeltaX : 0;
30266 },
30267 deltaY: function (event) {
30268 return 'deltaY' in event ? event.deltaY :
30269 // Fallback to `wheelDeltaY` for Webkit and normalize (down is positive).
30270 'wheelDeltaY' in event ? -event.wheelDeltaY :
30271 // Fallback to `wheelDelta` for IE<9 and normalize (down is positive).
30272 'wheelDelta' in event ? -event.wheelDelta : 0;
30273 },
30274 deltaZ: null,
30275
30276 // Browsers without "deltaMode" is reporting in raw wheel delta where one
30277 // notch on the scroll is always +/- 120, roughly equivalent to pixels.
30278 // A good approximation of DOM_DELTA_LINE (1) is 5% of viewport size or
30279 // ~40 pixels, for DOM_DELTA_SCREEN (2) it is 87.5% of viewport size.
30280 deltaMode: null
30281};
30282
30283/**
30284 * @param {object} dispatchConfig Configuration used to dispatch this event.
30285 * @param {string} dispatchMarker Marker identifying the event target.
30286 * @param {object} nativeEvent Native browser event.
30287 * @extends {SyntheticMouseEvent}
30288 */
30289function SyntheticWheelEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) {
30290 return SyntheticMouseEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget);
30291}
30292
30293SyntheticMouseEvent.augmentClass(SyntheticWheelEvent, WheelEventInterface);
30294
30295module.exports = SyntheticWheelEvent;
30296},{"260":260}],265:[function(require,module,exports){
30297(function (process){
30298/**
30299 * Copyright 2013-present, Facebook, Inc.
30300 * All rights reserved.
30301 *
30302 * This source code is licensed under the BSD-style license found in the
30303 * LICENSE file in the root directory of this source tree. An additional grant
30304 * of patent rights can be found in the PATENTS file in the same directory.
30305 *
30306 * @providesModule Transaction
30307 */
30308
30309'use strict';
30310
30311var invariant = require(45);
30312
30313/**
30314 * `Transaction` creates a black box that is able to wrap any method such that
30315 * certain invariants are maintained before and after the method is invoked
30316 * (Even if an exception is thrown while invoking the wrapped method). Whoever
30317 * instantiates a transaction can provide enforcers of the invariants at
30318 * creation time. The `Transaction` class itself will supply one additional
30319 * automatic invariant for you - the invariant that any transaction instance
30320 * should not be run while it is already being run. You would typically create a
30321 * single instance of a `Transaction` for reuse multiple times, that potentially
30322 * is used to wrap several different methods. Wrappers are extremely simple -
30323 * they only require implementing two methods.
30324 *
30325 * <pre>
30326 * wrappers (injected at creation time)
30327 * + +
30328 * | |
30329 * +-----------------|--------|--------------+
30330 * | v | |
30331 * | +---------------+ | |
30332 * | +--| wrapper1 |---|----+ |
30333 * | | +---------------+ v | |
30334 * | | +-------------+ | |
30335 * | | +----| wrapper2 |--------+ |
30336 * | | | +-------------+ | | |
30337 * | | | | | |
30338 * | v v v v | wrapper
30339 * | +---+ +---+ +---------+ +---+ +---+ | invariants
30340 * perform(anyMethod) | | | | | | | | | | | | maintained
30341 * +----------------->|-|---|-|---|-->|anyMethod|---|---|-|---|-|-------->
30342 * | | | | | | | | | | | |
30343 * | | | | | | | | | | | |
30344 * | | | | | | | | | | | |
30345 * | +---+ +---+ +---------+ +---+ +---+ |
30346 * | initialize close |
30347 * +-----------------------------------------+
30348 * </pre>
30349 *
30350 * Use cases:
30351 * - Preserving the input selection ranges before/after reconciliation.
30352 * Restoring selection even in the event of an unexpected error.
30353 * - Deactivating events while rearranging the DOM, preventing blurs/focuses,
30354 * while guaranteeing that afterwards, the event system is reactivated.
30355 * - Flushing a queue of collected DOM mutations to the main UI thread after a
30356 * reconciliation takes place in a worker thread.
30357 * - Invoking any collected `componentDidUpdate` callbacks after rendering new
30358 * content.
30359 * - (Future use case): Wrapping particular flushes of the `ReactWorker` queue
30360 * to preserve the `scrollTop` (an automatic scroll aware DOM).
30361 * - (Future use case): Layout calculations before and after DOM updates.
30362 *
30363 * Transactional plugin API:
30364 * - A module that has an `initialize` method that returns any precomputation.
30365 * - and a `close` method that accepts the precomputation. `close` is invoked
30366 * when the wrapped process is completed, or has failed.
30367 *
30368 * @param {Array<TransactionalWrapper>} transactionWrapper Wrapper modules
30369 * that implement `initialize` and `close`.
30370 * @return {Transaction} Single transaction for reuse in thread.
30371 *
30372 * @class Transaction
30373 */
30374var Mixin = {
30375 /**
30376 * Sets up this instance so that it is prepared for collecting metrics. Does
30377 * so such that this setup method may be used on an instance that is already
30378 * initialized, in a way that does not consume additional memory upon reuse.
30379 * That can be useful if you decide to make your subclass of this mixin a
30380 * "PooledClass".
30381 */
30382 reinitializeTransaction: function () {
30383 this.transactionWrappers = this.getTransactionWrappers();
30384 if (this.wrapperInitData) {
30385 this.wrapperInitData.length = 0;
30386 } else {
30387 this.wrapperInitData = [];
30388 }
30389 this._isInTransaction = false;
30390 },
30391
30392 _isInTransaction: false,
30393
30394 /**
30395 * @abstract
30396 * @return {Array<TransactionWrapper>} Array of transaction wrappers.
30397 */
30398 getTransactionWrappers: null,
30399
30400 isInTransaction: function () {
30401 return !!this._isInTransaction;
30402 },
30403
30404 /**
30405 * Executes the function within a safety window. Use this for the top level
30406 * methods that result in large amounts of computation/mutations that would
30407 * need to be safety checked. The optional arguments helps prevent the need
30408 * to bind in many cases.
30409 *
30410 * @param {function} method Member of scope to call.
30411 * @param {Object} scope Scope to invoke from.
30412 * @param {Object?=} a Argument to pass to the method.
30413 * @param {Object?=} b Argument to pass to the method.
30414 * @param {Object?=} c Argument to pass to the method.
30415 * @param {Object?=} d Argument to pass to the method.
30416 * @param {Object?=} e Argument to pass to the method.
30417 * @param {Object?=} f Argument to pass to the method.
30418 *
30419 * @return {*} Return value from `method`.
30420 */
30421 perform: function (method, scope, a, b, c, d, e, f) {
30422 !!this.isInTransaction() ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Transaction.perform(...): Cannot initialize a transaction when there ' + 'is already an outstanding transaction.') : invariant(false) : void 0;
30423 var errorThrown;
30424 var ret;
30425 try {
30426 this._isInTransaction = true;
30427 // Catching errors makes debugging more difficult, so we start with
30428 // errorThrown set to true before setting it to false after calling
30429 // close -- if it's still set to true in the finally block, it means
30430 // one of these calls threw.
30431 errorThrown = true;
30432 this.initializeAll(0);
30433 ret = method.call(scope, a, b, c, d, e, f);
30434 errorThrown = false;
30435 } finally {
30436 try {
30437 if (errorThrown) {
30438 // If `method` throws, prefer to show that stack trace over any thrown
30439 // by invoking `closeAll`.
30440 try {
30441 this.closeAll(0);
30442 } catch (err) {}
30443 } else {
30444 // Since `method` didn't throw, we don't want to silence the exception
30445 // here.
30446 this.closeAll(0);
30447 }
30448 } finally {
30449 this._isInTransaction = false;
30450 }
30451 }
30452 return ret;
30453 },
30454
30455 initializeAll: function (startIndex) {
30456 var transactionWrappers = this.transactionWrappers;
30457 for (var i = startIndex; i < transactionWrappers.length; i++) {
30458 var wrapper = transactionWrappers[i];
30459 try {
30460 // Catching errors makes debugging more difficult, so we start with the
30461 // OBSERVED_ERROR state before overwriting it with the real return value
30462 // of initialize -- if it's still set to OBSERVED_ERROR in the finally
30463 // block, it means wrapper.initialize threw.
30464 this.wrapperInitData[i] = Transaction.OBSERVED_ERROR;
30465 this.wrapperInitData[i] = wrapper.initialize ? wrapper.initialize.call(this) : null;
30466 } finally {
30467 if (this.wrapperInitData[i] === Transaction.OBSERVED_ERROR) {
30468 // The initializer for wrapper i threw an error; initialize the
30469 // remaining wrappers but silence any exceptions from them to ensure
30470 // that the first error is the one to bubble up.
30471 try {
30472 this.initializeAll(i + 1);
30473 } catch (err) {}
30474 }
30475 }
30476 }
30477 },
30478
30479 /**
30480 * Invokes each of `this.transactionWrappers.close[i]` functions, passing into
30481 * them the respective return values of `this.transactionWrappers.init[i]`
30482 * (`close`rs that correspond to initializers that failed will not be
30483 * invoked).
30484 */
30485 closeAll: function (startIndex) {
30486 !this.isInTransaction() ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Transaction.closeAll(): Cannot close transaction when none are open.') : invariant(false) : void 0;
30487 var transactionWrappers = this.transactionWrappers;
30488 for (var i = startIndex; i < transactionWrappers.length; i++) {
30489 var wrapper = transactionWrappers[i];
30490 var initData = this.wrapperInitData[i];
30491 var errorThrown;
30492 try {
30493 // Catching errors makes debugging more difficult, so we start with
30494 // errorThrown set to true before setting it to false after calling
30495 // close -- if it's still set to true in the finally block, it means
30496 // wrapper.close threw.
30497 errorThrown = true;
30498 if (initData !== Transaction.OBSERVED_ERROR && wrapper.close) {
30499 wrapper.close.call(this, initData);
30500 }
30501 errorThrown = false;
30502 } finally {
30503 if (errorThrown) {
30504 // The closer for wrapper i threw an error; close the remaining
30505 // wrappers but silence any exceptions from them to ensure that the
30506 // first error is the one to bubble up.
30507 try {
30508 this.closeAll(i + 1);
30509 } catch (e) {}
30510 }
30511 }
30512 }
30513 this.wrapperInitData.length = 0;
30514 }
30515};
30516
30517var Transaction = {
30518
30519 Mixin: Mixin,
30520
30521 /**
30522 * Token to look for to determine if an error occurred.
30523 */
30524 OBSERVED_ERROR: {}
30525
30526};
30527
30528module.exports = Transaction;
30529}).call(this,require(91))
30530},{"45":45,"91":91}],266:[function(require,module,exports){
30531/**
30532 * Copyright 2013-present, Facebook, Inc.
30533 * All rights reserved.
30534 *
30535 * This source code is licensed under the BSD-style license found in the
30536 * LICENSE file in the root directory of this source tree. An additional grant
30537 * of patent rights can be found in the PATENTS file in the same directory.
30538 *
30539 * @providesModule ViewportMetrics
30540 */
30541
30542'use strict';
30543
30544var ViewportMetrics = {
30545
30546 currentScrollLeft: 0,
30547
30548 currentScrollTop: 0,
30549
30550 refreshScrollValues: function (scrollPosition) {
30551 ViewportMetrics.currentScrollLeft = scrollPosition.x;
30552 ViewportMetrics.currentScrollTop = scrollPosition.y;
30553 }
30554
30555};
30556
30557module.exports = ViewportMetrics;
30558},{}],267:[function(require,module,exports){
30559(function (process){
30560/**
30561 * Copyright 2014-present, Facebook, Inc.
30562 * All rights reserved.
30563 *
30564 * This source code is licensed under the BSD-style license found in the
30565 * LICENSE file in the root directory of this source tree. An additional grant
30566 * of patent rights can be found in the PATENTS file in the same directory.
30567 *
30568 * @providesModule accumulateInto
30569 */
30570
30571'use strict';
30572
30573var invariant = require(45);
30574
30575/**
30576 *
30577 * Accumulates items that must not be null or undefined into the first one. This
30578 * is used to conserve memory by avoiding array allocations, and thus sacrifices
30579 * API cleanness. Since `current` can be null before being passed in and not
30580 * null after this function, make sure to assign it back to `current`:
30581 *
30582 * `a = accumulateInto(a, b);`
30583 *
30584 * This API should be sparingly used. Try `accumulate` for something cleaner.
30585 *
30586 * @return {*|array<*>} An accumulation of items.
30587 */
30588
30589function accumulateInto(current, next) {
30590 !(next != null) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'accumulateInto(...): Accumulated items must not be null or undefined.') : invariant(false) : void 0;
30591 if (current == null) {
30592 return next;
30593 }
30594
30595 // Both are not empty. Warning: Never call x.concat(y) when you are not
30596 // certain that x is an Array (x could be a string with concat method).
30597 var currentIsArray = Array.isArray(current);
30598 var nextIsArray = Array.isArray(next);
30599
30600 if (currentIsArray && nextIsArray) {
30601 current.push.apply(current, next);
30602 return current;
30603 }
30604
30605 if (currentIsArray) {
30606 current.push(next);
30607 return current;
30608 }
30609
30610 if (nextIsArray) {
30611 // A bit too dangerous to mutate `next`.
30612 return [current].concat(next);
30613 }
30614
30615 return [current, next];
30616}
30617
30618module.exports = accumulateInto;
30619}).call(this,require(91))
30620},{"45":45,"91":91}],268:[function(require,module,exports){
30621/**
30622 * Copyright 2013-present, Facebook, Inc.
30623 * All rights reserved.
30624 *
30625 * This source code is licensed under the BSD-style license found in the
30626 * LICENSE file in the root directory of this source tree. An additional grant
30627 * of patent rights can be found in the PATENTS file in the same directory.
30628 *
30629 * @providesModule adler32
30630 */
30631
30632'use strict';
30633
30634var MOD = 65521;
30635
30636// adler32 is not cryptographically strong, and is only used to sanity check that
30637// markup generated on the server matches the markup generated on the client.
30638// This implementation (a modified version of the SheetJS version) has been optimized
30639// for our use case, at the expense of conforming to the adler32 specification
30640// for non-ascii inputs.
30641function adler32(data) {
30642 var a = 1;
30643 var b = 0;
30644 var i = 0;
30645 var l = data.length;
30646 var m = l & ~0x3;
30647 while (i < m) {
30648 var n = Math.min(i + 4096, m);
30649 for (; i < n; i += 4) {
30650 b += (a += data.charCodeAt(i)) + (a += data.charCodeAt(i + 1)) + (a += data.charCodeAt(i + 2)) + (a += data.charCodeAt(i + 3));
30651 }
30652 a %= MOD;
30653 b %= MOD;
30654 }
30655 for (; i < l; i++) {
30656 b += a += data.charCodeAt(i);
30657 }
30658 a %= MOD;
30659 b %= MOD;
30660 return a | b << 16;
30661}
30662
30663module.exports = adler32;
30664},{}],269:[function(require,module,exports){
30665(function (process){
30666/**
30667 * Copyright 2013-present, Facebook, Inc.
30668 * All rights reserved.
30669 *
30670 * This source code is licensed under the BSD-style license found in the
30671 * LICENSE file in the root directory of this source tree. An additional grant
30672 * of patent rights can be found in the PATENTS file in the same directory.
30673 *
30674 * @providesModule canDefineProperty
30675 */
30676
30677'use strict';
30678
30679var canDefineProperty = false;
30680if (process.env.NODE_ENV !== 'production') {
30681 try {
30682 Object.defineProperty({}, 'x', { get: function () {} });
30683 canDefineProperty = true;
30684 } catch (x) {
30685 // IE will fail on defineProperty
30686 }
30687}
30688
30689module.exports = canDefineProperty;
30690}).call(this,require(91))
30691},{"91":91}],270:[function(require,module,exports){
30692/**
30693 * Copyright 2013-present, Facebook, Inc.
30694 * All rights reserved.
30695 *
30696 * This source code is licensed under the BSD-style license found in the
30697 * LICENSE file in the root directory of this source tree. An additional grant
30698 * of patent rights can be found in the PATENTS file in the same directory.
30699 *
30700 * @providesModule createMicrosoftUnsafeLocalFunction
30701 */
30702
30703/* globals MSApp */
30704
30705'use strict';
30706
30707/**
30708 * Create a function which has 'unsafe' privileges (required by windows8 apps)
30709 */
30710
30711var createMicrosoftUnsafeLocalFunction = function (func) {
30712 if (typeof MSApp !== 'undefined' && MSApp.execUnsafeLocalFunction) {
30713 return function (arg0, arg1, arg2, arg3) {
30714 MSApp.execUnsafeLocalFunction(function () {
30715 return func(arg0, arg1, arg2, arg3);
30716 });
30717 };
30718 } else {
30719 return func;
30720 }
30721};
30722
30723module.exports = createMicrosoftUnsafeLocalFunction;
30724},{}],271:[function(require,module,exports){
30725(function (process){
30726/**
30727 * Copyright 2013-present, Facebook, Inc.
30728 * All rights reserved.
30729 *
30730 * This source code is licensed under the BSD-style license found in the
30731 * LICENSE file in the root directory of this source tree. An additional grant
30732 * of patent rights can be found in the PATENTS file in the same directory.
30733 *
30734 * @providesModule dangerousStyleValue
30735 */
30736
30737'use strict';
30738
30739var CSSProperty = require(161);
30740var warning = require(55);
30741
30742var isUnitlessNumber = CSSProperty.isUnitlessNumber;
30743var styleWarnings = {};
30744
30745/**
30746 * Convert a value into the proper css writable value. The style name `name`
30747 * should be logical (no hyphens), as specified
30748 * in `CSSProperty.isUnitlessNumber`.
30749 *
30750 * @param {string} name CSS property name such as `topMargin`.
30751 * @param {*} value CSS property value such as `10px`.
30752 * @param {ReactDOMComponent} component
30753 * @return {string} Normalized style value with dimensions applied.
30754 */
30755function dangerousStyleValue(name, value, component) {
30756 // Note that we've removed escapeTextForBrowser() calls here since the
30757 // whole string will be escaped when the attribute is injected into
30758 // the markup. If you provide unsafe user data here they can inject
30759 // arbitrary CSS which may be problematic (I couldn't repro this):
30760 // https://www.owasp.org/index.php/XSS_Filter_Evasion_Cheat_Sheet
30761 // http://www.thespanner.co.uk/2007/11/26/ultimate-xss-css-injection/
30762 // This is not an XSS hole but instead a potential CSS injection issue
30763 // which has lead to a greater discussion about how we're going to
30764 // trust URLs moving forward. See #2115901
30765
30766 var isEmpty = value == null || typeof value === 'boolean' || value === '';
30767 if (isEmpty) {
30768 return '';
30769 }
30770
30771 var isNonNumeric = isNaN(value);
30772 if (isNonNumeric || value === 0 || isUnitlessNumber.hasOwnProperty(name) && isUnitlessNumber[name]) {
30773 return '' + value; // cast to string
30774 }
30775
30776 if (typeof value === 'string') {
30777 if (process.env.NODE_ENV !== 'production') {
30778 if (component) {
30779 var owner = component._currentElement._owner;
30780 var ownerName = owner ? owner.getName() : null;
30781 if (ownerName && !styleWarnings[ownerName]) {
30782 styleWarnings[ownerName] = {};
30783 }
30784 var warned = false;
30785 if (ownerName) {
30786 var warnings = styleWarnings[ownerName];
30787 warned = warnings[name];
30788 if (!warned) {
30789 warnings[name] = true;
30790 }
30791 }
30792 if (!warned) {
30793 process.env.NODE_ENV !== 'production' ? warning(false, 'a `%s` tag (owner: `%s`) was passed a numeric string value ' + 'for CSS property `%s` (value: `%s`) which will be treated ' + 'as a unitless number in a future version of React.', component._currentElement.type, ownerName || 'unknown', name, value) : void 0;
30794 }
30795 }
30796 }
30797 value = value.trim();
30798 }
30799 return value + 'px';
30800}
30801
30802module.exports = dangerousStyleValue;
30803}).call(this,require(91))
30804},{"161":161,"55":55,"91":91}],272:[function(require,module,exports){
30805/**
30806 * Copyright 2013-present, Facebook, Inc.
30807 * All rights reserved.
30808 *
30809 * This source code is licensed under the BSD-style license found in the
30810 * LICENSE file in the root directory of this source tree. An additional grant
30811 * of patent rights can be found in the PATENTS file in the same directory.
30812 *
30813 * @providesModule escapeTextContentForBrowser
30814 */
30815
30816'use strict';
30817
30818var ESCAPE_LOOKUP = {
30819 '&': '&amp;',
30820 '>': '&gt;',
30821 '<': '&lt;',
30822 '"': '&quot;',
30823 '\'': '&#x27;'
30824};
30825
30826var ESCAPE_REGEX = /[&><"']/g;
30827
30828function escaper(match) {
30829 return ESCAPE_LOOKUP[match];
30830}
30831
30832/**
30833 * Escapes text to prevent scripting attacks.
30834 *
30835 * @param {*} text Text value to escape.
30836 * @return {string} An escaped string.
30837 */
30838function escapeTextContentForBrowser(text) {
30839 return ('' + text).replace(ESCAPE_REGEX, escaper);
30840}
30841
30842module.exports = escapeTextContentForBrowser;
30843},{}],273:[function(require,module,exports){
30844(function (process){
30845/**
30846 * Copyright 2013-present, Facebook, Inc.
30847 * All rights reserved.
30848 *
30849 * This source code is licensed under the BSD-style license found in the
30850 * LICENSE file in the root directory of this source tree. An additional grant
30851 * of patent rights can be found in the PATENTS file in the same directory.
30852 *
30853 * @providesModule findDOMNode
30854 */
30855
30856'use strict';
30857
30858var ReactCurrentOwner = require(194);
30859var ReactDOMComponentTree = require(199);
30860var ReactInstanceMap = require(227);
30861
30862var getNativeComponentFromComposite = require(281);
30863var invariant = require(45);
30864var warning = require(55);
30865
30866/**
30867 * Returns the DOM node rendered by this element.
30868 *
30869 * See https://facebook.github.io/react/docs/top-level-api.html#reactdom.finddomnode
30870 *
30871 * @param {ReactComponent|DOMElement} componentOrElement
30872 * @return {?DOMElement} The root node of this element.
30873 */
30874function findDOMNode(componentOrElement) {
30875 if (process.env.NODE_ENV !== 'production') {
30876 var owner = ReactCurrentOwner.current;
30877 if (owner !== null) {
30878 process.env.NODE_ENV !== 'production' ? warning(owner._warnedAboutRefsInRender, '%s is accessing findDOMNode inside its render(). ' + 'render() should be a pure function of props and state. It should ' + 'never access something that requires stale data from the previous ' + 'render, such as refs. Move this logic to componentDidMount and ' + 'componentDidUpdate instead.', owner.getName() || 'A component') : void 0;
30879 owner._warnedAboutRefsInRender = true;
30880 }
30881 }
30882 if (componentOrElement == null) {
30883 return null;
30884 }
30885 if (componentOrElement.nodeType === 1) {
30886 return componentOrElement;
30887 }
30888
30889 var inst = ReactInstanceMap.get(componentOrElement);
30890 if (inst) {
30891 inst = getNativeComponentFromComposite(inst);
30892 return inst ? ReactDOMComponentTree.getNodeFromInstance(inst) : null;
30893 }
30894
30895 if (typeof componentOrElement.render === 'function') {
30896 !false ? process.env.NODE_ENV !== 'production' ? invariant(false, 'findDOMNode was called on an unmounted component.') : invariant(false) : void 0;
30897 } else {
30898 !false ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Element appears to be neither ReactComponent nor DOMNode (keys: %s)', Object.keys(componentOrElement)) : invariant(false) : void 0;
30899 }
30900}
30901
30902module.exports = findDOMNode;
30903}).call(this,require(91))
30904},{"194":194,"199":199,"227":227,"281":281,"45":45,"55":55,"91":91}],274:[function(require,module,exports){
30905(function (process){
30906/**
30907 * Copyright 2013-present, Facebook, Inc.
30908 * All rights reserved.
30909 *
30910 * This source code is licensed under the BSD-style license found in the
30911 * LICENSE file in the root directory of this source tree. An additional grant
30912 * of patent rights can be found in the PATENTS file in the same directory.
30913 *
30914 * @providesModule flattenChildren
30915 */
30916
30917'use strict';
30918
30919var KeyEscapeUtils = require(181);
30920var traverseAllChildren = require(294);
30921var warning = require(55);
30922
30923/**
30924 * @param {function} traverseContext Context passed through traversal.
30925 * @param {?ReactComponent} child React child component.
30926 * @param {!string} name String name of key path to child.
30927 */
30928function flattenSingleChildIntoContext(traverseContext, child, name) {
30929 // We found a component instance.
30930 var result = traverseContext;
30931 var keyUnique = result[name] === undefined;
30932 if (process.env.NODE_ENV !== 'production') {
30933 process.env.NODE_ENV !== 'production' ? warning(keyUnique, 'flattenChildren(...): Encountered two children with the same key, ' + '`%s`. Child keys must be unique; when two children share a key, only ' + 'the first child will be used.', KeyEscapeUtils.unescape(name)) : void 0;
30934 }
30935 if (keyUnique && child != null) {
30936 result[name] = child;
30937 }
30938}
30939
30940/**
30941 * Flattens children that are typically specified as `props.children`. Any null
30942 * children will not be included in the resulting object.
30943 * @return {!object} flattened children keyed by name.
30944 */
30945function flattenChildren(children) {
30946 if (children == null) {
30947 return children;
30948 }
30949 var result = {};
30950 traverseAllChildren(children, flattenSingleChildIntoContext, result);
30951 return result;
30952}
30953
30954module.exports = flattenChildren;
30955}).call(this,require(91))
30956},{"181":181,"294":294,"55":55,"91":91}],275:[function(require,module,exports){
30957/**
30958 * Copyright 2013-present, Facebook, Inc.
30959 * All rights reserved.
30960 *
30961 * This source code is licensed under the BSD-style license found in the
30962 * LICENSE file in the root directory of this source tree. An additional grant
30963 * of patent rights can be found in the PATENTS file in the same directory.
30964 *
30965 * @providesModule forEachAccumulated
30966 */
30967
30968'use strict';
30969
30970/**
30971 * @param {array} arr an "accumulation" of items which is either an Array or
30972 * a single item. Useful when paired with the `accumulate` module. This is a
30973 * simple utility that allows us to reason about a collection of items, but
30974 * handling the case when there is exactly one item (and we do not need to
30975 * allocate an array).
30976 */
30977
30978var forEachAccumulated = function (arr, cb, scope) {
30979 if (Array.isArray(arr)) {
30980 arr.forEach(cb, scope);
30981 } else if (arr) {
30982 cb.call(scope, arr);
30983 }
30984};
30985
30986module.exports = forEachAccumulated;
30987},{}],276:[function(require,module,exports){
30988/**
30989 * Copyright 2013-present, Facebook, Inc.
30990 * All rights reserved.
30991 *
30992 * This source code is licensed under the BSD-style license found in the
30993 * LICENSE file in the root directory of this source tree. An additional grant
30994 * of patent rights can be found in the PATENTS file in the same directory.
30995 *
30996 * @providesModule getEventCharCode
30997 */
30998
30999'use strict';
31000
31001/**
31002 * `charCode` represents the actual "character code" and is safe to use with
31003 * `String.fromCharCode`. As such, only keys that correspond to printable
31004 * characters produce a valid `charCode`, the only exception to this is Enter.
31005 * The Tab-key is considered non-printable and does not have a `charCode`,
31006 * presumably because it does not produce a tab-character in browsers.
31007 *
31008 * @param {object} nativeEvent Native browser event.
31009 * @return {number} Normalized `charCode` property.
31010 */
31011
31012function getEventCharCode(nativeEvent) {
31013 var charCode;
31014 var keyCode = nativeEvent.keyCode;
31015
31016 if ('charCode' in nativeEvent) {
31017 charCode = nativeEvent.charCode;
31018
31019 // FF does not set `charCode` for the Enter-key, check against `keyCode`.
31020 if (charCode === 0 && keyCode === 13) {
31021 charCode = 13;
31022 }
31023 } else {
31024 // IE8 does not implement `charCode`, but `keyCode` has the correct value.
31025 charCode = keyCode;
31026 }
31027
31028 // Some non-printable keys are reported in `charCode`/`keyCode`, discard them.
31029 // Must not discard the (non-)printable Enter-key.
31030 if (charCode >= 32 || charCode === 13) {
31031 return charCode;
31032 }
31033
31034 return 0;
31035}
31036
31037module.exports = getEventCharCode;
31038},{}],277:[function(require,module,exports){
31039/**
31040 * Copyright 2013-present, Facebook, Inc.
31041 * All rights reserved.
31042 *
31043 * This source code is licensed under the BSD-style license found in the
31044 * LICENSE file in the root directory of this source tree. An additional grant
31045 * of patent rights can be found in the PATENTS file in the same directory.
31046 *
31047 * @providesModule getEventKey
31048 */
31049
31050'use strict';
31051
31052var getEventCharCode = require(276);
31053
31054/**
31055 * Normalization of deprecated HTML5 `key` values
31056 * @see https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent#Key_names
31057 */
31058var normalizeKey = {
31059 'Esc': 'Escape',
31060 'Spacebar': ' ',
31061 'Left': 'ArrowLeft',
31062 'Up': 'ArrowUp',
31063 'Right': 'ArrowRight',
31064 'Down': 'ArrowDown',
31065 'Del': 'Delete',
31066 'Win': 'OS',
31067 'Menu': 'ContextMenu',
31068 'Apps': 'ContextMenu',
31069 'Scroll': 'ScrollLock',
31070 'MozPrintableKey': 'Unidentified'
31071};
31072
31073/**
31074 * Translation from legacy `keyCode` to HTML5 `key`
31075 * Only special keys supported, all others depend on keyboard layout or browser
31076 * @see https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent#Key_names
31077 */
31078var translateToKey = {
31079 8: 'Backspace',
31080 9: 'Tab',
31081 12: 'Clear',
31082 13: 'Enter',
31083 16: 'Shift',
31084 17: 'Control',
31085 18: 'Alt',
31086 19: 'Pause',
31087 20: 'CapsLock',
31088 27: 'Escape',
31089 32: ' ',
31090 33: 'PageUp',
31091 34: 'PageDown',
31092 35: 'End',
31093 36: 'Home',
31094 37: 'ArrowLeft',
31095 38: 'ArrowUp',
31096 39: 'ArrowRight',
31097 40: 'ArrowDown',
31098 45: 'Insert',
31099 46: 'Delete',
31100 112: 'F1', 113: 'F2', 114: 'F3', 115: 'F4', 116: 'F5', 117: 'F6',
31101 118: 'F7', 119: 'F8', 120: 'F9', 121: 'F10', 122: 'F11', 123: 'F12',
31102 144: 'NumLock',
31103 145: 'ScrollLock',
31104 224: 'Meta'
31105};
31106
31107/**
31108 * @param {object} nativeEvent Native browser event.
31109 * @return {string} Normalized `key` property.
31110 */
31111function getEventKey(nativeEvent) {
31112 if (nativeEvent.key) {
31113 // Normalize inconsistent values reported by browsers due to
31114 // implementations of a working draft specification.
31115
31116 // FireFox implements `key` but returns `MozPrintableKey` for all
31117 // printable characters (normalized to `Unidentified`), ignore it.
31118 var key = normalizeKey[nativeEvent.key] || nativeEvent.key;
31119 if (key !== 'Unidentified') {
31120 return key;
31121 }
31122 }
31123
31124 // Browser does not implement `key`, polyfill as much of it as we can.
31125 if (nativeEvent.type === 'keypress') {
31126 var charCode = getEventCharCode(nativeEvent);
31127
31128 // The enter-key is technically both printable and non-printable and can
31129 // thus be captured by `keypress`, no other non-printable key should.
31130 return charCode === 13 ? 'Enter' : String.fromCharCode(charCode);
31131 }
31132 if (nativeEvent.type === 'keydown' || nativeEvent.type === 'keyup') {
31133 // While user keyboard layout determines the actual meaning of each
31134 // `keyCode` value, almost all function keys have a universal value.
31135 return translateToKey[nativeEvent.keyCode] || 'Unidentified';
31136 }
31137 return '';
31138}
31139
31140module.exports = getEventKey;
31141},{"276":276}],278:[function(require,module,exports){
31142/**
31143 * Copyright 2013-present, Facebook, Inc.
31144 * All rights reserved.
31145 *
31146 * This source code is licensed under the BSD-style license found in the
31147 * LICENSE file in the root directory of this source tree. An additional grant
31148 * of patent rights can be found in the PATENTS file in the same directory.
31149 *
31150 * @providesModule getEventModifierState
31151 */
31152
31153'use strict';
31154
31155/**
31156 * Translation from modifier key to the associated property in the event.
31157 * @see http://www.w3.org/TR/DOM-Level-3-Events/#keys-Modifiers
31158 */
31159
31160var modifierKeyToProp = {
31161 'Alt': 'altKey',
31162 'Control': 'ctrlKey',
31163 'Meta': 'metaKey',
31164 'Shift': 'shiftKey'
31165};
31166
31167// IE8 does not implement getModifierState so we simply map it to the only
31168// modifier keys exposed by the event itself, does not support Lock-keys.
31169// Currently, all major browsers except Chrome seems to support Lock-keys.
31170function modifierStateGetter(keyArg) {
31171 var syntheticEvent = this;
31172 var nativeEvent = syntheticEvent.nativeEvent;
31173 if (nativeEvent.getModifierState) {
31174 return nativeEvent.getModifierState(keyArg);
31175 }
31176 var keyProp = modifierKeyToProp[keyArg];
31177 return keyProp ? !!nativeEvent[keyProp] : false;
31178}
31179
31180function getEventModifierState(nativeEvent) {
31181 return modifierStateGetter;
31182}
31183
31184module.exports = getEventModifierState;
31185},{}],279:[function(require,module,exports){
31186/**
31187 * Copyright 2013-present, Facebook, Inc.
31188 * All rights reserved.
31189 *
31190 * This source code is licensed under the BSD-style license found in the
31191 * LICENSE file in the root directory of this source tree. An additional grant
31192 * of patent rights can be found in the PATENTS file in the same directory.
31193 *
31194 * @providesModule getEventTarget
31195 */
31196
31197'use strict';
31198
31199/**
31200 * Gets the target node from a native browser event by accounting for
31201 * inconsistencies in browser DOM APIs.
31202 *
31203 * @param {object} nativeEvent Native browser event.
31204 * @return {DOMEventTarget} Target node.
31205 */
31206
31207function getEventTarget(nativeEvent) {
31208 var target = nativeEvent.target || nativeEvent.srcElement || window;
31209
31210 // Normalize SVG <use> element events #4963
31211 if (target.correspondingUseElement) {
31212 target = target.correspondingUseElement;
31213 }
31214
31215 // Safari may fire events on text nodes (Node.TEXT_NODE is 3).
31216 // @see http://www.quirksmode.org/js/events_properties.html
31217 return target.nodeType === 3 ? target.parentNode : target;
31218}
31219
31220module.exports = getEventTarget;
31221},{}],280:[function(require,module,exports){
31222/**
31223 * Copyright 2013-present, Facebook, Inc.
31224 * All rights reserved.
31225 *
31226 * This source code is licensed under the BSD-style license found in the
31227 * LICENSE file in the root directory of this source tree. An additional grant
31228 * of patent rights can be found in the PATENTS file in the same directory.
31229 *
31230 * @providesModule getIteratorFn
31231 */
31232
31233'use strict';
31234
31235/* global Symbol */
31236
31237var ITERATOR_SYMBOL = typeof Symbol === 'function' && Symbol.iterator;
31238var FAUX_ITERATOR_SYMBOL = '@@iterator'; // Before Symbol spec.
31239
31240/**
31241 * Returns the iterator method function contained on the iterable object.
31242 *
31243 * Be sure to invoke the function with the iterable as context:
31244 *
31245 * var iteratorFn = getIteratorFn(myIterable);
31246 * if (iteratorFn) {
31247 * var iterator = iteratorFn.call(myIterable);
31248 * ...
31249 * }
31250 *
31251 * @param {?object} maybeIterable
31252 * @return {?function}
31253 */
31254function getIteratorFn(maybeIterable) {
31255 var iteratorFn = maybeIterable && (ITERATOR_SYMBOL && maybeIterable[ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL]);
31256 if (typeof iteratorFn === 'function') {
31257 return iteratorFn;
31258 }
31259}
31260
31261module.exports = getIteratorFn;
31262},{}],281:[function(require,module,exports){
31263/**
31264 * Copyright 2013-present, Facebook, Inc.
31265 * All rights reserved.
31266 *
31267 * This source code is licensed under the BSD-style license found in the
31268 * LICENSE file in the root directory of this source tree. An additional grant
31269 * of patent rights can be found in the PATENTS file in the same directory.
31270 *
31271 * @providesModule getNativeComponentFromComposite
31272 */
31273
31274'use strict';
31275
31276var ReactNodeTypes = require(236);
31277
31278function getNativeComponentFromComposite(inst) {
31279 var type;
31280
31281 while ((type = inst._renderedNodeType) === ReactNodeTypes.COMPOSITE) {
31282 inst = inst._renderedComponent;
31283 }
31284
31285 if (type === ReactNodeTypes.NATIVE) {
31286 return inst._renderedComponent;
31287 } else if (type === ReactNodeTypes.EMPTY) {
31288 return null;
31289 }
31290}
31291
31292module.exports = getNativeComponentFromComposite;
31293},{"236":236}],282:[function(require,module,exports){
31294/**
31295 * Copyright 2013-present, Facebook, Inc.
31296 * All rights reserved.
31297 *
31298 * This source code is licensed under the BSD-style license found in the
31299 * LICENSE file in the root directory of this source tree. An additional grant
31300 * of patent rights can be found in the PATENTS file in the same directory.
31301 *
31302 * @providesModule getNodeForCharacterOffset
31303 */
31304
31305'use strict';
31306
31307/**
31308 * Given any node return the first leaf node without children.
31309 *
31310 * @param {DOMElement|DOMTextNode} node
31311 * @return {DOMElement|DOMTextNode}
31312 */
31313
31314function getLeafNode(node) {
31315 while (node && node.firstChild) {
31316 node = node.firstChild;
31317 }
31318 return node;
31319}
31320
31321/**
31322 * Get the next sibling within a container. This will walk up the
31323 * DOM if a node's siblings have been exhausted.
31324 *
31325 * @param {DOMElement|DOMTextNode} node
31326 * @return {?DOMElement|DOMTextNode}
31327 */
31328function getSiblingNode(node) {
31329 while (node) {
31330 if (node.nextSibling) {
31331 return node.nextSibling;
31332 }
31333 node = node.parentNode;
31334 }
31335}
31336
31337/**
31338 * Get object describing the nodes which contain characters at offset.
31339 *
31340 * @param {DOMElement|DOMTextNode} root
31341 * @param {number} offset
31342 * @return {?object}
31343 */
31344function getNodeForCharacterOffset(root, offset) {
31345 var node = getLeafNode(root);
31346 var nodeStart = 0;
31347 var nodeEnd = 0;
31348
31349 while (node) {
31350 if (node.nodeType === 3) {
31351 nodeEnd = nodeStart + node.textContent.length;
31352
31353 if (nodeStart <= offset && nodeEnd >= offset) {
31354 return {
31355 node: node,
31356 offset: offset - nodeStart
31357 };
31358 }
31359
31360 nodeStart = nodeEnd;
31361 }
31362
31363 node = getLeafNode(getSiblingNode(node));
31364 }
31365}
31366
31367module.exports = getNodeForCharacterOffset;
31368},{}],283:[function(require,module,exports){
31369/**
31370 * Copyright 2013-present, Facebook, Inc.
31371 * All rights reserved.
31372 *
31373 * This source code is licensed under the BSD-style license found in the
31374 * LICENSE file in the root directory of this source tree. An additional grant
31375 * of patent rights can be found in the PATENTS file in the same directory.
31376 *
31377 * @providesModule getTextContentAccessor
31378 */
31379
31380'use strict';
31381
31382var ExecutionEnvironment = require(31);
31383
31384var contentKey = null;
31385
31386/**
31387 * Gets the key used to access text content on a DOM node.
31388 *
31389 * @return {?string} Key used to access text content.
31390 * @internal
31391 */
31392function getTextContentAccessor() {
31393 if (!contentKey && ExecutionEnvironment.canUseDOM) {
31394 // Prefer textContent to innerText because many browsers support both but
31395 // SVG <text> elements don't support innerText even when <div> does.
31396 contentKey = 'textContent' in document.documentElement ? 'textContent' : 'innerText';
31397 }
31398 return contentKey;
31399}
31400
31401module.exports = getTextContentAccessor;
31402},{"31":31}],284:[function(require,module,exports){
31403/**
31404 * Copyright 2013-present, Facebook, Inc.
31405 * All rights reserved.
31406 *
31407 * This source code is licensed under the BSD-style license found in the
31408 * LICENSE file in the root directory of this source tree. An additional grant
31409 * of patent rights can be found in the PATENTS file in the same directory.
31410 *
31411 * @providesModule getVendorPrefixedEventName
31412 */
31413
31414'use strict';
31415
31416var ExecutionEnvironment = require(31);
31417
31418/**
31419 * Generate a mapping of standard vendor prefixes using the defined style property and event name.
31420 *
31421 * @param {string} styleProp
31422 * @param {string} eventName
31423 * @returns {object}
31424 */
31425function makePrefixMap(styleProp, eventName) {
31426 var prefixes = {};
31427
31428 prefixes[styleProp.toLowerCase()] = eventName.toLowerCase();
31429 prefixes['Webkit' + styleProp] = 'webkit' + eventName;
31430 prefixes['Moz' + styleProp] = 'moz' + eventName;
31431 prefixes['ms' + styleProp] = 'MS' + eventName;
31432 prefixes['O' + styleProp] = 'o' + eventName.toLowerCase();
31433
31434 return prefixes;
31435}
31436
31437/**
31438 * A list of event names to a configurable list of vendor prefixes.
31439 */
31440var vendorPrefixes = {
31441 animationend: makePrefixMap('Animation', 'AnimationEnd'),
31442 animationiteration: makePrefixMap('Animation', 'AnimationIteration'),
31443 animationstart: makePrefixMap('Animation', 'AnimationStart'),
31444 transitionend: makePrefixMap('Transition', 'TransitionEnd')
31445};
31446
31447/**
31448 * Event names that have already been detected and prefixed (if applicable).
31449 */
31450var prefixedEventNames = {};
31451
31452/**
31453 * Element to check for prefixes on.
31454 */
31455var style = {};
31456
31457/**
31458 * Bootstrap if a DOM exists.
31459 */
31460if (ExecutionEnvironment.canUseDOM) {
31461 style = document.createElement('div').style;
31462
31463 // On some platforms, in particular some releases of Android 4.x,
31464 // the un-prefixed "animation" and "transition" properties are defined on the
31465 // style object but the events that fire will still be prefixed, so we need
31466 // to check if the un-prefixed events are usable, and if not remove them from the map.
31467 if (!('AnimationEvent' in window)) {
31468 delete vendorPrefixes.animationend.animation;
31469 delete vendorPrefixes.animationiteration.animation;
31470 delete vendorPrefixes.animationstart.animation;
31471 }
31472
31473 // Same as above
31474 if (!('TransitionEvent' in window)) {
31475 delete vendorPrefixes.transitionend.transition;
31476 }
31477}
31478
31479/**
31480 * Attempts to determine the correct vendor prefixed event name.
31481 *
31482 * @param {string} eventName
31483 * @returns {string}
31484 */
31485function getVendorPrefixedEventName(eventName) {
31486 if (prefixedEventNames[eventName]) {
31487 return prefixedEventNames[eventName];
31488 } else if (!vendorPrefixes[eventName]) {
31489 return eventName;
31490 }
31491
31492 var prefixMap = vendorPrefixes[eventName];
31493
31494 for (var styleProp in prefixMap) {
31495 if (prefixMap.hasOwnProperty(styleProp) && styleProp in style) {
31496 return prefixedEventNames[eventName] = prefixMap[styleProp];
31497 }
31498 }
31499
31500 return '';
31501}
31502
31503module.exports = getVendorPrefixedEventName;
31504},{"31":31}],285:[function(require,module,exports){
31505(function (process){
31506/**
31507 * Copyright 2013-present, Facebook, Inc.
31508 * All rights reserved.
31509 *
31510 * This source code is licensed under the BSD-style license found in the
31511 * LICENSE file in the root directory of this source tree. An additional grant
31512 * of patent rights can be found in the PATENTS file in the same directory.
31513 *
31514 * @providesModule instantiateReactComponent
31515 */
31516
31517'use strict';
31518
31519var _assign = require(296);
31520
31521var ReactCompositeComponent = require(193);
31522var ReactEmptyComponent = require(220);
31523var ReactNativeComponent = require(234);
31524var ReactInstrumentation = require(228);
31525
31526var invariant = require(45);
31527var warning = require(55);
31528
31529// To avoid a cyclic dependency, we create the final class in this module
31530var ReactCompositeComponentWrapper = function (element) {
31531 this.construct(element);
31532};
31533_assign(ReactCompositeComponentWrapper.prototype, ReactCompositeComponent.Mixin, {
31534 _instantiateReactComponent: instantiateReactComponent
31535});
31536
31537function getDeclarationErrorAddendum(owner) {
31538 if (owner) {
31539 var name = owner.getName();
31540 if (name) {
31541 return ' Check the render method of `' + name + '`.';
31542 }
31543 }
31544 return '';
31545}
31546
31547function getDisplayName(instance) {
31548 var element = instance._currentElement;
31549 if (element == null) {
31550 return '#empty';
31551 } else if (typeof element === 'string' || typeof element === 'number') {
31552 return '#text';
31553 } else if (typeof element.type === 'string') {
31554 return element.type;
31555 } else if (instance.getName) {
31556 return instance.getName() || 'Unknown';
31557 } else {
31558 return element.type.displayName || element.type.name || 'Unknown';
31559 }
31560}
31561
31562/**
31563 * Check if the type reference is a known internal type. I.e. not a user
31564 * provided composite type.
31565 *
31566 * @param {function} type
31567 * @return {boolean} Returns true if this is a valid internal type.
31568 */
31569function isInternalComponentType(type) {
31570 return typeof type === 'function' && typeof type.prototype !== 'undefined' && typeof type.prototype.mountComponent === 'function' && typeof type.prototype.receiveComponent === 'function';
31571}
31572
31573var nextDebugID = 1;
31574
31575/**
31576 * Given a ReactNode, create an instance that will actually be mounted.
31577 *
31578 * @param {ReactNode} node
31579 * @return {object} A new instance of the element's constructor.
31580 * @protected
31581 */
31582function instantiateReactComponent(node) {
31583 var instance;
31584
31585 var isEmpty = node === null || node === false;
31586 if (isEmpty) {
31587 instance = ReactEmptyComponent.create(instantiateReactComponent);
31588 } else if (typeof node === 'object') {
31589 var element = node;
31590 !(element && (typeof element.type === 'function' || typeof element.type === 'string')) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Element type is invalid: expected a string (for built-in components) ' + 'or a class/function (for composite components) but got: %s.%s', element.type == null ? element.type : typeof element.type, getDeclarationErrorAddendum(element._owner)) : invariant(false) : void 0;
31591
31592 // Special case string values
31593 if (typeof element.type === 'string') {
31594 instance = ReactNativeComponent.createInternalComponent(element);
31595 } else if (isInternalComponentType(element.type)) {
31596 // This is temporarily available for custom components that are not string
31597 // representations. I.e. ART. Once those are updated to use the string
31598 // representation, we can drop this code path.
31599 instance = new element.type(element);
31600 } else {
31601 instance = new ReactCompositeComponentWrapper(element);
31602 }
31603 } else if (typeof node === 'string' || typeof node === 'number') {
31604 instance = ReactNativeComponent.createInstanceForText(node);
31605 } else {
31606 !false ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Encountered invalid React node of type %s', typeof node) : invariant(false) : void 0;
31607 }
31608
31609 if (process.env.NODE_ENV !== 'production') {
31610 process.env.NODE_ENV !== 'production' ? warning(typeof instance.mountComponent === 'function' && typeof instance.receiveComponent === 'function' && typeof instance.getNativeNode === 'function' && typeof instance.unmountComponent === 'function', 'Only React Components can be mounted.') : void 0;
31611 }
31612
31613 // These two fields are used by the DOM and ART diffing algorithms
31614 // respectively. Instead of using expandos on components, we should be
31615 // storing the state needed by the diffing algorithms elsewhere.
31616 instance._mountIndex = 0;
31617 instance._mountImage = null;
31618
31619 if (process.env.NODE_ENV !== 'production') {
31620 instance._isOwnerNecessary = false;
31621 instance._warnedAboutRefsInRender = false;
31622 }
31623
31624 if (process.env.NODE_ENV !== 'production') {
31625 var debugID = isEmpty ? 0 : nextDebugID++;
31626 instance._debugID = debugID;
31627
31628 if (debugID !== 0) {
31629 var displayName = getDisplayName(instance);
31630 ReactInstrumentation.debugTool.onSetDisplayName(debugID, displayName);
31631 var owner = node && node._owner;
31632 if (owner) {
31633 ReactInstrumentation.debugTool.onSetOwner(debugID, owner._debugID);
31634 }
31635 }
31636 }
31637
31638 // Internal instances should fully constructed at this point, so they should
31639 // not get any new fields added to them at this point.
31640 if (process.env.NODE_ENV !== 'production') {
31641 if (Object.preventExtensions) {
31642 Object.preventExtensions(instance);
31643 }
31644 }
31645
31646 return instance;
31647}
31648
31649module.exports = instantiateReactComponent;
31650}).call(this,require(91))
31651},{"193":193,"220":220,"228":228,"234":234,"296":296,"45":45,"55":55,"91":91}],286:[function(require,module,exports){
31652/**
31653 * Copyright 2013-present, Facebook, Inc.
31654 * All rights reserved.
31655 *
31656 * This source code is licensed under the BSD-style license found in the
31657 * LICENSE file in the root directory of this source tree. An additional grant
31658 * of patent rights can be found in the PATENTS file in the same directory.
31659 *
31660 * @providesModule isEventSupported
31661 */
31662
31663'use strict';
31664
31665var ExecutionEnvironment = require(31);
31666
31667var useHasFeature;
31668if (ExecutionEnvironment.canUseDOM) {
31669 useHasFeature = document.implementation && document.implementation.hasFeature &&
31670 // always returns true in newer browsers as per the standard.
31671 // @see http://dom.spec.whatwg.org/#dom-domimplementation-hasfeature
31672 document.implementation.hasFeature('', '') !== true;
31673}
31674
31675/**
31676 * Checks if an event is supported in the current execution environment.
31677 *
31678 * NOTE: This will not work correctly for non-generic events such as `change`,
31679 * `reset`, `load`, `error`, and `select`.
31680 *
31681 * Borrows from Modernizr.
31682 *
31683 * @param {string} eventNameSuffix Event name, e.g. "click".
31684 * @param {?boolean} capture Check if the capture phase is supported.
31685 * @return {boolean} True if the event is supported.
31686 * @internal
31687 * @license Modernizr 3.0.0pre (Custom Build) | MIT
31688 */
31689function isEventSupported(eventNameSuffix, capture) {
31690 if (!ExecutionEnvironment.canUseDOM || capture && !('addEventListener' in document)) {
31691 return false;
31692 }
31693
31694 var eventName = 'on' + eventNameSuffix;
31695 var isSupported = eventName in document;
31696
31697 if (!isSupported) {
31698 var element = document.createElement('div');
31699 element.setAttribute(eventName, 'return;');
31700 isSupported = typeof element[eventName] === 'function';
31701 }
31702
31703 if (!isSupported && useHasFeature && eventNameSuffix === 'wheel') {
31704 // This is the only way to test support for the `wheel` event in IE9+.
31705 isSupported = document.implementation.hasFeature('Events.wheel', '3.0');
31706 }
31707
31708 return isSupported;
31709}
31710
31711module.exports = isEventSupported;
31712},{"31":31}],287:[function(require,module,exports){
31713/**
31714 * Copyright 2013-present, Facebook, Inc.
31715 * All rights reserved.
31716 *
31717 * This source code is licensed under the BSD-style license found in the
31718 * LICENSE file in the root directory of this source tree. An additional grant
31719 * of patent rights can be found in the PATENTS file in the same directory.
31720 *
31721 * @providesModule isTextInputElement
31722 */
31723
31724'use strict';
31725
31726/**
31727 * @see http://www.whatwg.org/specs/web-apps/current-work/multipage/the-input-element.html#input-type-attr-summary
31728 */
31729
31730var supportedInputTypes = {
31731 'color': true,
31732 'date': true,
31733 'datetime': true,
31734 'datetime-local': true,
31735 'email': true,
31736 'month': true,
31737 'number': true,
31738 'password': true,
31739 'range': true,
31740 'search': true,
31741 'tel': true,
31742 'text': true,
31743 'time': true,
31744 'url': true,
31745 'week': true
31746};
31747
31748function isTextInputElement(elem) {
31749 var nodeName = elem && elem.nodeName && elem.nodeName.toLowerCase();
31750 return nodeName && (nodeName === 'input' && supportedInputTypes[elem.type] || nodeName === 'textarea');
31751}
31752
31753module.exports = isTextInputElement;
31754},{}],288:[function(require,module,exports){
31755(function (process){
31756/**
31757 * Copyright 2013-present, Facebook, Inc.
31758 * All rights reserved.
31759 *
31760 * This source code is licensed under the BSD-style license found in the
31761 * LICENSE file in the root directory of this source tree. An additional grant
31762 * of patent rights can be found in the PATENTS file in the same directory.
31763 *
31764 * @providesModule onlyChild
31765 */
31766'use strict';
31767
31768var ReactElement = require(218);
31769
31770var invariant = require(45);
31771
31772/**
31773 * Returns the first child in a collection of children and verifies that there
31774 * is only one child in the collection.
31775 *
31776 * See https://facebook.github.io/react/docs/top-level-api.html#react.children.only
31777 *
31778 * The current implementation of this function assumes that a single child gets
31779 * passed without a wrapper, but the purpose of this helper function is to
31780 * abstract away the particular structure of children.
31781 *
31782 * @param {?object} children Child collection structure.
31783 * @return {ReactElement} The first and only `ReactElement` contained in the
31784 * structure.
31785 */
31786function onlyChild(children) {
31787 !ReactElement.isValidElement(children) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'onlyChild must be passed a children with exactly one child.') : invariant(false) : void 0;
31788 return children;
31789}
31790
31791module.exports = onlyChild;
31792}).call(this,require(91))
31793},{"218":218,"45":45,"91":91}],289:[function(require,module,exports){
31794/**
31795 * Copyright 2013-present, Facebook, Inc.
31796 * All rights reserved.
31797 *
31798 * This source code is licensed under the BSD-style license found in the
31799 * LICENSE file in the root directory of this source tree. An additional grant
31800 * of patent rights can be found in the PATENTS file in the same directory.
31801 *
31802 * @providesModule quoteAttributeValueForBrowser
31803 */
31804
31805'use strict';
31806
31807var escapeTextContentForBrowser = require(272);
31808
31809/**
31810 * Escapes attribute value to prevent scripting attacks.
31811 *
31812 * @param {*} value Value to escape.
31813 * @return {string} An escaped string.
31814 */
31815function quoteAttributeValueForBrowser(value) {
31816 return '"' + escapeTextContentForBrowser(value) + '"';
31817}
31818
31819module.exports = quoteAttributeValueForBrowser;
31820},{"272":272}],290:[function(require,module,exports){
31821/**
31822 * Copyright 2013-present, Facebook, Inc.
31823 * All rights reserved.
31824 *
31825 * This source code is licensed under the BSD-style license found in the
31826 * LICENSE file in the root directory of this source tree. An additional grant
31827 * of patent rights can be found in the PATENTS file in the same directory.
31828 *
31829* @providesModule renderSubtreeIntoContainer
31830*/
31831
31832'use strict';
31833
31834var ReactMount = require(231);
31835
31836module.exports = ReactMount.renderSubtreeIntoContainer;
31837},{"231":231}],291:[function(require,module,exports){
31838/**
31839 * Copyright 2013-present, Facebook, Inc.
31840 * All rights reserved.
31841 *
31842 * This source code is licensed under the BSD-style license found in the
31843 * LICENSE file in the root directory of this source tree. An additional grant
31844 * of patent rights can be found in the PATENTS file in the same directory.
31845 *
31846 * @providesModule setInnerHTML
31847 */
31848
31849'use strict';
31850
31851var ExecutionEnvironment = require(31);
31852
31853var WHITESPACE_TEST = /^[ \r\n\t\f]/;
31854var NONVISIBLE_TEST = /<(!--|link|noscript|meta|script|style)[ \r\n\t\f\/>]/;
31855
31856var createMicrosoftUnsafeLocalFunction = require(270);
31857
31858/**
31859 * Set the innerHTML property of a node, ensuring that whitespace is preserved
31860 * even in IE8.
31861 *
31862 * @param {DOMElement} node
31863 * @param {string} html
31864 * @internal
31865 */
31866var setInnerHTML = createMicrosoftUnsafeLocalFunction(function (node, html) {
31867 node.innerHTML = html;
31868});
31869
31870if (ExecutionEnvironment.canUseDOM) {
31871 // IE8: When updating a just created node with innerHTML only leading
31872 // whitespace is removed. When updating an existing node with innerHTML
31873 // whitespace in root TextNodes is also collapsed.
31874 // @see quirksmode.org/bugreports/archives/2004/11/innerhtml_and_t.html
31875
31876 // Feature detection; only IE8 is known to behave improperly like this.
31877 var testElement = document.createElement('div');
31878 testElement.innerHTML = ' ';
31879 if (testElement.innerHTML === '') {
31880 setInnerHTML = function (node, html) {
31881 // Magic theory: IE8 supposedly differentiates between added and updated
31882 // nodes when processing innerHTML, innerHTML on updated nodes suffers
31883 // from worse whitespace behavior. Re-adding a node like this triggers
31884 // the initial and more favorable whitespace behavior.
31885 // TODO: What to do on a detached node?
31886 if (node.parentNode) {
31887 node.parentNode.replaceChild(node, node);
31888 }
31889
31890 // We also implement a workaround for non-visible tags disappearing into
31891 // thin air on IE8, this only happens if there is no visible text
31892 // in-front of the non-visible tags. Piggyback on the whitespace fix
31893 // and simply check if any non-visible tags appear in the source.
31894 if (WHITESPACE_TEST.test(html) || html[0] === '<' && NONVISIBLE_TEST.test(html)) {
31895 // Recover leading whitespace by temporarily prepending any character.
31896 // \uFEFF has the potential advantage of being zero-width/invisible.
31897 // UglifyJS drops U+FEFF chars when parsing, so use String.fromCharCode
31898 // in hopes that this is preserved even if "\uFEFF" is transformed to
31899 // the actual Unicode character (by Babel, for example).
31900 // https://github.com/mishoo/UglifyJS2/blob/v2.4.20/lib/parse.js#L216
31901 node.innerHTML = String.fromCharCode(0xFEFF) + html;
31902
31903 // deleteData leaves an empty `TextNode` which offsets the index of all
31904 // children. Definitely want to avoid this.
31905 var textNode = node.firstChild;
31906 if (textNode.data.length === 1) {
31907 node.removeChild(textNode);
31908 } else {
31909 textNode.deleteData(0, 1);
31910 }
31911 } else {
31912 node.innerHTML = html;
31913 }
31914 };
31915 }
31916 testElement = null;
31917}
31918
31919module.exports = setInnerHTML;
31920},{"270":270,"31":31}],292:[function(require,module,exports){
31921/**
31922 * Copyright 2013-present, Facebook, Inc.
31923 * All rights reserved.
31924 *
31925 * This source code is licensed under the BSD-style license found in the
31926 * LICENSE file in the root directory of this source tree. An additional grant
31927 * of patent rights can be found in the PATENTS file in the same directory.
31928 *
31929 * @providesModule setTextContent
31930 */
31931
31932'use strict';
31933
31934var ExecutionEnvironment = require(31);
31935var escapeTextContentForBrowser = require(272);
31936var setInnerHTML = require(291);
31937
31938/**
31939 * Set the textContent property of a node, ensuring that whitespace is preserved
31940 * even in IE8. innerText is a poor substitute for textContent and, among many
31941 * issues, inserts <br> instead of the literal newline chars. innerHTML behaves
31942 * as it should.
31943 *
31944 * @param {DOMElement} node
31945 * @param {string} text
31946 * @internal
31947 */
31948var setTextContent = function (node, text) {
31949 node.textContent = text;
31950};
31951
31952if (ExecutionEnvironment.canUseDOM) {
31953 if (!('textContent' in document.documentElement)) {
31954 setTextContent = function (node, text) {
31955 setInnerHTML(node, escapeTextContentForBrowser(text));
31956 };
31957 }
31958}
31959
31960module.exports = setTextContent;
31961},{"272":272,"291":291,"31":31}],293:[function(require,module,exports){
31962/**
31963 * Copyright 2013-present, Facebook, Inc.
31964 * All rights reserved.
31965 *
31966 * This source code is licensed under the BSD-style license found in the
31967 * LICENSE file in the root directory of this source tree. An additional grant
31968 * of patent rights can be found in the PATENTS file in the same directory.
31969 *
31970 * @providesModule shouldUpdateReactComponent
31971 */
31972
31973'use strict';
31974
31975/**
31976 * Given a `prevElement` and `nextElement`, determines if the existing
31977 * instance should be updated as opposed to being destroyed or replaced by a new
31978 * instance. Both arguments are elements. This ensures that this logic can
31979 * operate on stateless trees without any backing instance.
31980 *
31981 * @param {?object} prevElement
31982 * @param {?object} nextElement
31983 * @return {boolean} True if the existing instance should be updated.
31984 * @protected
31985 */
31986
31987function shouldUpdateReactComponent(prevElement, nextElement) {
31988 var prevEmpty = prevElement === null || prevElement === false;
31989 var nextEmpty = nextElement === null || nextElement === false;
31990 if (prevEmpty || nextEmpty) {
31991 return prevEmpty === nextEmpty;
31992 }
31993
31994 var prevType = typeof prevElement;
31995 var nextType = typeof nextElement;
31996 if (prevType === 'string' || prevType === 'number') {
31997 return nextType === 'string' || nextType === 'number';
31998 } else {
31999 return nextType === 'object' && prevElement.type === nextElement.type && prevElement.key === nextElement.key;
32000 }
32001}
32002
32003module.exports = shouldUpdateReactComponent;
32004},{}],294:[function(require,module,exports){
32005(function (process){
32006/**
32007 * Copyright 2013-present, Facebook, Inc.
32008 * All rights reserved.
32009 *
32010 * This source code is licensed under the BSD-style license found in the
32011 * LICENSE file in the root directory of this source tree. An additional grant
32012 * of patent rights can be found in the PATENTS file in the same directory.
32013 *
32014 * @providesModule traverseAllChildren
32015 */
32016
32017'use strict';
32018
32019var ReactCurrentOwner = require(194);
32020var ReactElement = require(218);
32021
32022var getIteratorFn = require(280);
32023var invariant = require(45);
32024var KeyEscapeUtils = require(181);
32025var warning = require(55);
32026
32027var SEPARATOR = '.';
32028var SUBSEPARATOR = ':';
32029
32030/**
32031 * TODO: Test that a single child and an array with one item have the same key
32032 * pattern.
32033 */
32034
32035var didWarnAboutMaps = false;
32036
32037/**
32038 * Generate a key string that identifies a component within a set.
32039 *
32040 * @param {*} component A component that could contain a manual key.
32041 * @param {number} index Index that is used if a manual key is not provided.
32042 * @return {string}
32043 */
32044function getComponentKey(component, index) {
32045 // Do some typechecking here since we call this blindly. We want to ensure
32046 // that we don't block potential future ES APIs.
32047 if (component && typeof component === 'object' && component.key != null) {
32048 // Explicit key
32049 return KeyEscapeUtils.escape(component.key);
32050 }
32051 // Implicit key determined by the index in the set
32052 return index.toString(36);
32053}
32054
32055/**
32056 * @param {?*} children Children tree container.
32057 * @param {!string} nameSoFar Name of the key path so far.
32058 * @param {!function} callback Callback to invoke with each child found.
32059 * @param {?*} traverseContext Used to pass information throughout the traversal
32060 * process.
32061 * @return {!number} The number of children in this subtree.
32062 */
32063function traverseAllChildrenImpl(children, nameSoFar, callback, traverseContext) {
32064 var type = typeof children;
32065
32066 if (type === 'undefined' || type === 'boolean') {
32067 // All of the above are perceived as null.
32068 children = null;
32069 }
32070
32071 if (children === null || type === 'string' || type === 'number' || ReactElement.isValidElement(children)) {
32072 callback(traverseContext, children,
32073 // If it's the only child, treat the name as if it was wrapped in an array
32074 // so that it's consistent if the number of children grows.
32075 nameSoFar === '' ? SEPARATOR + getComponentKey(children, 0) : nameSoFar);
32076 return 1;
32077 }
32078
32079 var child;
32080 var nextName;
32081 var subtreeCount = 0; // Count of children found in the current subtree.
32082 var nextNamePrefix = nameSoFar === '' ? SEPARATOR : nameSoFar + SUBSEPARATOR;
32083
32084 if (Array.isArray(children)) {
32085 for (var i = 0; i < children.length; i++) {
32086 child = children[i];
32087 nextName = nextNamePrefix + getComponentKey(child, i);
32088 subtreeCount += traverseAllChildrenImpl(child, nextName, callback, traverseContext);
32089 }
32090 } else {
32091 var iteratorFn = getIteratorFn(children);
32092 if (iteratorFn) {
32093 var iterator = iteratorFn.call(children);
32094 var step;
32095 if (iteratorFn !== children.entries) {
32096 var ii = 0;
32097 while (!(step = iterator.next()).done) {
32098 child = step.value;
32099 nextName = nextNamePrefix + getComponentKey(child, ii++);
32100 subtreeCount += traverseAllChildrenImpl(child, nextName, callback, traverseContext);
32101 }
32102 } else {
32103 if (process.env.NODE_ENV !== 'production') {
32104 process.env.NODE_ENV !== 'production' ? warning(didWarnAboutMaps, 'Using Maps as children is not yet fully supported. It is an ' + 'experimental feature that might be removed. Convert it to a ' + 'sequence / iterable of keyed ReactElements instead.') : void 0;
32105 didWarnAboutMaps = true;
32106 }
32107 // Iterator will provide entry [k,v] tuples rather than values.
32108 while (!(step = iterator.next()).done) {
32109 var entry = step.value;
32110 if (entry) {
32111 child = entry[1];
32112 nextName = nextNamePrefix + KeyEscapeUtils.escape(entry[0]) + SUBSEPARATOR + getComponentKey(child, 0);
32113 subtreeCount += traverseAllChildrenImpl(child, nextName, callback, traverseContext);
32114 }
32115 }
32116 }
32117 } else if (type === 'object') {
32118 var addendum = '';
32119 if (process.env.NODE_ENV !== 'production') {
32120 addendum = ' If you meant to render a collection of children, use an array ' + 'instead or wrap the object using createFragment(object) from the ' + 'React add-ons.';
32121 if (children._isReactElement) {
32122 addendum = ' It looks like you\'re using an element created by a different ' + 'version of React. Make sure to use only one copy of React.';
32123 }
32124 if (ReactCurrentOwner.current) {
32125 var name = ReactCurrentOwner.current.getName();
32126 if (name) {
32127 addendum += ' Check the render method of `' + name + '`.';
32128 }
32129 }
32130 }
32131 var childrenString = String(children);
32132 !false ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Objects are not valid as a React child (found: %s).%s', childrenString === '[object Object]' ? 'object with keys {' + Object.keys(children).join(', ') + '}' : childrenString, addendum) : invariant(false) : void 0;
32133 }
32134 }
32135
32136 return subtreeCount;
32137}
32138
32139/**
32140 * Traverses children that are typically specified as `props.children`, but
32141 * might also be specified through attributes:
32142 *
32143 * - `traverseAllChildren(this.props.children, ...)`
32144 * - `traverseAllChildren(this.props.leftPanelChildren, ...)`
32145 *
32146 * The `traverseContext` is an optional argument that is passed through the
32147 * entire traversal. It can be used to store accumulations or anything else that
32148 * the callback might find relevant.
32149 *
32150 * @param {?*} children Children tree object.
32151 * @param {!function} callback To invoke upon traversing each child.
32152 * @param {?*} traverseContext Context for traversal.
32153 * @return {!number} The number of children in this subtree.
32154 */
32155function traverseAllChildren(children, callback, traverseContext) {
32156 if (children == null) {
32157 return 0;
32158 }
32159
32160 return traverseAllChildrenImpl(children, '', callback, traverseContext);
32161}
32162
32163module.exports = traverseAllChildren;
32164}).call(this,require(91))
32165},{"181":181,"194":194,"218":218,"280":280,"45":45,"55":55,"91":91}],295:[function(require,module,exports){
32166(function (process){
32167/**
32168 * Copyright 2015-present, Facebook, Inc.
32169 * All rights reserved.
32170 *
32171 * This source code is licensed under the BSD-style license found in the
32172 * LICENSE file in the root directory of this source tree. An additional grant
32173 * of patent rights can be found in the PATENTS file in the same directory.
32174 *
32175 * @providesModule validateDOMNesting
32176 */
32177
32178'use strict';
32179
32180var _assign = require(296);
32181
32182var emptyFunction = require(37);
32183var warning = require(55);
32184
32185var validateDOMNesting = emptyFunction;
32186
32187if (process.env.NODE_ENV !== 'production') {
32188 // This validation code was written based on the HTML5 parsing spec:
32189 // https://html.spec.whatwg.org/multipage/syntax.html#has-an-element-in-scope
32190 //
32191 // Note: this does not catch all invalid nesting, nor does it try to (as it's
32192 // not clear what practical benefit doing so provides); instead, we warn only
32193 // for cases where the parser will give a parse tree differing from what React
32194 // intended. For example, <b><div></div></b> is invalid but we don't warn
32195 // because it still parses correctly; we do warn for other cases like nested
32196 // <p> tags where the beginning of the second element implicitly closes the
32197 // first, causing a confusing mess.
32198
32199 // https://html.spec.whatwg.org/multipage/syntax.html#special
32200 var specialTags = ['address', 'applet', 'area', 'article', 'aside', 'base', 'basefont', 'bgsound', 'blockquote', 'body', 'br', 'button', 'caption', 'center', 'col', 'colgroup', 'dd', 'details', 'dir', 'div', 'dl', 'dt', 'embed', 'fieldset', 'figcaption', 'figure', 'footer', 'form', 'frame', 'frameset', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'head', 'header', 'hgroup', 'hr', 'html', 'iframe', 'img', 'input', 'isindex', 'li', 'link', 'listing', 'main', 'marquee', 'menu', 'menuitem', 'meta', 'nav', 'noembed', 'noframes', 'noscript', 'object', 'ol', 'p', 'param', 'plaintext', 'pre', 'script', 'section', 'select', 'source', 'style', 'summary', 'table', 'tbody', 'td', 'template', 'textarea', 'tfoot', 'th', 'thead', 'title', 'tr', 'track', 'ul', 'wbr', 'xmp'];
32201
32202 // https://html.spec.whatwg.org/multipage/syntax.html#has-an-element-in-scope
32203 var inScopeTags = ['applet', 'caption', 'html', 'table', 'td', 'th', 'marquee', 'object', 'template',
32204
32205 // https://html.spec.whatwg.org/multipage/syntax.html#html-integration-point
32206 // TODO: Distinguish by namespace here -- for <title>, including it here
32207 // errs on the side of fewer warnings
32208 'foreignObject', 'desc', 'title'];
32209
32210 // https://html.spec.whatwg.org/multipage/syntax.html#has-an-element-in-button-scope
32211 var buttonScopeTags = inScopeTags.concat(['button']);
32212
32213 // https://html.spec.whatwg.org/multipage/syntax.html#generate-implied-end-tags
32214 var impliedEndTags = ['dd', 'dt', 'li', 'option', 'optgroup', 'p', 'rp', 'rt'];
32215
32216 var emptyAncestorInfo = {
32217 current: null,
32218
32219 formTag: null,
32220 aTagInScope: null,
32221 buttonTagInScope: null,
32222 nobrTagInScope: null,
32223 pTagInButtonScope: null,
32224
32225 listItemTagAutoclosing: null,
32226 dlItemTagAutoclosing: null
32227 };
32228
32229 var updatedAncestorInfo = function (oldInfo, tag, instance) {
32230 var ancestorInfo = _assign({}, oldInfo || emptyAncestorInfo);
32231 var info = { tag: tag, instance: instance };
32232
32233 if (inScopeTags.indexOf(tag) !== -1) {
32234 ancestorInfo.aTagInScope = null;
32235 ancestorInfo.buttonTagInScope = null;
32236 ancestorInfo.nobrTagInScope = null;
32237 }
32238 if (buttonScopeTags.indexOf(tag) !== -1) {
32239 ancestorInfo.pTagInButtonScope = null;
32240 }
32241
32242 // See rules for 'li', 'dd', 'dt' start tags in
32243 // https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-inbody
32244 if (specialTags.indexOf(tag) !== -1 && tag !== 'address' && tag !== 'div' && tag !== 'p') {
32245 ancestorInfo.listItemTagAutoclosing = null;
32246 ancestorInfo.dlItemTagAutoclosing = null;
32247 }
32248
32249 ancestorInfo.current = info;
32250
32251 if (tag === 'form') {
32252 ancestorInfo.formTag = info;
32253 }
32254 if (tag === 'a') {
32255 ancestorInfo.aTagInScope = info;
32256 }
32257 if (tag === 'button') {
32258 ancestorInfo.buttonTagInScope = info;
32259 }
32260 if (tag === 'nobr') {
32261 ancestorInfo.nobrTagInScope = info;
32262 }
32263 if (tag === 'p') {
32264 ancestorInfo.pTagInButtonScope = info;
32265 }
32266 if (tag === 'li') {
32267 ancestorInfo.listItemTagAutoclosing = info;
32268 }
32269 if (tag === 'dd' || tag === 'dt') {
32270 ancestorInfo.dlItemTagAutoclosing = info;
32271 }
32272
32273 return ancestorInfo;
32274 };
32275
32276 /**
32277 * Returns whether
32278 */
32279 var isTagValidWithParent = function (tag, parentTag) {
32280 // First, let's check if we're in an unusual parsing mode...
32281 switch (parentTag) {
32282 // https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-inselect
32283 case 'select':
32284 return tag === 'option' || tag === 'optgroup' || tag === '#text';
32285 case 'optgroup':
32286 return tag === 'option' || tag === '#text';
32287 // Strictly speaking, seeing an <option> doesn't mean we're in a <select>
32288 // but
32289 case 'option':
32290 return tag === '#text';
32291
32292 // https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-intd
32293 // https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-incaption
32294 // No special behavior since these rules fall back to "in body" mode for
32295 // all except special table nodes which cause bad parsing behavior anyway.
32296
32297 // https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-intr
32298 case 'tr':
32299 return tag === 'th' || tag === 'td' || tag === 'style' || tag === 'script' || tag === 'template';
32300
32301 // https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-intbody
32302 case 'tbody':
32303 case 'thead':
32304 case 'tfoot':
32305 return tag === 'tr' || tag === 'style' || tag === 'script' || tag === 'template';
32306
32307 // https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-incolgroup
32308 case 'colgroup':
32309 return tag === 'col' || tag === 'template';
32310
32311 // https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-intable
32312 case 'table':
32313 return tag === 'caption' || tag === 'colgroup' || tag === 'tbody' || tag === 'tfoot' || tag === 'thead' || tag === 'style' || tag === 'script' || tag === 'template';
32314
32315 // https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-inhead
32316 case 'head':
32317 return tag === 'base' || tag === 'basefont' || tag === 'bgsound' || tag === 'link' || tag === 'meta' || tag === 'title' || tag === 'noscript' || tag === 'noframes' || tag === 'style' || tag === 'script' || tag === 'template';
32318
32319 // https://html.spec.whatwg.org/multipage/semantics.html#the-html-element
32320 case 'html':
32321 return tag === 'head' || tag === 'body';
32322 case '#document':
32323 return tag === 'html';
32324 }
32325
32326 // Probably in the "in body" parsing mode, so we outlaw only tag combos
32327 // where the parsing rules cause implicit opens or closes to be added.
32328 // https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-inbody
32329 switch (tag) {
32330 case 'h1':
32331 case 'h2':
32332 case 'h3':
32333 case 'h4':
32334 case 'h5':
32335 case 'h6':
32336 return parentTag !== 'h1' && parentTag !== 'h2' && parentTag !== 'h3' && parentTag !== 'h4' && parentTag !== 'h5' && parentTag !== 'h6';
32337
32338 case 'rp':
32339 case 'rt':
32340 return impliedEndTags.indexOf(parentTag) === -1;
32341
32342 case 'body':
32343 case 'caption':
32344 case 'col':
32345 case 'colgroup':
32346 case 'frame':
32347 case 'head':
32348 case 'html':
32349 case 'tbody':
32350 case 'td':
32351 case 'tfoot':
32352 case 'th':
32353 case 'thead':
32354 case 'tr':
32355 // These tags are only valid with a few parents that have special child
32356 // parsing rules -- if we're down here, then none of those matched and
32357 // so we allow it only if we don't know what the parent is, as all other
32358 // cases are invalid.
32359 return parentTag == null;
32360 }
32361
32362 return true;
32363 };
32364
32365 /**
32366 * Returns whether
32367 */
32368 var findInvalidAncestorForTag = function (tag, ancestorInfo) {
32369 switch (tag) {
32370 case 'address':
32371 case 'article':
32372 case 'aside':
32373 case 'blockquote':
32374 case 'center':
32375 case 'details':
32376 case 'dialog':
32377 case 'dir':
32378 case 'div':
32379 case 'dl':
32380 case 'fieldset':
32381 case 'figcaption':
32382 case 'figure':
32383 case 'footer':
32384 case 'header':
32385 case 'hgroup':
32386 case 'main':
32387 case 'menu':
32388 case 'nav':
32389 case 'ol':
32390 case 'p':
32391 case 'section':
32392 case 'summary':
32393 case 'ul':
32394
32395 case 'pre':
32396 case 'listing':
32397
32398 case 'table':
32399
32400 case 'hr':
32401
32402 case 'xmp':
32403
32404 case 'h1':
32405 case 'h2':
32406 case 'h3':
32407 case 'h4':
32408 case 'h5':
32409 case 'h6':
32410 return ancestorInfo.pTagInButtonScope;
32411
32412 case 'form':
32413 return ancestorInfo.formTag || ancestorInfo.pTagInButtonScope;
32414
32415 case 'li':
32416 return ancestorInfo.listItemTagAutoclosing;
32417
32418 case 'dd':
32419 case 'dt':
32420 return ancestorInfo.dlItemTagAutoclosing;
32421
32422 case 'button':
32423 return ancestorInfo.buttonTagInScope;
32424
32425 case 'a':
32426 // Spec says something about storing a list of markers, but it sounds
32427 // equivalent to this check.
32428 return ancestorInfo.aTagInScope;
32429
32430 case 'nobr':
32431 return ancestorInfo.nobrTagInScope;
32432 }
32433
32434 return null;
32435 };
32436
32437 /**
32438 * Given a ReactCompositeComponent instance, return a list of its recursive
32439 * owners, starting at the root and ending with the instance itself.
32440 */
32441 var findOwnerStack = function (instance) {
32442 if (!instance) {
32443 return [];
32444 }
32445
32446 var stack = [];
32447 do {
32448 stack.push(instance);
32449 } while (instance = instance._currentElement._owner);
32450 stack.reverse();
32451 return stack;
32452 };
32453
32454 var didWarn = {};
32455
32456 validateDOMNesting = function (childTag, childInstance, ancestorInfo) {
32457 ancestorInfo = ancestorInfo || emptyAncestorInfo;
32458 var parentInfo = ancestorInfo.current;
32459 var parentTag = parentInfo && parentInfo.tag;
32460
32461 var invalidParent = isTagValidWithParent(childTag, parentTag) ? null : parentInfo;
32462 var invalidAncestor = invalidParent ? null : findInvalidAncestorForTag(childTag, ancestorInfo);
32463 var problematic = invalidParent || invalidAncestor;
32464
32465 if (problematic) {
32466 var ancestorTag = problematic.tag;
32467 var ancestorInstance = problematic.instance;
32468
32469 var childOwner = childInstance && childInstance._currentElement._owner;
32470 var ancestorOwner = ancestorInstance && ancestorInstance._currentElement._owner;
32471
32472 var childOwners = findOwnerStack(childOwner);
32473 var ancestorOwners = findOwnerStack(ancestorOwner);
32474
32475 var minStackLen = Math.min(childOwners.length, ancestorOwners.length);
32476 var i;
32477
32478 var deepestCommon = -1;
32479 for (i = 0; i < minStackLen; i++) {
32480 if (childOwners[i] === ancestorOwners[i]) {
32481 deepestCommon = i;
32482 } else {
32483 break;
32484 }
32485 }
32486
32487 var UNKNOWN = '(unknown)';
32488 var childOwnerNames = childOwners.slice(deepestCommon + 1).map(function (inst) {
32489 return inst.getName() || UNKNOWN;
32490 });
32491 var ancestorOwnerNames = ancestorOwners.slice(deepestCommon + 1).map(function (inst) {
32492 return inst.getName() || UNKNOWN;
32493 });
32494 var ownerInfo = [].concat(
32495 // If the parent and child instances have a common owner ancestor, start
32496 // with that -- otherwise we just start with the parent's owners.
32497 deepestCommon !== -1 ? childOwners[deepestCommon].getName() || UNKNOWN : [], ancestorOwnerNames, ancestorTag,
32498 // If we're warning about an invalid (non-parent) ancestry, add '...'
32499 invalidAncestor ? ['...'] : [], childOwnerNames, childTag).join(' > ');
32500
32501 var warnKey = !!invalidParent + '|' + childTag + '|' + ancestorTag + '|' + ownerInfo;
32502 if (didWarn[warnKey]) {
32503 return;
32504 }
32505 didWarn[warnKey] = true;
32506
32507 var tagDisplayName = childTag;
32508 if (childTag !== '#text') {
32509 tagDisplayName = '<' + childTag + '>';
32510 }
32511
32512 if (invalidParent) {
32513 var info = '';
32514 if (ancestorTag === 'table' && childTag === 'tr') {
32515 info += ' Add a <tbody> to your code to match the DOM tree generated by ' + 'the browser.';
32516 }
32517 process.env.NODE_ENV !== 'production' ? warning(false, 'validateDOMNesting(...): %s cannot appear as a child of <%s>. ' + 'See %s.%s', tagDisplayName, ancestorTag, ownerInfo, info) : void 0;
32518 } else {
32519 process.env.NODE_ENV !== 'production' ? warning(false, 'validateDOMNesting(...): %s cannot appear as a descendant of ' + '<%s>. See %s.', tagDisplayName, ancestorTag, ownerInfo) : void 0;
32520 }
32521 }
32522 };
32523
32524 validateDOMNesting.updatedAncestorInfo = updatedAncestorInfo;
32525
32526 // For testing
32527 validateDOMNesting.isTagValidInContext = function (tag, ancestorInfo) {
32528 ancestorInfo = ancestorInfo || emptyAncestorInfo;
32529 var parentInfo = ancestorInfo.current;
32530 var parentTag = parentInfo && parentInfo.tag;
32531 return isTagValidWithParent(tag, parentTag) && !findInvalidAncestorForTag(tag, ancestorInfo);
32532 };
32533}
32534
32535module.exports = validateDOMNesting;
32536}).call(this,require(91))
32537},{"296":296,"37":37,"55":55,"91":91}],296:[function(require,module,exports){
32538arguments[4][77][0].apply(exports,arguments)
32539},{"77":77}],297:[function(require,module,exports){
32540'use strict';
32541
32542module.exports = require(184);
32543
32544},{"184":184}],298:[function(require,module,exports){
32545'use strict';
32546
32547exports.__esModule = true;
32548
32549var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
32550
32551var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
32552
32553function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
32554
32555function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }
32556
32557function _inherits(subClass, superClass) { if (typeof superClass !== 'function' && superClass !== null) { throw new TypeError('Super expression must either be null or a function, not ' + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
32558
32559var _react = require(297);
32560
32561var _react2 = _interopRequireDefault(_react);
32562
32563var _reactRedux = require(100);
32564
32565var _reactRouter = require(136);
32566
32567var _routerStateEquals = require(308);
32568
32569var _routerStateEquals2 = _interopRequireDefault(_routerStateEquals);
32570
32571var _constants = require(301);
32572
32573var _actionCreators = require(299);
32574
32575function memoizeRouterStateSelector(selector) {
32576 var previousRouterState = null;
32577
32578 return function (state) {
32579 var nextRouterState = selector(state);
32580 if (_routerStateEquals2['default'](previousRouterState, nextRouterState)) {
32581 return previousRouterState;
32582 }
32583 previousRouterState = nextRouterState;
32584 return nextRouterState;
32585 };
32586}
32587
32588function getRoutesFromProps(props) {
32589 return props.routes || props.children;
32590}
32591
32592var ReduxRouter = (function (_Component) {
32593 _inherits(ReduxRouter, _Component);
32594
32595 _createClass(ReduxRouter, null, [{
32596 key: 'propTypes',
32597 value: {
32598 children: _react.PropTypes.node
32599 },
32600 enumerable: true
32601 }, {
32602 key: 'contextTypes',
32603 value: {
32604 store: _react.PropTypes.object
32605 },
32606 enumerable: true
32607 }]);
32608
32609 function ReduxRouter(props, context) {
32610 _classCallCheck(this, ReduxRouter);
32611
32612 _Component.call(this, props, context);
32613 context.store.dispatch(_actionCreators.initRoutes(getRoutesFromProps(props)));
32614 }
32615
32616 ReduxRouter.prototype.componentWillReceiveProps = function componentWillReceiveProps(nextProps) {
32617 this.receiveRoutes(getRoutesFromProps(nextProps));
32618 };
32619
32620 ReduxRouter.prototype.receiveRoutes = function receiveRoutes(routes) {
32621 if (!routes) return;
32622
32623 var store = this.context.store;
32624
32625 store.dispatch(_actionCreators.replaceRoutes(routes));
32626 };
32627
32628 ReduxRouter.prototype.render = function render() {
32629 var store = this.context.store;
32630
32631 if (!store) {
32632 throw new Error('Redux store missing from context of <ReduxRouter>. Make sure you\'re ' + 'using a <Provider>');
32633 }
32634
32635 var history = store.history;
32636 var routerStateSelector = store[_constants.ROUTER_STATE_SELECTOR];
32637
32638 if (!history || !routerStateSelector) {
32639 throw new Error('Redux store not configured properly for <ReduxRouter>. Make sure ' + 'you\'re using the reduxReactRouter() store enhancer.');
32640 }
32641
32642 return _react2['default'].createElement(ReduxRouterContext, _extends({
32643 history: history,
32644 routerStateSelector: memoizeRouterStateSelector(routerStateSelector)
32645 }, this.props));
32646 };
32647
32648 return ReduxRouter;
32649})(_react.Component);
32650
32651var ReduxRouterContext = (function (_Component2) {
32652 _inherits(ReduxRouterContext, _Component2);
32653
32654 function ReduxRouterContext() {
32655 _classCallCheck(this, _ReduxRouterContext);
32656
32657 _Component2.apply(this, arguments);
32658 }
32659
32660 ReduxRouterContext.prototype.render = function render() {
32661 var location = this.props.location;
32662
32663 if (location === null || location === undefined) {
32664 return null; // Async matching
32665 }
32666
32667 var RoutingContext = this.props.RoutingContext || _reactRouter.RoutingContext;
32668
32669 return _react2['default'].createElement(RoutingContext, this.props);
32670 };
32671
32672 _createClass(ReduxRouterContext, null, [{
32673 key: 'propTypes',
32674 value: {
32675 location: _react.PropTypes.object,
32676 RoutingContext: _react.PropTypes.element
32677 },
32678 enumerable: true
32679 }]);
32680
32681 var _ReduxRouterContext = ReduxRouterContext;
32682 ReduxRouterContext = _reactRedux.connect(function (state, _ref) {
32683 var routerStateSelector = _ref.routerStateSelector;
32684 return routerStateSelector(state) || {};
32685 })(ReduxRouterContext) || ReduxRouterContext;
32686 return ReduxRouterContext;
32687})(_react.Component);
32688
32689exports['default'] = ReduxRouter;
32690module.exports = exports['default'];
32691},{"100":100,"136":136,"297":297,"299":299,"301":301,"308":308}],299:[function(require,module,exports){
32692'use strict';
32693
32694exports.__esModule = true;
32695exports.routerDidChange = routerDidChange;
32696exports.initRoutes = initRoutes;
32697exports.replaceRoutes = replaceRoutes;
32698exports.historyAPI = historyAPI;
32699
32700var _constants = require(301);
32701
32702/**
32703 * Action creator for signaling that the router has changed.
32704 * @private
32705 * @param {RouterState} state - New router state
32706 * @return {Action} Action object
32707 */
32708
32709function routerDidChange(state) {
32710 return {
32711 type: _constants.ROUTER_DID_CHANGE,
32712 payload: state
32713 };
32714}
32715
32716/**
32717 * Action creator that initiates route config
32718 * @private
32719 * @param {Array<Route>|ReactElement} routes - New routes
32720 */
32721
32722function initRoutes(routes) {
32723 return {
32724 type: _constants.INIT_ROUTES,
32725 payload: routes
32726 };
32727}
32728
32729/**
32730 * Action creator that replaces the current route config
32731 * @private
32732 * @param {Array<Route>|ReactElement} routes - New routes
32733 */
32734
32735function replaceRoutes(routes) {
32736 return {
32737 type: _constants.REPLACE_ROUTES,
32738 payload: routes
32739 };
32740}
32741
32742/**
32743 * Creates an action creator for calling a history API method.
32744 * @param {string} method - Name of method
32745 * @returns {ActionCreator} Action creator with same parameters as corresponding
32746 * history method
32747 */
32748
32749function historyAPI(method) {
32750 return function () {
32751 for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
32752 args[_key] = arguments[_key];
32753 }
32754
32755 return {
32756 type: _constants.HISTORY_API,
32757 payload: {
32758 method: method,
32759 args: args
32760 }
32761 };
32762 };
32763}
32764
32765var pushState = historyAPI('pushState');
32766exports.pushState = pushState;
32767var push = historyAPI('push');
32768exports.push = push;
32769var replaceState = historyAPI('replaceState');
32770exports.replaceState = replaceState;
32771var replace = historyAPI('replace');
32772exports.replace = replace;
32773var setState = historyAPI('setState');
32774exports.setState = setState;
32775var go = historyAPI('go');
32776exports.go = go;
32777var goBack = historyAPI('goBack');
32778exports.goBack = goBack;
32779var goForward = historyAPI('goForward');
32780exports.goForward = goForward;
32781},{"301":301}],300:[function(require,module,exports){
32782'use strict';
32783
32784exports.__esModule = true;
32785
32786function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
32787
32788var _redux = require(316);
32789
32790var _actionCreators = require(299);
32791
32792var _routerStateEquals = require(308);
32793
32794var _routerStateEquals2 = _interopRequireDefault(_routerStateEquals);
32795
32796var _reduxReactRouter = require(305);
32797
32798var _reduxReactRouter2 = _interopRequireDefault(_reduxReactRouter);
32799
32800var _useDefaults = require(310);
32801
32802var _useDefaults2 = _interopRequireDefault(_useDefaults);
32803
32804var _routeReplacement = require(307);
32805
32806var _routeReplacement2 = _interopRequireDefault(_routeReplacement);
32807
32808function historySynchronization(next) {
32809 return function (options) {
32810 return function (createStore) {
32811 return function (reducer, initialState) {
32812 var onError = options.onError;
32813 var routerStateSelector = options.routerStateSelector;
32814
32815 var store = next(options)(createStore)(reducer, initialState);
32816 var history = store.history;
32817
32818 var prevRouterState = undefined;
32819 var routerState = undefined;
32820
32821 history.listen(function (error, nextRouterState) {
32822 if (error) {
32823 onError(error);
32824 return;
32825 }
32826
32827 if (!_routerStateEquals2['default'](routerState, nextRouterState)) {
32828 prevRouterState = routerState;
32829 routerState = nextRouterState;
32830 store.dispatch(_actionCreators.routerDidChange(nextRouterState));
32831 }
32832 });
32833
32834 store.subscribe(function () {
32835 var nextRouterState = routerStateSelector(store.getState());
32836
32837 if (nextRouterState && prevRouterState !== nextRouterState && !_routerStateEquals2['default'](routerState, nextRouterState)) {
32838 routerState = nextRouterState;
32839 var _nextRouterState$location = nextRouterState.location;
32840 var state = _nextRouterState$location.state;
32841 var pathname = _nextRouterState$location.pathname;
32842 var query = _nextRouterState$location.query;
32843
32844 history.replace({ state: state, pathname: pathname, query: query });
32845 }
32846 });
32847
32848 return store;
32849 };
32850 };
32851 };
32852}
32853
32854exports['default'] = _redux.compose(_useDefaults2['default'], _routeReplacement2['default'], historySynchronization)(_reduxReactRouter2['default']);
32855module.exports = exports['default'];
32856},{"299":299,"305":305,"307":307,"308":308,"310":310,"316":316}],301:[function(require,module,exports){
32857// Signals that the router's state has changed. It should
32858// never be called by the application, only as an implementation detail of
32859// redux-react-router.
32860'use strict';
32861
32862exports.__esModule = true;
32863var ROUTER_DID_CHANGE = '@@reduxReactRouter/routerDidChange';
32864
32865exports.ROUTER_DID_CHANGE = ROUTER_DID_CHANGE;
32866var HISTORY_API = '@@reduxReactRouter/historyAPI';
32867exports.HISTORY_API = HISTORY_API;
32868var MATCH = '@@reduxReactRouter/match';
32869exports.MATCH = MATCH;
32870var INIT_ROUTES = '@@reduxReactRouter/initRoutes';
32871exports.INIT_ROUTES = INIT_ROUTES;
32872var REPLACE_ROUTES = '@@reduxReactRouter/replaceRoutes';
32873
32874exports.REPLACE_ROUTES = REPLACE_ROUTES;
32875var ROUTER_STATE_SELECTOR = '@@reduxReactRouter/routerStateSelector';
32876
32877exports.ROUTER_STATE_SELECTOR = ROUTER_STATE_SELECTOR;
32878var DOES_NEED_REFRESH = '@@reduxReactRouter/doesNeedRefresh';
32879exports.DOES_NEED_REFRESH = DOES_NEED_REFRESH;
32880},{}],302:[function(require,module,exports){
32881'use strict';
32882
32883exports.__esModule = true;
32884exports['default'] = historyMiddleware;
32885
32886var _constants = require(301);
32887
32888/**
32889 * Middleware for interacting with the history API
32890 * @param {History} History object
32891 */
32892
32893function historyMiddleware(history) {
32894 return function () {
32895 return function (next) {
32896 return function (action) {
32897 if (action.type === _constants.HISTORY_API) {
32898 var _action$payload = action.payload;
32899 var method = _action$payload.method;
32900 var args = _action$payload.args;
32901
32902 return history[method].apply(history, args);
32903 }
32904 return next(action);
32905 };
32906 };
32907 };
32908}
32909
32910module.exports = exports['default'];
32911},{"301":301}],303:[function(require,module,exports){
32912'use strict';
32913
32914exports.__esModule = true;
32915
32916function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
32917
32918var _routerStateReducer2 = require(309);
32919
32920var _routerStateReducer3 = _interopRequireDefault(_routerStateReducer2);
32921
32922exports.routerStateReducer = _routerStateReducer3['default'];
32923
32924var _ReduxRouter2 = require(298);
32925
32926var _ReduxRouter3 = _interopRequireDefault(_ReduxRouter2);
32927
32928exports.ReduxRouter = _ReduxRouter3['default'];
32929
32930var _client = require(300);
32931
32932var _client2 = _interopRequireDefault(_client);
32933
32934exports.reduxReactRouter = _client2['default'];
32935
32936var _isActive2 = require(304);
32937
32938var _isActive3 = _interopRequireDefault(_isActive2);
32939
32940exports.isActive = _isActive3['default'];
32941
32942var _actionCreators = require(299);
32943
32944exports.historyAPI = _actionCreators.historyAPI;
32945exports.pushState = _actionCreators.pushState;
32946exports.push = _actionCreators.push;
32947exports.replaceState = _actionCreators.replaceState;
32948exports.replace = _actionCreators.replace;
32949exports.setState = _actionCreators.setState;
32950exports.go = _actionCreators.go;
32951exports.goBack = _actionCreators.goBack;
32952exports.goForward = _actionCreators.goForward;
32953},{"298":298,"299":299,"300":300,"304":304,"309":309}],304:[function(require,module,exports){
32954'use strict';
32955
32956exports.__esModule = true;
32957exports['default'] = isActive;
32958
32959function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
32960
32961var _reactRouterLibIsActive = require(137);
32962
32963var _reactRouterLibIsActive2 = _interopRequireDefault(_reactRouterLibIsActive);
32964
32965/**
32966 * Creates a router state selector that returns whether or not the given
32967 * pathname and query are active.
32968 * @param {String} pathname
32969 * @param {Object} query
32970 * @param {Boolean} indexOnly
32971 * @return {Boolean}
32972 */
32973
32974function isActive(pathname, query) {
32975 var indexOnly = arguments.length <= 2 || arguments[2] === undefined ? false : arguments[2];
32976
32977 return function (state) {
32978 if (!state) return false;
32979 var location = state.location;
32980 var params = state.params;
32981 var routes = state.routes;
32982
32983 return _reactRouterLibIsActive2['default'](pathname, query, indexOnly, location, routes, params);
32984 };
32985}
32986
32987module.exports = exports['default'];
32988},{"137":137}],305:[function(require,module,exports){
32989'use strict';
32990
32991exports.__esModule = true;
32992exports['default'] = reduxReactRouter;
32993
32994function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
32995
32996var _redux = require(316);
32997
32998var _reactRouter = require(136);
32999
33000var _historyMiddleware = require(302);
33001
33002var _historyMiddleware2 = _interopRequireDefault(_historyMiddleware);
33003
33004var _constants = require(301);
33005
33006function reduxReactRouter(_ref) {
33007 var routes = _ref.routes;
33008 var createHistory = _ref.createHistory;
33009 var parseQueryString = _ref.parseQueryString;
33010 var stringifyQuery = _ref.stringifyQuery;
33011 var routerStateSelector = _ref.routerStateSelector;
33012
33013 return function (createStore) {
33014 return function (reducer, initialState) {
33015
33016 var baseCreateHistory = undefined;
33017 if (typeof createHistory === 'function') {
33018 baseCreateHistory = createHistory;
33019 } else if (createHistory) {
33020 baseCreateHistory = function () {
33021 return createHistory;
33022 };
33023 }
33024
33025 var history = _reactRouter.useRoutes(baseCreateHistory)({
33026 routes: routes,
33027 parseQueryString: parseQueryString,
33028 stringifyQuery: stringifyQuery
33029 });
33030
33031 ['pushState', 'push', 'replaceState', 'replace', 'setState', 'go', 'goBack', 'goForward', 'listen', 'createLocation', 'match'].forEach(function (funcName) {
33032 if (!history.hasOwnProperty(funcName) && typeof history[funcName] === 'function') {
33033 throw new Error('History API does not support function: ' + funcName);
33034 }
33035 });
33036
33037 var store = _redux.applyMiddleware(_historyMiddleware2['default'](history))(createStore)(reducer, initialState);
33038
33039 store.history = history;
33040 store[_constants.ROUTER_STATE_SELECTOR] = routerStateSelector;
33041
33042 return store;
33043 };
33044 };
33045}
33046
33047module.exports = exports['default'];
33048},{"136":136,"301":301,"302":302,"316":316}],306:[function(require,module,exports){
33049'use strict';
33050
33051exports.__esModule = true;
33052exports['default'] = replaceRoutesMiddleware;
33053
33054var _constants = require(301);
33055
33056function replaceRoutesMiddleware(replaceRoutes) {
33057 return function () {
33058 return function (next) {
33059 return function (action) {
33060 var isInitRoutes = action.type === _constants.INIT_ROUTES;
33061 if (isInitRoutes || action.type === _constants.REPLACE_ROUTES) {
33062 replaceRoutes(action.payload, isInitRoutes);
33063 }
33064 return next(action);
33065 };
33066 };
33067 };
33068}
33069
33070module.exports = exports['default'];
33071},{"301":301}],307:[function(require,module,exports){
33072'use strict';
33073
33074exports.__esModule = true;
33075
33076var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
33077
33078exports['default'] = routeReplacement;
33079
33080function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
33081
33082var _redux = require(316);
33083
33084var _reactRouter = require(136);
33085
33086var _replaceRoutesMiddleware = require(306);
33087
33088var _replaceRoutesMiddleware2 = _interopRequireDefault(_replaceRoutesMiddleware);
33089
33090function routeReplacement(next) {
33091 return function (options) {
33092 return function (createStore) {
33093 return function (reducer, initialState) {
33094 var baseRoutes = options.routes;
33095 var getRoutes = options.getRoutes;
33096 var routerStateSelector = options.routerStateSelector;
33097
33098 var store = undefined;
33099
33100 var childRoutes = [];
33101 var areChildRoutesResolved = false;
33102 var childRoutesCallbacks = [];
33103
33104 function replaceRoutes(r, isInit) {
33105 childRoutes = _reactRouter.createRoutes(r);
33106
33107 var routerState = routerStateSelector(store.getState());
33108 if (routerState && !isInit) {
33109 var _routerState$location = routerState.location;
33110 var state = _routerState$location.state;
33111 var pathname = _routerState$location.pathname;
33112 var query = _routerState$location.query;
33113
33114 store.history.replace({ state: state, pathname: pathname, query: query });
33115 }
33116
33117 if (!areChildRoutesResolved) {
33118 areChildRoutesResolved = true;
33119 childRoutesCallbacks.forEach(function (cb) {
33120 return cb(null, childRoutes);
33121 });
33122 }
33123 }
33124
33125 var routes = undefined;
33126 if (baseRoutes) {
33127 routes = baseRoutes;
33128 } else if (getRoutes) {
33129 routes = getRoutes({
33130 dispatch: function dispatch(action) {
33131 return store.dispatch(action);
33132 },
33133 getState: function getState() {
33134 return store.getState();
33135 }
33136 });
33137 } else {
33138 routes = [{
33139 getChildRoutes: function getChildRoutes(location, cb) {
33140 if (!areChildRoutesResolved) {
33141 childRoutesCallbacks.push(cb);
33142 return;
33143 }
33144
33145 cb(null, childRoutes);
33146 }
33147 }];
33148 }
33149
33150 store = _redux.compose(_redux.applyMiddleware(_replaceRoutesMiddleware2['default'](replaceRoutes)), next(_extends({}, options, {
33151 routes: _reactRouter.createRoutes(routes)
33152 })))(createStore)(reducer, initialState);
33153
33154 return store;
33155 };
33156 };
33157 };
33158}
33159
33160module.exports = exports['default'];
33161},{"136":136,"306":306,"316":316}],308:[function(require,module,exports){
33162'use strict';
33163
33164exports.__esModule = true;
33165exports['default'] = routerStateEquals;
33166
33167function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
33168
33169var _deepEqual = require(14);
33170
33171var _deepEqual2 = _interopRequireDefault(_deepEqual);
33172
33173var _constants = require(301);
33174
33175/**
33176 * Check if two router states are equal. Ignores `location.key`.
33177 * @returns {Boolean}
33178 */
33179
33180function routerStateEquals(a, b) {
33181 if (!a && !b) return true;
33182 if (a && !b || !a && b) return false;
33183 if (a[_constants.DOES_NEED_REFRESH] || b[_constants.DOES_NEED_REFRESH]) return false;
33184
33185 return a.location.pathname === b.location.pathname && a.location.search === b.location.search && _deepEqual2['default'](a.location.state, b.location.state);
33186}
33187
33188module.exports = exports['default'];
33189},{"14":14,"301":301}],309:[function(require,module,exports){
33190'use strict';
33191
33192exports.__esModule = true;
33193
33194var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
33195
33196exports['default'] = routerStateReducer;
33197
33198var _constants = require(301);
33199
33200/**
33201 * Reducer of ROUTER_DID_CHANGE actions. Returns a state object
33202 * with { pathname, query, params, navigationType }
33203 * @param {Object} state - Previous state
33204 * @param {Object} action - Action
33205 * @return {Object} New state
33206 */
33207
33208function routerStateReducer(state, action) {
33209 if (state === undefined) state = null;
33210
33211 var _extends2;
33212
33213 switch (action.type) {
33214 case _constants.ROUTER_DID_CHANGE:
33215 return action.payload;
33216 case _constants.REPLACE_ROUTES:
33217 if (!state) return state;
33218 return _extends({}, state, (_extends2 = {}, _extends2[_constants.DOES_NEED_REFRESH] = true, _extends2));
33219 default:
33220 return state;
33221 }
33222}
33223
33224module.exports = exports['default'];
33225},{"301":301}],310:[function(require,module,exports){
33226'use strict';
33227
33228exports.__esModule = true;
33229
33230var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
33231
33232exports['default'] = useDefaults;
33233var defaults = {
33234 onError: function onError(error) {
33235 throw error;
33236 },
33237 routerStateSelector: function routerStateSelector(state) {
33238 return state.router;
33239 }
33240};
33241
33242function useDefaults(next) {
33243 return function (options) {
33244 return function (createStore) {
33245 return function (reducer, initialState) {
33246 var optionsWithDefaults = _extends({}, defaults, options);
33247
33248 var baseCreateHistory = optionsWithDefaults.createHistory;
33249 var baseHistory = optionsWithDefaults.history;
33250
33251 var createHistory = undefined;
33252 if (typeof baseCreateHistory === 'function') {
33253 createHistory = baseCreateHistory;
33254 } else if (baseHistory) {
33255 createHistory = function () {
33256 return baseHistory;
33257 };
33258 } else {
33259 createHistory = null;
33260 }
33261
33262 return next(_extends({}, optionsWithDefaults, {
33263 createHistory: createHistory
33264 }))(createStore)(reducer, initialState);
33265 };
33266 };
33267 };
33268}
33269
33270module.exports = exports['default'];
33271},{}],311:[function(require,module,exports){
33272'use strict';
33273
33274var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
33275
33276exports.__esModule = true;
33277exports["default"] = applyMiddleware;
33278
33279var _compose = require(314);
33280
33281var _compose2 = _interopRequireDefault(_compose);
33282
33283function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
33284
33285/**
33286 * Creates a store enhancer that applies middleware to the dispatch method
33287 * of the Redux store. This is handy for a variety of tasks, such as expressing
33288 * asynchronous actions in a concise manner, or logging every action payload.
33289 *
33290 * See `redux-thunk` package as an example of the Redux middleware.
33291 *
33292 * Because middleware is potentially asynchronous, this should be the first
33293 * store enhancer in the composition chain.
33294 *
33295 * Note that each middleware will be given the `dispatch` and `getState` functions
33296 * as named arguments.
33297 *
33298 * @param {...Function} middlewares The middleware chain to be applied.
33299 * @returns {Function} A store enhancer applying the middleware.
33300 */
33301function applyMiddleware() {
33302 for (var _len = arguments.length, middlewares = Array(_len), _key = 0; _key < _len; _key++) {
33303 middlewares[_key] = arguments[_key];
33304 }
33305
33306 return function (createStore) {
33307 return function (reducer, initialState, enhancer) {
33308 var store = createStore(reducer, initialState, enhancer);
33309 var _dispatch = store.dispatch;
33310 var chain = [];
33311
33312 var middlewareAPI = {
33313 getState: store.getState,
33314 dispatch: function dispatch(action) {
33315 return _dispatch(action);
33316 }
33317 };
33318 chain = middlewares.map(function (middleware) {
33319 return middleware(middlewareAPI);
33320 });
33321 _dispatch = _compose2["default"].apply(undefined, chain)(store.dispatch);
33322
33323 return _extends({}, store, {
33324 dispatch: _dispatch
33325 });
33326 };
33327 };
33328}
33329},{"314":314}],312:[function(require,module,exports){
33330'use strict';
33331
33332exports.__esModule = true;
33333exports["default"] = bindActionCreators;
33334function bindActionCreator(actionCreator, dispatch) {
33335 return function () {
33336 return dispatch(actionCreator.apply(undefined, arguments));
33337 };
33338}
33339
33340/**
33341 * Turns an object whose values are action creators, into an object with the
33342 * same keys, but with every function wrapped into a `dispatch` call so they
33343 * may be invoked directly. This is just a convenience method, as you can call
33344 * `store.dispatch(MyActionCreators.doSomething())` yourself just fine.
33345 *
33346 * For convenience, you can also pass a single function as the first argument,
33347 * and get a function in return.
33348 *
33349 * @param {Function|Object} actionCreators An object whose values are action
33350 * creator functions. One handy way to obtain it is to use ES6 `import * as`
33351 * syntax. You may also pass a single function.
33352 *
33353 * @param {Function} dispatch The `dispatch` function available on your Redux
33354 * store.
33355 *
33356 * @returns {Function|Object} The object mimicking the original object, but with
33357 * every action creator wrapped into the `dispatch` call. If you passed a
33358 * function as `actionCreators`, the return value will also be a single
33359 * function.
33360 */
33361function bindActionCreators(actionCreators, dispatch) {
33362 if (typeof actionCreators === 'function') {
33363 return bindActionCreator(actionCreators, dispatch);
33364 }
33365
33366 if (typeof actionCreators !== 'object' || actionCreators === null) {
33367 throw new Error('bindActionCreators expected an object or a function, instead received ' + (actionCreators === null ? 'null' : typeof actionCreators) + '. ' + 'Did you write "import ActionCreators from" instead of "import * as ActionCreators from"?');
33368 }
33369
33370 var keys = Object.keys(actionCreators);
33371 var boundActionCreators = {};
33372 for (var i = 0; i < keys.length; i++) {
33373 var key = keys[i];
33374 var actionCreator = actionCreators[key];
33375 if (typeof actionCreator === 'function') {
33376 boundActionCreators[key] = bindActionCreator(actionCreator, dispatch);
33377 }
33378 }
33379 return boundActionCreators;
33380}
33381},{}],313:[function(require,module,exports){
33382(function (process){
33383'use strict';
33384
33385exports.__esModule = true;
33386exports["default"] = combineReducers;
33387
33388var _createStore = require(315);
33389
33390var _isPlainObject = require(320);
33391
33392var _isPlainObject2 = _interopRequireDefault(_isPlainObject);
33393
33394var _warning = require(317);
33395
33396var _warning2 = _interopRequireDefault(_warning);
33397
33398function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
33399
33400function getUndefinedStateErrorMessage(key, action) {
33401 var actionType = action && action.type;
33402 var actionName = actionType && '"' + actionType.toString() + '"' || 'an action';
33403
33404 return 'Reducer "' + key + '" returned undefined handling ' + actionName + '. ' + 'To ignore an action, you must explicitly return the previous state.';
33405}
33406
33407function getUnexpectedStateShapeWarningMessage(inputState, reducers, action) {
33408 var reducerKeys = Object.keys(reducers);
33409 var argumentName = action && action.type === _createStore.ActionTypes.INIT ? 'initialState argument passed to createStore' : 'previous state received by the reducer';
33410
33411 if (reducerKeys.length === 0) {
33412 return 'Store does not have a valid reducer. Make sure the argument passed ' + 'to combineReducers is an object whose values are reducers.';
33413 }
33414
33415 if (!(0, _isPlainObject2["default"])(inputState)) {
33416 return 'The ' + argumentName + ' has unexpected type of "' + {}.toString.call(inputState).match(/\s([a-z|A-Z]+)/)[1] + '". Expected argument to be an object with the following ' + ('keys: "' + reducerKeys.join('", "') + '"');
33417 }
33418
33419 var unexpectedKeys = Object.keys(inputState).filter(function (key) {
33420 return !reducers.hasOwnProperty(key);
33421 });
33422
33423 if (unexpectedKeys.length > 0) {
33424 return 'Unexpected ' + (unexpectedKeys.length > 1 ? 'keys' : 'key') + ' ' + ('"' + unexpectedKeys.join('", "') + '" found in ' + argumentName + '. ') + 'Expected to find one of the known reducer keys instead: ' + ('"' + reducerKeys.join('", "') + '". Unexpected keys will be ignored.');
33425 }
33426}
33427
33428function assertReducerSanity(reducers) {
33429 Object.keys(reducers).forEach(function (key) {
33430 var reducer = reducers[key];
33431 var initialState = reducer(undefined, { type: _createStore.ActionTypes.INIT });
33432
33433 if (typeof initialState === 'undefined') {
33434 throw new Error('Reducer "' + key + '" returned undefined during initialization. ' + 'If the state passed to the reducer is undefined, you must ' + 'explicitly return the initial state. The initial state may ' + 'not be undefined.');
33435 }
33436
33437 var type = '@@redux/PROBE_UNKNOWN_ACTION_' + Math.random().toString(36).substring(7).split('').join('.');
33438 if (typeof reducer(undefined, { type: type }) === 'undefined') {
33439 throw new Error('Reducer "' + key + '" returned undefined when probed with a random type. ' + ('Don\'t try to handle ' + _createStore.ActionTypes.INIT + ' or other actions in "redux/*" ') + 'namespace. They are considered private. Instead, you must return the ' + 'current state for any unknown actions, unless it is undefined, ' + 'in which case you must return the initial state, regardless of the ' + 'action type. The initial state may not be undefined.');
33440 }
33441 });
33442}
33443
33444/**
33445 * Turns an object whose values are different reducer functions, into a single
33446 * reducer function. It will call every child reducer, and gather their results
33447 * into a single state object, whose keys correspond to the keys of the passed
33448 * reducer functions.
33449 *
33450 * @param {Object} reducers An object whose values correspond to different
33451 * reducer functions that need to be combined into one. One handy way to obtain
33452 * it is to use ES6 `import * as reducers` syntax. The reducers may never return
33453 * undefined for any action. Instead, they should return their initial state
33454 * if the state passed to them was undefined, and the current state for any
33455 * unrecognized action.
33456 *
33457 * @returns {Function} A reducer function that invokes every reducer inside the
33458 * passed object, and builds a state object with the same shape.
33459 */
33460function combineReducers(reducers) {
33461 var reducerKeys = Object.keys(reducers);
33462 var finalReducers = {};
33463 for (var i = 0; i < reducerKeys.length; i++) {
33464 var key = reducerKeys[i];
33465 if (typeof reducers[key] === 'function') {
33466 finalReducers[key] = reducers[key];
33467 }
33468 }
33469 var finalReducerKeys = Object.keys(finalReducers);
33470
33471 var sanityError;
33472 try {
33473 assertReducerSanity(finalReducers);
33474 } catch (e) {
33475 sanityError = e;
33476 }
33477
33478 return function combination() {
33479 var state = arguments.length <= 0 || arguments[0] === undefined ? {} : arguments[0];
33480 var action = arguments[1];
33481
33482 if (sanityError) {
33483 throw sanityError;
33484 }
33485
33486 if (process.env.NODE_ENV !== 'production') {
33487 var warningMessage = getUnexpectedStateShapeWarningMessage(state, finalReducers, action);
33488 if (warningMessage) {
33489 (0, _warning2["default"])(warningMessage);
33490 }
33491 }
33492
33493 var hasChanged = false;
33494 var nextState = {};
33495 for (var i = 0; i < finalReducerKeys.length; i++) {
33496 var key = finalReducerKeys[i];
33497 var reducer = finalReducers[key];
33498 var previousStateForKey = state[key];
33499 var nextStateForKey = reducer(previousStateForKey, action);
33500 if (typeof nextStateForKey === 'undefined') {
33501 var errorMessage = getUndefinedStateErrorMessage(key, action);
33502 throw new Error(errorMessage);
33503 }
33504 nextState[key] = nextStateForKey;
33505 hasChanged = hasChanged || nextStateForKey !== previousStateForKey;
33506 }
33507 return hasChanged ? nextState : state;
33508 };
33509}
33510}).call(this,require(91))
33511},{"315":315,"317":317,"320":320,"91":91}],314:[function(require,module,exports){
33512"use strict";
33513
33514exports.__esModule = true;
33515exports["default"] = compose;
33516/**
33517 * Composes single-argument functions from right to left.
33518 *
33519 * @param {...Function} funcs The functions to compose.
33520 * @returns {Function} A function obtained by composing functions from right to
33521 * left. For example, compose(f, g, h) is identical to arg => f(g(h(arg))).
33522 */
33523function compose() {
33524 for (var _len = arguments.length, funcs = Array(_len), _key = 0; _key < _len; _key++) {
33525 funcs[_key] = arguments[_key];
33526 }
33527
33528 return function () {
33529 if (funcs.length === 0) {
33530 return arguments.length <= 0 ? undefined : arguments[0];
33531 }
33532
33533 var last = funcs[funcs.length - 1];
33534 var rest = funcs.slice(0, -1);
33535
33536 return rest.reduceRight(function (composed, f) {
33537 return f(composed);
33538 }, last.apply(undefined, arguments));
33539 };
33540}
33541},{}],315:[function(require,module,exports){
33542'use strict';
33543
33544exports.__esModule = true;
33545exports.ActionTypes = undefined;
33546exports["default"] = createStore;
33547
33548var _isPlainObject = require(320);
33549
33550var _isPlainObject2 = _interopRequireDefault(_isPlainObject);
33551
33552function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
33553
33554/**
33555 * These are private action types reserved by Redux.
33556 * For any unknown actions, you must return the current state.
33557 * If the current state is undefined, you must return the initial state.
33558 * Do not reference these action types directly in your code.
33559 */
33560var ActionTypes = exports.ActionTypes = {
33561 INIT: '@@redux/INIT'
33562};
33563
33564/**
33565 * Creates a Redux store that holds the state tree.
33566 * The only way to change the data in the store is to call `dispatch()` on it.
33567 *
33568 * There should only be a single store in your app. To specify how different
33569 * parts of the state tree respond to actions, you may combine several reducers
33570 * into a single reducer function by using `combineReducers`.
33571 *
33572 * @param {Function} reducer A function that returns the next state tree, given
33573 * the current state tree and the action to handle.
33574 *
33575 * @param {any} [initialState] The initial state. You may optionally specify it
33576 * to hydrate the state from the server in universal apps, or to restore a
33577 * previously serialized user session.
33578 * If you use `combineReducers` to produce the root reducer function, this must be
33579 * an object with the same shape as `combineReducers` keys.
33580 *
33581 * @param {Function} enhancer The store enhancer. You may optionally specify it
33582 * to enhance the store with third-party capabilities such as middleware,
33583 * time travel, persistence, etc. The only store enhancer that ships with Redux
33584 * is `applyMiddleware()`.
33585 *
33586 * @returns {Store} A Redux store that lets you read the state, dispatch actions
33587 * and subscribe to changes.
33588 */
33589function createStore(reducer, initialState, enhancer) {
33590 if (typeof initialState === 'function' && typeof enhancer === 'undefined') {
33591 enhancer = initialState;
33592 initialState = undefined;
33593 }
33594
33595 if (typeof enhancer !== 'undefined') {
33596 if (typeof enhancer !== 'function') {
33597 throw new Error('Expected the enhancer to be a function.');
33598 }
33599
33600 return enhancer(createStore)(reducer, initialState);
33601 }
33602
33603 if (typeof reducer !== 'function') {
33604 throw new Error('Expected the reducer to be a function.');
33605 }
33606
33607 var currentReducer = reducer;
33608 var currentState = initialState;
33609 var currentListeners = [];
33610 var nextListeners = currentListeners;
33611 var isDispatching = false;
33612
33613 function ensureCanMutateNextListeners() {
33614 if (nextListeners === currentListeners) {
33615 nextListeners = currentListeners.slice();
33616 }
33617 }
33618
33619 /**
33620 * Reads the state tree managed by the store.
33621 *
33622 * @returns {any} The current state tree of your application.
33623 */
33624 function getState() {
33625 return currentState;
33626 }
33627
33628 /**
33629 * Adds a change listener. It will be called any time an action is dispatched,
33630 * and some part of the state tree may potentially have changed. You may then
33631 * call `getState()` to read the current state tree inside the callback.
33632 *
33633 * You may call `dispatch()` from a change listener, with the following
33634 * caveats:
33635 *
33636 * 1. The subscriptions are snapshotted just before every `dispatch()` call.
33637 * If you subscribe or unsubscribe while the listeners are being invoked, this
33638 * will not have any effect on the `dispatch()` that is currently in progress.
33639 * However, the next `dispatch()` call, whether nested or not, will use a more
33640 * recent snapshot of the subscription list.
33641 *
33642 * 2. The listener should not expect to see all states changes, as the state
33643 * might have been updated multiple times during a nested `dispatch()` before
33644 * the listener is called. It is, however, guaranteed that all subscribers
33645 * registered before the `dispatch()` started will be called with the latest
33646 * state by the time it exits.
33647 *
33648 * @param {Function} listener A callback to be invoked on every dispatch.
33649 * @returns {Function} A function to remove this change listener.
33650 */
33651 function subscribe(listener) {
33652 if (typeof listener !== 'function') {
33653 throw new Error('Expected listener to be a function.');
33654 }
33655
33656 var isSubscribed = true;
33657
33658 ensureCanMutateNextListeners();
33659 nextListeners.push(listener);
33660
33661 return function unsubscribe() {
33662 if (!isSubscribed) {
33663 return;
33664 }
33665
33666 isSubscribed = false;
33667
33668 ensureCanMutateNextListeners();
33669 var index = nextListeners.indexOf(listener);
33670 nextListeners.splice(index, 1);
33671 };
33672 }
33673
33674 /**
33675 * Dispatches an action. It is the only way to trigger a state change.
33676 *
33677 * The `reducer` function, used to create the store, will be called with the
33678 * current state tree and the given `action`. Its return value will
33679 * be considered the **next** state of the tree, and the change listeners
33680 * will be notified.
33681 *
33682 * The base implementation only supports plain object actions. If you want to
33683 * dispatch a Promise, an Observable, a thunk, or something else, you need to
33684 * wrap your store creating function into the corresponding middleware. For
33685 * example, see the documentation for the `redux-thunk` package. Even the
33686 * middleware will eventually dispatch plain object actions using this method.
33687 *
33688 * @param {Object} action A plain object representing “what changed”. It is
33689 * a good idea to keep actions serializable so you can record and replay user
33690 * sessions, or use the time travelling `redux-devtools`. An action must have
33691 * a `type` property which may not be `undefined`. It is a good idea to use
33692 * string constants for action types.
33693 *
33694 * @returns {Object} For convenience, the same action object you dispatched.
33695 *
33696 * Note that, if you use a custom middleware, it may wrap `dispatch()` to
33697 * return something else (for example, a Promise you can await).
33698 */
33699 function dispatch(action) {
33700 if (!(0, _isPlainObject2["default"])(action)) {
33701 throw new Error('Actions must be plain objects. ' + 'Use custom middleware for async actions.');
33702 }
33703
33704 if (typeof action.type === 'undefined') {
33705 throw new Error('Actions may not have an undefined "type" property. ' + 'Have you misspelled a constant?');
33706 }
33707
33708 if (isDispatching) {
33709 throw new Error('Reducers may not dispatch actions.');
33710 }
33711
33712 try {
33713 isDispatching = true;
33714 currentState = currentReducer(currentState, action);
33715 } finally {
33716 isDispatching = false;
33717 }
33718
33719 var listeners = currentListeners = nextListeners;
33720 for (var i = 0; i < listeners.length; i++) {
33721 listeners[i]();
33722 }
33723
33724 return action;
33725 }
33726
33727 /**
33728 * Replaces the reducer currently used by the store to calculate the state.
33729 *
33730 * You might need this if your app implements code splitting and you want to
33731 * load some of the reducers dynamically. You might also need this if you
33732 * implement a hot reloading mechanism for Redux.
33733 *
33734 * @param {Function} nextReducer The reducer for the store to use instead.
33735 * @returns {void}
33736 */
33737 function replaceReducer(nextReducer) {
33738 if (typeof nextReducer !== 'function') {
33739 throw new Error('Expected the nextReducer to be a function.');
33740 }
33741
33742 currentReducer = nextReducer;
33743 dispatch({ type: ActionTypes.INIT });
33744 }
33745
33746 // When a store is created, an "INIT" action is dispatched so that every
33747 // reducer returns their initial state. This effectively populates
33748 // the initial state tree.
33749 dispatch({ type: ActionTypes.INIT });
33750
33751 return {
33752 dispatch: dispatch,
33753 subscribe: subscribe,
33754 getState: getState,
33755 replaceReducer: replaceReducer
33756 };
33757}
33758},{"320":320}],316:[function(require,module,exports){
33759(function (process){
33760'use strict';
33761
33762exports.__esModule = true;
33763exports.compose = exports.applyMiddleware = exports.bindActionCreators = exports.combineReducers = exports.createStore = undefined;
33764
33765var _createStore = require(315);
33766
33767var _createStore2 = _interopRequireDefault(_createStore);
33768
33769var _combineReducers = require(313);
33770
33771var _combineReducers2 = _interopRequireDefault(_combineReducers);
33772
33773var _bindActionCreators = require(312);
33774
33775var _bindActionCreators2 = _interopRequireDefault(_bindActionCreators);
33776
33777var _applyMiddleware = require(311);
33778
33779var _applyMiddleware2 = _interopRequireDefault(_applyMiddleware);
33780
33781var _compose = require(314);
33782
33783var _compose2 = _interopRequireDefault(_compose);
33784
33785var _warning = require(317);
33786
33787var _warning2 = _interopRequireDefault(_warning);
33788
33789function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
33790
33791/*
33792* This is a dummy function to check if the function name has been altered by minification.
33793* If the function has been minified and NODE_ENV !== 'production', warn the user.
33794*/
33795function isCrushed() {}
33796
33797if (process.env.NODE_ENV !== 'production' && typeof isCrushed.name === 'string' && isCrushed.name !== 'isCrushed') {
33798 (0, _warning2["default"])('You are currently using minified code outside of NODE_ENV === \'production\'. ' + 'This means that you are running a slower development build of Redux. ' + 'You can use loose-envify (https://github.com/zertosh/loose-envify) for browserify ' + 'or DefinePlugin for webpack (http://stackoverflow.com/questions/30030031) ' + 'to ensure you have the correct code for your production build.');
33799}
33800
33801exports.createStore = _createStore2["default"];
33802exports.combineReducers = _combineReducers2["default"];
33803exports.bindActionCreators = _bindActionCreators2["default"];
33804exports.applyMiddleware = _applyMiddleware2["default"];
33805exports.compose = _compose2["default"];
33806}).call(this,require(91))
33807},{"311":311,"312":312,"313":313,"314":314,"315":315,"317":317,"91":91}],317:[function(require,module,exports){
33808arguments[4][103][0].apply(exports,arguments)
33809},{"103":103}],318:[function(require,module,exports){
33810arguments[4][106][0].apply(exports,arguments)
33811},{"106":106}],319:[function(require,module,exports){
33812/**
33813 * Checks if `value` is object-like. A value is object-like if it's not `null`
33814 * and has a `typeof` result of "object".
33815 *
33816 * @static
33817 * @memberOf _
33818 * @category Lang
33819 * @param {*} value The value to check.
33820 * @returns {boolean} Returns `true` if `value` is object-like, else `false`.
33821 * @example
33822 *
33823 * _.isObjectLike({});
33824 * // => true
33825 *
33826 * _.isObjectLike([1, 2, 3]);
33827 * // => true
33828 *
33829 * _.isObjectLike(_.noop);
33830 * // => false
33831 *
33832 * _.isObjectLike(null);
33833 * // => false
33834 */
33835function isObjectLike(value) {
33836 return !!value && typeof value == 'object';
33837}
33838
33839module.exports = isObjectLike;
33840
33841},{}],320:[function(require,module,exports){
33842var isHostObject = require(318),
33843 isObjectLike = require(319);
33844
33845/** `Object#toString` result references. */
33846var objectTag = '[object Object]';
33847
33848/** Used for built-in method references. */
33849var objectProto = Object.prototype;
33850
33851/** Used to resolve the decompiled source of functions. */
33852var funcToString = Function.prototype.toString;
33853
33854/** Used to infer the `Object` constructor. */
33855var objectCtorString = funcToString.call(Object);
33856
33857/**
33858 * Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring)
33859 * of values.
33860 */
33861var objectToString = objectProto.toString;
33862
33863/** Built-in value references. */
33864var getPrototypeOf = Object.getPrototypeOf;
33865
33866/**
33867 * Checks if `value` is a plain object, that is, an object created by the
33868 * `Object` constructor or one with a `[[Prototype]]` of `null`.
33869 *
33870 * @static
33871 * @memberOf _
33872 * @category Lang
33873 * @param {*} value The value to check.
33874 * @returns {boolean} Returns `true` if `value` is a plain object, else `false`.
33875 * @example
33876 *
33877 * function Foo() {
33878 * this.a = 1;
33879 * }
33880 *
33881 * _.isPlainObject(new Foo);
33882 * // => false
33883 *
33884 * _.isPlainObject([1, 2, 3]);
33885 * // => false
33886 *
33887 * _.isPlainObject({ 'x': 0, 'y': 0 });
33888 * // => true
33889 *
33890 * _.isPlainObject(Object.create(null));
33891 * // => true
33892 */
33893function isPlainObject(value) {
33894 if (!isObjectLike(value) || objectToString.call(value) != objectTag || isHostObject(value)) {
33895 return false;
33896 }
33897 var proto = objectProto;
33898 if (typeof value.constructor == 'function') {
33899 proto = getPrototypeOf(value);
33900 }
33901 if (proto === null) {
33902 return true;
33903 }
33904 var Ctor = proto.constructor;
33905 return (typeof Ctor == 'function' &&
33906 Ctor instanceof Ctor && funcToString.call(Ctor) == objectCtorString);
33907}
33908
33909module.exports = isPlainObject;
33910
33911},{"318":318,"319":319}],321:[function(require,module,exports){
33912
33913/**
33914 * Module dependencies.
33915 */
33916
33917var url = require(325);
33918var parser = require(328);
33919var Manager = require(322);
33920var debug = require(12)('socket.io-client');
33921
33922/**
33923 * Module exports.
33924 */
33925
33926module.exports = exports = lookup;
33927
33928/**
33929 * Managers cache.
33930 */
33931
33932var cache = exports.managers = {};
33933
33934/**
33935 * Looks up an existing `Manager` for multiplexing.
33936 * If the user summons:
33937 *
33938 * `io('http://localhost/a');`
33939 * `io('http://localhost/b');`
33940 *
33941 * We reuse the existing instance based on same scheme/port/host,
33942 * and we initialize sockets for each namespace.
33943 *
33944 * @api public
33945 */
33946
33947function lookup(uri, opts) {
33948 if (typeof uri == 'object') {
33949 opts = uri;
33950 uri = undefined;
33951 }
33952
33953 opts = opts || {};
33954
33955 var parsed = url(uri);
33956 var source = parsed.source;
33957 var id = parsed.id;
33958 var path = parsed.path;
33959 var sameNamespace = cache[id] && path in cache[id].nsps;
33960 var newConnection = opts.forceNew || opts['force new connection'] ||
33961 false === opts.multiplex || sameNamespace;
33962
33963 var io;
33964
33965 if (newConnection) {
33966 debug('ignoring socket cache for %s', source);
33967 io = Manager(source, opts);
33968 } else {
33969 if (!cache[id]) {
33970 debug('new io instance for %s', source);
33971 cache[id] = Manager(source, opts);
33972 }
33973 io = cache[id];
33974 }
33975
33976 return io.socket(parsed.path);
33977}
33978
33979/**
33980 * Protocol version.
33981 *
33982 * @api public
33983 */
33984
33985exports.protocol = parser.protocol;
33986
33987/**
33988 * `connect`.
33989 *
33990 * @param {String} uri
33991 * @api public
33992 */
33993
33994exports.connect = lookup;
33995
33996/**
33997 * Expose constructors for standalone build.
33998 *
33999 * @api public
34000 */
34001
34002exports.Manager = require(322);
34003exports.Socket = require(324);
34004
34005},{"12":12,"322":322,"324":324,"325":325,"328":328}],322:[function(require,module,exports){
34006
34007/**
34008 * Module dependencies.
34009 */
34010
34011var eio = require(17);
34012var Socket = require(324);
34013var Emitter = require(326);
34014var parser = require(328);
34015var on = require(323);
34016var bind = require(9);
34017var debug = require(12)('socket.io-client:manager');
34018var indexOf = require(80);
34019var Backoff = require(5);
34020
34021/**
34022 * IE6+ hasOwnProperty
34023 */
34024
34025var has = Object.prototype.hasOwnProperty;
34026
34027/**
34028 * Module exports
34029 */
34030
34031module.exports = Manager;
34032
34033/**
34034 * `Manager` constructor.
34035 *
34036 * @param {String} engine instance or engine uri/opts
34037 * @param {Object} options
34038 * @api public
34039 */
34040
34041function Manager(uri, opts){
34042 if (!(this instanceof Manager)) return new Manager(uri, opts);
34043 if (uri && ('object' == typeof uri)) {
34044 opts = uri;
34045 uri = undefined;
34046 }
34047 opts = opts || {};
34048
34049 opts.path = opts.path || '/socket.io';
34050 this.nsps = {};
34051 this.subs = [];
34052 this.opts = opts;
34053 this.reconnection(opts.reconnection !== false);
34054 this.reconnectionAttempts(opts.reconnectionAttempts || Infinity);
34055 this.reconnectionDelay(opts.reconnectionDelay || 1000);
34056 this.reconnectionDelayMax(opts.reconnectionDelayMax || 5000);
34057 this.randomizationFactor(opts.randomizationFactor || 0.5);
34058 this.backoff = new Backoff({
34059 min: this.reconnectionDelay(),
34060 max: this.reconnectionDelayMax(),
34061 jitter: this.randomizationFactor()
34062 });
34063 this.timeout(null == opts.timeout ? 20000 : opts.timeout);
34064 this.readyState = 'closed';
34065 this.uri = uri;
34066 this.connecting = [];
34067 this.lastPing = null;
34068 this.encoding = false;
34069 this.packetBuffer = [];
34070 this.encoder = new parser.Encoder();
34071 this.decoder = new parser.Decoder();
34072 this.autoConnect = opts.autoConnect !== false;
34073 if (this.autoConnect) this.open();
34074}
34075
34076/**
34077 * Propagate given event to sockets and emit on `this`
34078 *
34079 * @api private
34080 */
34081
34082Manager.prototype.emitAll = function() {
34083 this.emit.apply(this, arguments);
34084 for (var nsp in this.nsps) {
34085 if (has.call(this.nsps, nsp)) {
34086 this.nsps[nsp].emit.apply(this.nsps[nsp], arguments);
34087 }
34088 }
34089};
34090
34091/**
34092 * Update `socket.id` of all sockets
34093 *
34094 * @api private
34095 */
34096
34097Manager.prototype.updateSocketIds = function(){
34098 for (var nsp in this.nsps) {
34099 if (has.call(this.nsps, nsp)) {
34100 this.nsps[nsp].id = this.engine.id;
34101 }
34102 }
34103};
34104
34105/**
34106 * Mix in `Emitter`.
34107 */
34108
34109Emitter(Manager.prototype);
34110
34111/**
34112 * Sets the `reconnection` config.
34113 *
34114 * @param {Boolean} true/false if it should automatically reconnect
34115 * @return {Manager} self or value
34116 * @api public
34117 */
34118
34119Manager.prototype.reconnection = function(v){
34120 if (!arguments.length) return this._reconnection;
34121 this._reconnection = !!v;
34122 return this;
34123};
34124
34125/**
34126 * Sets the reconnection attempts config.
34127 *
34128 * @param {Number} max reconnection attempts before giving up
34129 * @return {Manager} self or value
34130 * @api public
34131 */
34132
34133Manager.prototype.reconnectionAttempts = function(v){
34134 if (!arguments.length) return this._reconnectionAttempts;
34135 this._reconnectionAttempts = v;
34136 return this;
34137};
34138
34139/**
34140 * Sets the delay between reconnections.
34141 *
34142 * @param {Number} delay
34143 * @return {Manager} self or value
34144 * @api public
34145 */
34146
34147Manager.prototype.reconnectionDelay = function(v){
34148 if (!arguments.length) return this._reconnectionDelay;
34149 this._reconnectionDelay = v;
34150 this.backoff && this.backoff.setMin(v);
34151 return this;
34152};
34153
34154Manager.prototype.randomizationFactor = function(v){
34155 if (!arguments.length) return this._randomizationFactor;
34156 this._randomizationFactor = v;
34157 this.backoff && this.backoff.setJitter(v);
34158 return this;
34159};
34160
34161/**
34162 * Sets the maximum delay between reconnections.
34163 *
34164 * @param {Number} delay
34165 * @return {Manager} self or value
34166 * @api public
34167 */
34168
34169Manager.prototype.reconnectionDelayMax = function(v){
34170 if (!arguments.length) return this._reconnectionDelayMax;
34171 this._reconnectionDelayMax = v;
34172 this.backoff && this.backoff.setMax(v);
34173 return this;
34174};
34175
34176/**
34177 * Sets the connection timeout. `false` to disable
34178 *
34179 * @return {Manager} self or value
34180 * @api public
34181 */
34182
34183Manager.prototype.timeout = function(v){
34184 if (!arguments.length) return this._timeout;
34185 this._timeout = v;
34186 return this;
34187};
34188
34189/**
34190 * Starts trying to reconnect if reconnection is enabled and we have not
34191 * started reconnecting yet
34192 *
34193 * @api private
34194 */
34195
34196Manager.prototype.maybeReconnectOnOpen = function() {
34197 // Only try to reconnect if it's the first time we're connecting
34198 if (!this.reconnecting && this._reconnection && this.backoff.attempts === 0) {
34199 // keeps reconnection from firing twice for the same reconnection loop
34200 this.reconnect();
34201 }
34202};
34203
34204
34205/**
34206 * Sets the current transport `socket`.
34207 *
34208 * @param {Function} optional, callback
34209 * @return {Manager} self
34210 * @api public
34211 */
34212
34213Manager.prototype.open =
34214Manager.prototype.connect = function(fn){
34215 debug('readyState %s', this.readyState);
34216 if (~this.readyState.indexOf('open')) return this;
34217
34218 debug('opening %s', this.uri);
34219 this.engine = eio(this.uri, this.opts);
34220 var socket = this.engine;
34221 var self = this;
34222 this.readyState = 'opening';
34223 this.skipReconnect = false;
34224
34225 // emit `open`
34226 var openSub = on(socket, 'open', function() {
34227 self.onopen();
34228 fn && fn();
34229 });
34230
34231 // emit `connect_error`
34232 var errorSub = on(socket, 'error', function(data){
34233 debug('connect_error');
34234 self.cleanup();
34235 self.readyState = 'closed';
34236 self.emitAll('connect_error', data);
34237 if (fn) {
34238 var err = new Error('Connection error');
34239 err.data = data;
34240 fn(err);
34241 } else {
34242 // Only do this if there is no fn to handle the error
34243 self.maybeReconnectOnOpen();
34244 }
34245 });
34246
34247 // emit `connect_timeout`
34248 if (false !== this._timeout) {
34249 var timeout = this._timeout;
34250 debug('connect attempt will timeout after %d', timeout);
34251
34252 // set timer
34253 var timer = setTimeout(function(){
34254 debug('connect attempt timed out after %d', timeout);
34255 openSub.destroy();
34256 socket.close();
34257 socket.emit('error', 'timeout');
34258 self.emitAll('connect_timeout', timeout);
34259 }, timeout);
34260
34261 this.subs.push({
34262 destroy: function(){
34263 clearTimeout(timer);
34264 }
34265 });
34266 }
34267
34268 this.subs.push(openSub);
34269 this.subs.push(errorSub);
34270
34271 return this;
34272};
34273
34274/**
34275 * Called upon transport open.
34276 *
34277 * @api private
34278 */
34279
34280Manager.prototype.onopen = function(){
34281 debug('open');
34282
34283 // clear old subs
34284 this.cleanup();
34285
34286 // mark as open
34287 this.readyState = 'open';
34288 this.emit('open');
34289
34290 // add new subs
34291 var socket = this.engine;
34292 this.subs.push(on(socket, 'data', bind(this, 'ondata')));
34293 this.subs.push(on(socket, 'ping', bind(this, 'onping')));
34294 this.subs.push(on(socket, 'pong', bind(this, 'onpong')));
34295 this.subs.push(on(socket, 'error', bind(this, 'onerror')));
34296 this.subs.push(on(socket, 'close', bind(this, 'onclose')));
34297 this.subs.push(on(this.decoder, 'decoded', bind(this, 'ondecoded')));
34298};
34299
34300/**
34301 * Called upon a ping.
34302 *
34303 * @api private
34304 */
34305
34306Manager.prototype.onping = function(){
34307 this.lastPing = new Date;
34308 this.emitAll('ping');
34309};
34310
34311/**
34312 * Called upon a packet.
34313 *
34314 * @api private
34315 */
34316
34317Manager.prototype.onpong = function(){
34318 this.emitAll('pong', new Date - this.lastPing);
34319};
34320
34321/**
34322 * Called with data.
34323 *
34324 * @api private
34325 */
34326
34327Manager.prototype.ondata = function(data){
34328 this.decoder.add(data);
34329};
34330
34331/**
34332 * Called when parser fully decodes a packet.
34333 *
34334 * @api private
34335 */
34336
34337Manager.prototype.ondecoded = function(packet) {
34338 this.emit('packet', packet);
34339};
34340
34341/**
34342 * Called upon socket error.
34343 *
34344 * @api private
34345 */
34346
34347Manager.prototype.onerror = function(err){
34348 debug('error', err);
34349 this.emitAll('error', err);
34350};
34351
34352/**
34353 * Creates a new socket for the given `nsp`.
34354 *
34355 * @return {Socket}
34356 * @api public
34357 */
34358
34359Manager.prototype.socket = function(nsp){
34360 var socket = this.nsps[nsp];
34361 if (!socket) {
34362 socket = new Socket(this, nsp);
34363 this.nsps[nsp] = socket;
34364 var self = this;
34365 socket.on('connecting', onConnecting);
34366 socket.on('connect', function(){
34367 socket.id = self.engine.id;
34368 });
34369
34370 if (this.autoConnect) {
34371 // manually call here since connecting evnet is fired before listening
34372 onConnecting();
34373 }
34374 }
34375
34376 function onConnecting() {
34377 if (!~indexOf(self.connecting, socket)) {
34378 self.connecting.push(socket);
34379 }
34380 }
34381
34382 return socket;
34383};
34384
34385/**
34386 * Called upon a socket close.
34387 *
34388 * @param {Socket} socket
34389 */
34390
34391Manager.prototype.destroy = function(socket){
34392 var index = indexOf(this.connecting, socket);
34393 if (~index) this.connecting.splice(index, 1);
34394 if (this.connecting.length) return;
34395
34396 this.close();
34397};
34398
34399/**
34400 * Writes a packet.
34401 *
34402 * @param {Object} packet
34403 * @api private
34404 */
34405
34406Manager.prototype.packet = function(packet){
34407 debug('writing packet %j', packet);
34408 var self = this;
34409
34410 if (!self.encoding) {
34411 // encode, then write to engine with result
34412 self.encoding = true;
34413 this.encoder.encode(packet, function(encodedPackets) {
34414 for (var i = 0; i < encodedPackets.length; i++) {
34415 self.engine.write(encodedPackets[i], packet.options);
34416 }
34417 self.encoding = false;
34418 self.processPacketQueue();
34419 });
34420 } else { // add packet to the queue
34421 self.packetBuffer.push(packet);
34422 }
34423};
34424
34425/**
34426 * If packet buffer is non-empty, begins encoding the
34427 * next packet in line.
34428 *
34429 * @api private
34430 */
34431
34432Manager.prototype.processPacketQueue = function() {
34433 if (this.packetBuffer.length > 0 && !this.encoding) {
34434 var pack = this.packetBuffer.shift();
34435 this.packet(pack);
34436 }
34437};
34438
34439/**
34440 * Clean up transport subscriptions and packet buffer.
34441 *
34442 * @api private
34443 */
34444
34445Manager.prototype.cleanup = function(){
34446 debug('cleanup');
34447
34448 var sub;
34449 while (sub = this.subs.shift()) sub.destroy();
34450
34451 this.packetBuffer = [];
34452 this.encoding = false;
34453 this.lastPing = null;
34454
34455 this.decoder.destroy();
34456};
34457
34458/**
34459 * Close the current socket.
34460 *
34461 * @api private
34462 */
34463
34464Manager.prototype.close =
34465Manager.prototype.disconnect = function(){
34466 debug('disconnect');
34467 this.skipReconnect = true;
34468 this.reconnecting = false;
34469 if ('opening' == this.readyState) {
34470 // `onclose` will not fire because
34471 // an open event never happened
34472 this.cleanup();
34473 }
34474 this.backoff.reset();
34475 this.readyState = 'closed';
34476 if (this.engine) this.engine.close();
34477};
34478
34479/**
34480 * Called upon engine close.
34481 *
34482 * @api private
34483 */
34484
34485Manager.prototype.onclose = function(reason){
34486 debug('onclose');
34487
34488 this.cleanup();
34489 this.backoff.reset();
34490 this.readyState = 'closed';
34491 this.emit('close', reason);
34492
34493 if (this._reconnection && !this.skipReconnect) {
34494 this.reconnect();
34495 }
34496};
34497
34498/**
34499 * Attempt a reconnection.
34500 *
34501 * @api private
34502 */
34503
34504Manager.prototype.reconnect = function(){
34505 if (this.reconnecting || this.skipReconnect) return this;
34506
34507 var self = this;
34508
34509 if (this.backoff.attempts >= this._reconnectionAttempts) {
34510 debug('reconnect failed');
34511 this.backoff.reset();
34512 this.emitAll('reconnect_failed');
34513 this.reconnecting = false;
34514 } else {
34515 var delay = this.backoff.duration();
34516 debug('will wait %dms before reconnect attempt', delay);
34517
34518 this.reconnecting = true;
34519 var timer = setTimeout(function(){
34520 if (self.skipReconnect) return;
34521
34522 debug('attempting reconnect');
34523 self.emitAll('reconnect_attempt', self.backoff.attempts);
34524 self.emitAll('reconnecting', self.backoff.attempts);
34525
34526 // check again for the case socket closed in above events
34527 if (self.skipReconnect) return;
34528
34529 self.open(function(err){
34530 if (err) {
34531 debug('reconnect attempt error');
34532 self.reconnecting = false;
34533 self.reconnect();
34534 self.emitAll('reconnect_error', err.data);
34535 } else {
34536 debug('reconnect success');
34537 self.onreconnect();
34538 }
34539 });
34540 }, delay);
34541
34542 this.subs.push({
34543 destroy: function(){
34544 clearTimeout(timer);
34545 }
34546 });
34547 }
34548};
34549
34550/**
34551 * Called upon successful reconnect.
34552 *
34553 * @api private
34554 */
34555
34556Manager.prototype.onreconnect = function(){
34557 var attempt = this.backoff.attempts;
34558 this.reconnecting = false;
34559 this.backoff.reset();
34560 this.updateSocketIds();
34561 this.emitAll('reconnect', attempt);
34562};
34563
34564},{"12":12,"17":17,"323":323,"324":324,"326":326,"328":328,"5":5,"80":80,"9":9}],323:[function(require,module,exports){
34565
34566/**
34567 * Module exports.
34568 */
34569
34570module.exports = on;
34571
34572/**
34573 * Helper for subscriptions.
34574 *
34575 * @param {Object|EventEmitter} obj with `Emitter` mixin or `EventEmitter`
34576 * @param {String} event name
34577 * @param {Function} callback
34578 * @api public
34579 */
34580
34581function on(obj, ev, fn) {
34582 obj.on(ev, fn);
34583 return {
34584 destroy: function(){
34585 obj.removeListener(ev, fn);
34586 }
34587 };
34588}
34589
34590},{}],324:[function(require,module,exports){
34591
34592/**
34593 * Module dependencies.
34594 */
34595
34596var parser = require(328);
34597var Emitter = require(326);
34598var toArray = require(333);
34599var on = require(323);
34600var bind = require(9);
34601var debug = require(12)('socket.io-client:socket');
34602var hasBin = require(56);
34603
34604/**
34605 * Module exports.
34606 */
34607
34608module.exports = exports = Socket;
34609
34610/**
34611 * Internal events (blacklisted).
34612 * These events can't be emitted by the user.
34613 *
34614 * @api private
34615 */
34616
34617var events = {
34618 connect: 1,
34619 connect_error: 1,
34620 connect_timeout: 1,
34621 connecting: 1,
34622 disconnect: 1,
34623 error: 1,
34624 reconnect: 1,
34625 reconnect_attempt: 1,
34626 reconnect_failed: 1,
34627 reconnect_error: 1,
34628 reconnecting: 1,
34629 ping: 1,
34630 pong: 1
34631};
34632
34633/**
34634 * Shortcut to `Emitter#emit`.
34635 */
34636
34637var emit = Emitter.prototype.emit;
34638
34639/**
34640 * `Socket` constructor.
34641 *
34642 * @api public
34643 */
34644
34645function Socket(io, nsp){
34646 this.io = io;
34647 this.nsp = nsp;
34648 this.json = this; // compat
34649 this.ids = 0;
34650 this.acks = {};
34651 this.receiveBuffer = [];
34652 this.sendBuffer = [];
34653 this.connected = false;
34654 this.disconnected = true;
34655 if (this.io.autoConnect) this.open();
34656}
34657
34658/**
34659 * Mix in `Emitter`.
34660 */
34661
34662Emitter(Socket.prototype);
34663
34664/**
34665 * Subscribe to open, close and packet events
34666 *
34667 * @api private
34668 */
34669
34670Socket.prototype.subEvents = function() {
34671 if (this.subs) return;
34672
34673 var io = this.io;
34674 this.subs = [
34675 on(io, 'open', bind(this, 'onopen')),
34676 on(io, 'packet', bind(this, 'onpacket')),
34677 on(io, 'close', bind(this, 'onclose'))
34678 ];
34679};
34680
34681/**
34682 * "Opens" the socket.
34683 *
34684 * @api public
34685 */
34686
34687Socket.prototype.open =
34688Socket.prototype.connect = function(){
34689 if (this.connected) return this;
34690
34691 this.subEvents();
34692 this.io.open(); // ensure open
34693 if ('open' == this.io.readyState) this.onopen();
34694 this.emit('connecting');
34695 return this;
34696};
34697
34698/**
34699 * Sends a `message` event.
34700 *
34701 * @return {Socket} self
34702 * @api public
34703 */
34704
34705Socket.prototype.send = function(){
34706 var args = toArray(arguments);
34707 args.unshift('message');
34708 this.emit.apply(this, args);
34709 return this;
34710};
34711
34712/**
34713 * Override `emit`.
34714 * If the event is in `events`, it's emitted normally.
34715 *
34716 * @param {String} event name
34717 * @return {Socket} self
34718 * @api public
34719 */
34720
34721Socket.prototype.emit = function(ev){
34722 if (events.hasOwnProperty(ev)) {
34723 emit.apply(this, arguments);
34724 return this;
34725 }
34726
34727 var args = toArray(arguments);
34728 var parserType = parser.EVENT; // default
34729 if (hasBin(args)) { parserType = parser.BINARY_EVENT; } // binary
34730 var packet = { type: parserType, data: args };
34731
34732 packet.options = {};
34733 packet.options.compress = !this.flags || false !== this.flags.compress;
34734
34735 // event ack callback
34736 if ('function' == typeof args[args.length - 1]) {
34737 debug('emitting packet with ack id %d', this.ids);
34738 this.acks[this.ids] = args.pop();
34739 packet.id = this.ids++;
34740 }
34741
34742 if (this.connected) {
34743 this.packet(packet);
34744 } else {
34745 this.sendBuffer.push(packet);
34746 }
34747
34748 delete this.flags;
34749
34750 return this;
34751};
34752
34753/**
34754 * Sends a packet.
34755 *
34756 * @param {Object} packet
34757 * @api private
34758 */
34759
34760Socket.prototype.packet = function(packet){
34761 packet.nsp = this.nsp;
34762 this.io.packet(packet);
34763};
34764
34765/**
34766 * Called upon engine `open`.
34767 *
34768 * @api private
34769 */
34770
34771Socket.prototype.onopen = function(){
34772 debug('transport is open - connecting');
34773
34774 // write connect packet if necessary
34775 if ('/' != this.nsp) {
34776 this.packet({ type: parser.CONNECT });
34777 }
34778};
34779
34780/**
34781 * Called upon engine `close`.
34782 *
34783 * @param {String} reason
34784 * @api private
34785 */
34786
34787Socket.prototype.onclose = function(reason){
34788 debug('close (%s)', reason);
34789 this.connected = false;
34790 this.disconnected = true;
34791 delete this.id;
34792 this.emit('disconnect', reason);
34793};
34794
34795/**
34796 * Called with socket packet.
34797 *
34798 * @param {Object} packet
34799 * @api private
34800 */
34801
34802Socket.prototype.onpacket = function(packet){
34803 if (packet.nsp != this.nsp) return;
34804
34805 switch (packet.type) {
34806 case parser.CONNECT:
34807 this.onconnect();
34808 break;
34809
34810 case parser.EVENT:
34811 this.onevent(packet);
34812 break;
34813
34814 case parser.BINARY_EVENT:
34815 this.onevent(packet);
34816 break;
34817
34818 case parser.ACK:
34819 this.onack(packet);
34820 break;
34821
34822 case parser.BINARY_ACK:
34823 this.onack(packet);
34824 break;
34825
34826 case parser.DISCONNECT:
34827 this.ondisconnect();
34828 break;
34829
34830 case parser.ERROR:
34831 this.emit('error', packet.data);
34832 break;
34833 }
34834};
34835
34836/**
34837 * Called upon a server event.
34838 *
34839 * @param {Object} packet
34840 * @api private
34841 */
34842
34843Socket.prototype.onevent = function(packet){
34844 var args = packet.data || [];
34845 debug('emitting event %j', args);
34846
34847 if (null != packet.id) {
34848 debug('attaching ack callback to event');
34849 args.push(this.ack(packet.id));
34850 }
34851
34852 if (this.connected) {
34853 emit.apply(this, args);
34854 } else {
34855 this.receiveBuffer.push(args);
34856 }
34857};
34858
34859/**
34860 * Produces an ack callback to emit with an event.
34861 *
34862 * @api private
34863 */
34864
34865Socket.prototype.ack = function(id){
34866 var self = this;
34867 var sent = false;
34868 return function(){
34869 // prevent double callbacks
34870 if (sent) return;
34871 sent = true;
34872 var args = toArray(arguments);
34873 debug('sending ack %j', args);
34874
34875 var type = hasBin(args) ? parser.BINARY_ACK : parser.ACK;
34876 self.packet({
34877 type: type,
34878 id: id,
34879 data: args
34880 });
34881 };
34882};
34883
34884/**
34885 * Called upon a server acknowlegement.
34886 *
34887 * @param {Object} packet
34888 * @api private
34889 */
34890
34891Socket.prototype.onack = function(packet){
34892 var ack = this.acks[packet.id];
34893 if ('function' == typeof ack) {
34894 debug('calling ack %s with %j', packet.id, packet.data);
34895 ack.apply(this, packet.data);
34896 delete this.acks[packet.id];
34897 } else {
34898 debug('bad ack %s', packet.id);
34899 }
34900};
34901
34902/**
34903 * Called upon server connect.
34904 *
34905 * @api private
34906 */
34907
34908Socket.prototype.onconnect = function(){
34909 this.connected = true;
34910 this.disconnected = false;
34911 this.emit('connect');
34912 this.emitBuffered();
34913};
34914
34915/**
34916 * Emit buffered events (received and emitted).
34917 *
34918 * @api private
34919 */
34920
34921Socket.prototype.emitBuffered = function(){
34922 var i;
34923 for (i = 0; i < this.receiveBuffer.length; i++) {
34924 emit.apply(this, this.receiveBuffer[i]);
34925 }
34926 this.receiveBuffer = [];
34927
34928 for (i = 0; i < this.sendBuffer.length; i++) {
34929 this.packet(this.sendBuffer[i]);
34930 }
34931 this.sendBuffer = [];
34932};
34933
34934/**
34935 * Called upon server disconnect.
34936 *
34937 * @api private
34938 */
34939
34940Socket.prototype.ondisconnect = function(){
34941 debug('server disconnect (%s)', this.nsp);
34942 this.destroy();
34943 this.onclose('io server disconnect');
34944};
34945
34946/**
34947 * Called upon forced client/server side disconnections,
34948 * this method ensures the manager stops tracking us and
34949 * that reconnections don't get triggered for this.
34950 *
34951 * @api private.
34952 */
34953
34954Socket.prototype.destroy = function(){
34955 if (this.subs) {
34956 // clean subscriptions to avoid reconnections
34957 for (var i = 0; i < this.subs.length; i++) {
34958 this.subs[i].destroy();
34959 }
34960 this.subs = null;
34961 }
34962
34963 this.io.destroy(this);
34964};
34965
34966/**
34967 * Disconnects the socket manually.
34968 *
34969 * @return {Socket} self
34970 * @api public
34971 */
34972
34973Socket.prototype.close =
34974Socket.prototype.disconnect = function(){
34975 if (this.connected) {
34976 debug('performing disconnect (%s)', this.nsp);
34977 this.packet({ type: parser.DISCONNECT });
34978 }
34979
34980 // remove socket from pool
34981 this.destroy();
34982
34983 if (this.connected) {
34984 // fire events
34985 this.onclose('io client disconnect');
34986 }
34987 return this;
34988};
34989
34990/**
34991 * Sets the compress flag.
34992 *
34993 * @param {Boolean} if `true`, compresses the sending data
34994 * @return {Socket} self
34995 * @api public
34996 */
34997
34998Socket.prototype.compress = function(compress){
34999 this.flags = this.flags || {};
35000 this.flags.compress = compress;
35001 return this;
35002};
35003
35004},{"12":12,"323":323,"326":326,"328":328,"333":333,"56":56,"9":9}],325:[function(require,module,exports){
35005(function (global){
35006
35007/**
35008 * Module dependencies.
35009 */
35010
35011var parseuri = require(89);
35012var debug = require(12)('socket.io-client:url');
35013
35014/**
35015 * Module exports.
35016 */
35017
35018module.exports = url;
35019
35020/**
35021 * URL parser.
35022 *
35023 * @param {String} url
35024 * @param {Object} An object meant to mimic window.location.
35025 * Defaults to window.location.
35026 * @api public
35027 */
35028
35029function url(uri, loc){
35030 var obj = uri;
35031
35032 // default to window.location
35033 var loc = loc || global.location;
35034 if (null == uri) uri = loc.protocol + '//' + loc.host;
35035
35036 // relative path support
35037 if ('string' == typeof uri) {
35038 if ('/' == uri.charAt(0)) {
35039 if ('/' == uri.charAt(1)) {
35040 uri = loc.protocol + uri;
35041 } else {
35042 uri = loc.host + uri;
35043 }
35044 }
35045
35046 if (!/^(https?|wss?):\/\//.test(uri)) {
35047 debug('protocol-less url %s', uri);
35048 if ('undefined' != typeof loc) {
35049 uri = loc.protocol + '//' + uri;
35050 } else {
35051 uri = 'https://' + uri;
35052 }
35053 }
35054
35055 // parse
35056 debug('parse %s', uri);
35057 obj = parseuri(uri);
35058 }
35059
35060 // make sure we treat `localhost:80` and `localhost` equally
35061 if (!obj.port) {
35062 if (/^(http|ws)$/.test(obj.protocol)) {
35063 obj.port = '80';
35064 }
35065 else if (/^(http|ws)s$/.test(obj.protocol)) {
35066 obj.port = '443';
35067 }
35068 }
35069
35070 obj.path = obj.path || '/';
35071
35072 var ipv6 = obj.host.indexOf(':') !== -1;
35073 var host = ipv6 ? '[' + obj.host + ']' : obj.host;
35074
35075 // define unique id
35076 obj.id = obj.protocol + '://' + host + ':' + obj.port;
35077 // define href
35078 obj.href = obj.protocol + '://' + host + (loc && loc.port == obj.port ? '' : (':' + obj.port));
35079
35080 return obj;
35081}
35082
35083}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
35084},{"12":12,"89":89}],326:[function(require,module,exports){
35085
35086/**
35087 * Expose `Emitter`.
35088 */
35089
35090module.exports = Emitter;
35091
35092/**
35093 * Initialize a new `Emitter`.
35094 *
35095 * @api public
35096 */
35097
35098function Emitter(obj) {
35099 if (obj) return mixin(obj);
35100};
35101
35102/**
35103 * Mixin the emitter properties.
35104 *
35105 * @param {Object} obj
35106 * @return {Object}
35107 * @api private
35108 */
35109
35110function mixin(obj) {
35111 for (var key in Emitter.prototype) {
35112 obj[key] = Emitter.prototype[key];
35113 }
35114 return obj;
35115}
35116
35117/**
35118 * Listen on the given `event` with `fn`.
35119 *
35120 * @param {String} event
35121 * @param {Function} fn
35122 * @return {Emitter}
35123 * @api public
35124 */
35125
35126Emitter.prototype.on =
35127Emitter.prototype.addEventListener = function(event, fn){
35128 this._callbacks = this._callbacks || {};
35129 (this._callbacks['$' + event] = this._callbacks['$' + event] || [])
35130 .push(fn);
35131 return this;
35132};
35133
35134/**
35135 * Adds an `event` listener that will be invoked a single
35136 * time then automatically removed.
35137 *
35138 * @param {String} event
35139 * @param {Function} fn
35140 * @return {Emitter}
35141 * @api public
35142 */
35143
35144Emitter.prototype.once = function(event, fn){
35145 function on() {
35146 this.off(event, on);
35147 fn.apply(this, arguments);
35148 }
35149
35150 on.fn = fn;
35151 this.on(event, on);
35152 return this;
35153};
35154
35155/**
35156 * Remove the given callback for `event` or all
35157 * registered callbacks.
35158 *
35159 * @param {String} event
35160 * @param {Function} fn
35161 * @return {Emitter}
35162 * @api public
35163 */
35164
35165Emitter.prototype.off =
35166Emitter.prototype.removeListener =
35167Emitter.prototype.removeAllListeners =
35168Emitter.prototype.removeEventListener = function(event, fn){
35169 this._callbacks = this._callbacks || {};
35170
35171 // all
35172 if (0 == arguments.length) {
35173 this._callbacks = {};
35174 return this;
35175 }
35176
35177 // specific event
35178 var callbacks = this._callbacks['$' + event];
35179 if (!callbacks) return this;
35180
35181 // remove all handlers
35182 if (1 == arguments.length) {
35183 delete this._callbacks['$' + event];
35184 return this;
35185 }
35186
35187 // remove specific handler
35188 var cb;
35189 for (var i = 0; i < callbacks.length; i++) {
35190 cb = callbacks[i];
35191 if (cb === fn || cb.fn === fn) {
35192 callbacks.splice(i, 1);
35193 break;
35194 }
35195 }
35196 return this;
35197};
35198
35199/**
35200 * Emit `event` with the given args.
35201 *
35202 * @param {String} event
35203 * @param {Mixed} ...
35204 * @return {Emitter}
35205 */
35206
35207Emitter.prototype.emit = function(event){
35208 this._callbacks = this._callbacks || {};
35209 var args = [].slice.call(arguments, 1)
35210 , callbacks = this._callbacks['$' + event];
35211
35212 if (callbacks) {
35213 callbacks = callbacks.slice(0);
35214 for (var i = 0, len = callbacks.length; i < len; ++i) {
35215 callbacks[i].apply(this, args);
35216 }
35217 }
35218
35219 return this;
35220};
35221
35222/**
35223 * Return array of callbacks for `event`.
35224 *
35225 * @param {String} event
35226 * @return {Array}
35227 * @api public
35228 */
35229
35230Emitter.prototype.listeners = function(event){
35231 this._callbacks = this._callbacks || {};
35232 return this._callbacks['$' + event] || [];
35233};
35234
35235/**
35236 * Check if this emitter has `event` handlers.
35237 *
35238 * @param {String} event
35239 * @return {Boolean}
35240 * @api public
35241 */
35242
35243Emitter.prototype.hasListeners = function(event){
35244 return !! this.listeners(event).length;
35245};
35246
35247},{}],327:[function(require,module,exports){
35248(function (global){
35249/*global Blob,File*/
35250
35251/**
35252 * Module requirements
35253 */
35254
35255var isArray = require(82);
35256var isBuf = require(329);
35257
35258/**
35259 * Replaces every Buffer | ArrayBuffer in packet with a numbered placeholder.
35260 * Anything with blobs or files should be fed through removeBlobs before coming
35261 * here.
35262 *
35263 * @param {Object} packet - socket.io event packet
35264 * @return {Object} with deconstructed packet and list of buffers
35265 * @api public
35266 */
35267
35268exports.deconstructPacket = function(packet){
35269 var buffers = [];
35270 var packetData = packet.data;
35271
35272 function _deconstructPacket(data) {
35273 if (!data) return data;
35274
35275 if (isBuf(data)) {
35276 var placeholder = { _placeholder: true, num: buffers.length };
35277 buffers.push(data);
35278 return placeholder;
35279 } else if (isArray(data)) {
35280 var newData = new Array(data.length);
35281 for (var i = 0; i < data.length; i++) {
35282 newData[i] = _deconstructPacket(data[i]);
35283 }
35284 return newData;
35285 } else if ('object' == typeof data && !(data instanceof Date)) {
35286 var newData = {};
35287 for (var key in data) {
35288 newData[key] = _deconstructPacket(data[key]);
35289 }
35290 return newData;
35291 }
35292 return data;
35293 }
35294
35295 var pack = packet;
35296 pack.data = _deconstructPacket(packetData);
35297 pack.attachments = buffers.length; // number of binary 'attachments'
35298 return {packet: pack, buffers: buffers};
35299};
35300
35301/**
35302 * Reconstructs a binary packet from its placeholder packet and buffers
35303 *
35304 * @param {Object} packet - event packet with placeholders
35305 * @param {Array} buffers - binary buffers to put in placeholder positions
35306 * @return {Object} reconstructed packet
35307 * @api public
35308 */
35309
35310exports.reconstructPacket = function(packet, buffers) {
35311 var curPlaceHolder = 0;
35312
35313 function _reconstructPacket(data) {
35314 if (data && data._placeholder) {
35315 var buf = buffers[data.num]; // appropriate buffer (should be natural order anyway)
35316 return buf;
35317 } else if (isArray(data)) {
35318 for (var i = 0; i < data.length; i++) {
35319 data[i] = _reconstructPacket(data[i]);
35320 }
35321 return data;
35322 } else if (data && 'object' == typeof data) {
35323 for (var key in data) {
35324 data[key] = _reconstructPacket(data[key]);
35325 }
35326 return data;
35327 }
35328 return data;
35329 }
35330
35331 packet.data = _reconstructPacket(packet.data);
35332 packet.attachments = undefined; // no longer useful
35333 return packet;
35334};
35335
35336/**
35337 * Asynchronously removes Blobs or Files from data via
35338 * FileReader's readAsArrayBuffer method. Used before encoding
35339 * data as msgpack. Calls callback with the blobless data.
35340 *
35341 * @param {Object} data
35342 * @param {Function} callback
35343 * @api private
35344 */
35345
35346exports.removeBlobs = function(data, callback) {
35347 function _removeBlobs(obj, curKey, containingObject) {
35348 if (!obj) return obj;
35349
35350 // convert any blob
35351 if ((global.Blob && obj instanceof Blob) ||
35352 (global.File && obj instanceof File)) {
35353 pendingBlobs++;
35354
35355 // async filereader
35356 var fileReader = new FileReader();
35357 fileReader.onload = function() { // this.result == arraybuffer
35358 if (containingObject) {
35359 containingObject[curKey] = this.result;
35360 }
35361 else {
35362 bloblessData = this.result;
35363 }
35364
35365 // if nothing pending its callback time
35366 if(! --pendingBlobs) {
35367 callback(bloblessData);
35368 }
35369 };
35370
35371 fileReader.readAsArrayBuffer(obj); // blob -> arraybuffer
35372 } else if (isArray(obj)) { // handle array
35373 for (var i = 0; i < obj.length; i++) {
35374 _removeBlobs(obj[i], i, obj);
35375 }
35376 } else if (obj && 'object' == typeof obj && !isBuf(obj)) { // and object
35377 for (var key in obj) {
35378 _removeBlobs(obj[key], key, obj);
35379 }
35380 }
35381 }
35382
35383 var pendingBlobs = 0;
35384 var bloblessData = data;
35385 _removeBlobs(bloblessData);
35386 if (!pendingBlobs) {
35387 callback(bloblessData);
35388 }
35389};
35390
35391}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
35392},{"329":329,"82":82}],328:[function(require,module,exports){
35393
35394/**
35395 * Module dependencies.
35396 */
35397
35398var debug = require(12)('socket.io-parser');
35399var json = require(330);
35400var isArray = require(82);
35401var Emitter = require(10);
35402var binary = require(327);
35403var isBuf = require(329);
35404
35405/**
35406 * Protocol version.
35407 *
35408 * @api public
35409 */
35410
35411exports.protocol = 4;
35412
35413/**
35414 * Packet types.
35415 *
35416 * @api public
35417 */
35418
35419exports.types = [
35420 'CONNECT',
35421 'DISCONNECT',
35422 'EVENT',
35423 'ACK',
35424 'ERROR',
35425 'BINARY_EVENT',
35426 'BINARY_ACK'
35427];
35428
35429/**
35430 * Packet type `connect`.
35431 *
35432 * @api public
35433 */
35434
35435exports.CONNECT = 0;
35436
35437/**
35438 * Packet type `disconnect`.
35439 *
35440 * @api public
35441 */
35442
35443exports.DISCONNECT = 1;
35444
35445/**
35446 * Packet type `event`.
35447 *
35448 * @api public
35449 */
35450
35451exports.EVENT = 2;
35452
35453/**
35454 * Packet type `ack`.
35455 *
35456 * @api public
35457 */
35458
35459exports.ACK = 3;
35460
35461/**
35462 * Packet type `error`.
35463 *
35464 * @api public
35465 */
35466
35467exports.ERROR = 4;
35468
35469/**
35470 * Packet type 'binary event'
35471 *
35472 * @api public
35473 */
35474
35475exports.BINARY_EVENT = 5;
35476
35477/**
35478 * Packet type `binary ack`. For acks with binary arguments.
35479 *
35480 * @api public
35481 */
35482
35483exports.BINARY_ACK = 6;
35484
35485/**
35486 * Encoder constructor.
35487 *
35488 * @api public
35489 */
35490
35491exports.Encoder = Encoder;
35492
35493/**
35494 * Decoder constructor.
35495 *
35496 * @api public
35497 */
35498
35499exports.Decoder = Decoder;
35500
35501/**
35502 * A socket.io Encoder instance
35503 *
35504 * @api public
35505 */
35506
35507function Encoder() {}
35508
35509/**
35510 * Encode a packet as a single string if non-binary, or as a
35511 * buffer sequence, depending on packet type.
35512 *
35513 * @param {Object} obj - packet object
35514 * @param {Function} callback - function to handle encodings (likely engine.write)
35515 * @return Calls callback with Array of encodings
35516 * @api public
35517 */
35518
35519Encoder.prototype.encode = function(obj, callback){
35520 debug('encoding packet %j', obj);
35521
35522 if (exports.BINARY_EVENT == obj.type || exports.BINARY_ACK == obj.type) {
35523 encodeAsBinary(obj, callback);
35524 }
35525 else {
35526 var encoding = encodeAsString(obj);
35527 callback([encoding]);
35528 }
35529};
35530
35531/**
35532 * Encode packet as string.
35533 *
35534 * @param {Object} packet
35535 * @return {String} encoded
35536 * @api private
35537 */
35538
35539function encodeAsString(obj) {
35540 var str = '';
35541 var nsp = false;
35542
35543 // first is type
35544 str += obj.type;
35545
35546 // attachments if we have them
35547 if (exports.BINARY_EVENT == obj.type || exports.BINARY_ACK == obj.type) {
35548 str += obj.attachments;
35549 str += '-';
35550 }
35551
35552 // if we have a namespace other than `/`
35553 // we append it followed by a comma `,`
35554 if (obj.nsp && '/' != obj.nsp) {
35555 nsp = true;
35556 str += obj.nsp;
35557 }
35558
35559 // immediately followed by the id
35560 if (null != obj.id) {
35561 if (nsp) {
35562 str += ',';
35563 nsp = false;
35564 }
35565 str += obj.id;
35566 }
35567
35568 // json data
35569 if (null != obj.data) {
35570 if (nsp) str += ',';
35571 str += json.stringify(obj.data);
35572 }
35573
35574 debug('encoded %j as %s', obj, str);
35575 return str;
35576}
35577
35578/**
35579 * Encode packet as 'buffer sequence' by removing blobs, and
35580 * deconstructing packet into object with placeholders and
35581 * a list of buffers.
35582 *
35583 * @param {Object} packet
35584 * @return {Buffer} encoded
35585 * @api private
35586 */
35587
35588function encodeAsBinary(obj, callback) {
35589
35590 function writeEncoding(bloblessData) {
35591 var deconstruction = binary.deconstructPacket(bloblessData);
35592 var pack = encodeAsString(deconstruction.packet);
35593 var buffers = deconstruction.buffers;
35594
35595 buffers.unshift(pack); // add packet info to beginning of data list
35596 callback(buffers); // write all the buffers
35597 }
35598
35599 binary.removeBlobs(obj, writeEncoding);
35600}
35601
35602/**
35603 * A socket.io Decoder instance
35604 *
35605 * @return {Object} decoder
35606 * @api public
35607 */
35608
35609function Decoder() {
35610 this.reconstructor = null;
35611}
35612
35613/**
35614 * Mix in `Emitter` with Decoder.
35615 */
35616
35617Emitter(Decoder.prototype);
35618
35619/**
35620 * Decodes an ecoded packet string into packet JSON.
35621 *
35622 * @param {String} obj - encoded packet
35623 * @return {Object} packet
35624 * @api public
35625 */
35626
35627Decoder.prototype.add = function(obj) {
35628 var packet;
35629 if ('string' == typeof obj) {
35630 packet = decodeString(obj);
35631 if (exports.BINARY_EVENT == packet.type || exports.BINARY_ACK == packet.type) { // binary packet's json
35632 this.reconstructor = new BinaryReconstructor(packet);
35633
35634 // no attachments, labeled binary but no binary data to follow
35635 if (this.reconstructor.reconPack.attachments === 0) {
35636 this.emit('decoded', packet);
35637 }
35638 } else { // non-binary full packet
35639 this.emit('decoded', packet);
35640 }
35641 }
35642 else if (isBuf(obj) || obj.base64) { // raw binary data
35643 if (!this.reconstructor) {
35644 throw new Error('got binary data when not reconstructing a packet');
35645 } else {
35646 packet = this.reconstructor.takeBinaryData(obj);
35647 if (packet) { // received final buffer
35648 this.reconstructor = null;
35649 this.emit('decoded', packet);
35650 }
35651 }
35652 }
35653 else {
35654 throw new Error('Unknown type: ' + obj);
35655 }
35656};
35657
35658/**
35659 * Decode a packet String (JSON data)
35660 *
35661 * @param {String} str
35662 * @return {Object} packet
35663 * @api private
35664 */
35665
35666function decodeString(str) {
35667 var p = {};
35668 var i = 0;
35669
35670 // look up type
35671 p.type = Number(str.charAt(0));
35672 if (null == exports.types[p.type]) return error();
35673
35674 // look up attachments if type binary
35675 if (exports.BINARY_EVENT == p.type || exports.BINARY_ACK == p.type) {
35676 var buf = '';
35677 while (str.charAt(++i) != '-') {
35678 buf += str.charAt(i);
35679 if (i == str.length) break;
35680 }
35681 if (buf != Number(buf) || str.charAt(i) != '-') {
35682 throw new Error('Illegal attachments');
35683 }
35684 p.attachments = Number(buf);
35685 }
35686
35687 // look up namespace (if any)
35688 if ('/' == str.charAt(i + 1)) {
35689 p.nsp = '';
35690 while (++i) {
35691 var c = str.charAt(i);
35692 if (',' == c) break;
35693 p.nsp += c;
35694 if (i == str.length) break;
35695 }
35696 } else {
35697 p.nsp = '/';
35698 }
35699
35700 // look up id
35701 var next = str.charAt(i + 1);
35702 if ('' !== next && Number(next) == next) {
35703 p.id = '';
35704 while (++i) {
35705 var c = str.charAt(i);
35706 if (null == c || Number(c) != c) {
35707 --i;
35708 break;
35709 }
35710 p.id += str.charAt(i);
35711 if (i == str.length) break;
35712 }
35713 p.id = Number(p.id);
35714 }
35715
35716 // look up json data
35717 if (str.charAt(++i)) {
35718 try {
35719 p.data = json.parse(str.substr(i));
35720 } catch(e){
35721 return error();
35722 }
35723 }
35724
35725 debug('decoded %s as %j', str, p);
35726 return p;
35727}
35728
35729/**
35730 * Deallocates a parser's resources
35731 *
35732 * @api public
35733 */
35734
35735Decoder.prototype.destroy = function() {
35736 if (this.reconstructor) {
35737 this.reconstructor.finishedReconstruction();
35738 }
35739};
35740
35741/**
35742 * A manager of a binary event's 'buffer sequence'. Should
35743 * be constructed whenever a packet of type BINARY_EVENT is
35744 * decoded.
35745 *
35746 * @param {Object} packet
35747 * @return {BinaryReconstructor} initialized reconstructor
35748 * @api private
35749 */
35750
35751function BinaryReconstructor(packet) {
35752 this.reconPack = packet;
35753 this.buffers = [];
35754}
35755
35756/**
35757 * Method to be called when binary data received from connection
35758 * after a BINARY_EVENT packet.
35759 *
35760 * @param {Buffer | ArrayBuffer} binData - the raw binary data received
35761 * @return {null | Object} returns null if more binary data is expected or
35762 * a reconstructed packet object if all buffers have been received.
35763 * @api private
35764 */
35765
35766BinaryReconstructor.prototype.takeBinaryData = function(binData) {
35767 this.buffers.push(binData);
35768 if (this.buffers.length == this.reconPack.attachments) { // done with buffer list
35769 var packet = binary.reconstructPacket(this.reconPack, this.buffers);
35770 this.finishedReconstruction();
35771 return packet;
35772 }
35773 return null;
35774};
35775
35776/**
35777 * Cleans up binary packet reconstruction variables.
35778 *
35779 * @api private
35780 */
35781
35782BinaryReconstructor.prototype.finishedReconstruction = function() {
35783 this.reconPack = null;
35784 this.buffers = [];
35785};
35786
35787function error(data){
35788 return {
35789 type: exports.ERROR,
35790 data: 'parser error'
35791 };
35792}
35793
35794},{"10":10,"12":12,"327":327,"329":329,"330":330,"82":82}],329:[function(require,module,exports){
35795(function (global){
35796
35797module.exports = isBuf;
35798
35799/**
35800 * Returns true if obj is a buffer or an arraybuffer.
35801 *
35802 * @api private
35803 */
35804
35805function isBuf(obj) {
35806 return (global.Buffer && global.Buffer.isBuffer(obj)) ||
35807 (global.ArrayBuffer && obj instanceof ArrayBuffer);
35808}
35809
35810}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
35811},{}],330:[function(require,module,exports){
35812(function (global){
35813/*! JSON v3.3.2 | http://bestiejs.github.io/json3 | Copyright 2012-2014, Kit Cambridge | http://kit.mit-license.org */
35814;(function () {
35815 // Detect the `define` function exposed by asynchronous module loaders. The
35816 // strict `define` check is necessary for compatibility with `r.js`.
35817 var isLoader = typeof define === "function" && define.amd;
35818
35819 // A set of types used to distinguish objects from primitives.
35820 var objectTypes = {
35821 "function": true,
35822 "object": true
35823 };
35824
35825 // Detect the `exports` object exposed by CommonJS implementations.
35826 var freeExports = objectTypes[typeof exports] && exports && !exports.nodeType && exports;
35827
35828 // Use the `global` object exposed by Node (including Browserify via
35829 // `insert-module-globals`), Narwhal, and Ringo as the default context,
35830 // and the `window` object in browsers. Rhino exports a `global` function
35831 // instead.
35832 var root = objectTypes[typeof window] && window || this,
35833 freeGlobal = freeExports && objectTypes[typeof module] && module && !module.nodeType && typeof global == "object" && global;
35834
35835 if (freeGlobal && (freeGlobal["global"] === freeGlobal || freeGlobal["window"] === freeGlobal || freeGlobal["self"] === freeGlobal)) {
35836 root = freeGlobal;
35837 }
35838
35839 // Public: Initializes JSON 3 using the given `context` object, attaching the
35840 // `stringify` and `parse` functions to the specified `exports` object.
35841 function runInContext(context, exports) {
35842 context || (context = root["Object"]());
35843 exports || (exports = root["Object"]());
35844
35845 // Native constructor aliases.
35846 var Number = context["Number"] || root["Number"],
35847 String = context["String"] || root["String"],
35848 Object = context["Object"] || root["Object"],
35849 Date = context["Date"] || root["Date"],
35850 SyntaxError = context["SyntaxError"] || root["SyntaxError"],
35851 TypeError = context["TypeError"] || root["TypeError"],
35852 Math = context["Math"] || root["Math"],
35853 nativeJSON = context["JSON"] || root["JSON"];
35854
35855 // Delegate to the native `stringify` and `parse` implementations.
35856 if (typeof nativeJSON == "object" && nativeJSON) {
35857 exports.stringify = nativeJSON.stringify;
35858 exports.parse = nativeJSON.parse;
35859 }
35860
35861 // Convenience aliases.
35862 var objectProto = Object.prototype,
35863 getClass = objectProto.toString,
35864 isProperty, forEach, undef;
35865
35866 // Test the `Date#getUTC*` methods. Based on work by @Yaffle.
35867 var isExtended = new Date(-3509827334573292);
35868 try {
35869 // The `getUTCFullYear`, `Month`, and `Date` methods return nonsensical
35870 // results for certain dates in Opera >= 10.53.
35871 isExtended = isExtended.getUTCFullYear() == -109252 && isExtended.getUTCMonth() === 0 && isExtended.getUTCDate() === 1 &&
35872 // Safari < 2.0.2 stores the internal millisecond time value correctly,
35873 // but clips the values returned by the date methods to the range of
35874 // signed 32-bit integers ([-2 ** 31, 2 ** 31 - 1]).
35875 isExtended.getUTCHours() == 10 && isExtended.getUTCMinutes() == 37 && isExtended.getUTCSeconds() == 6 && isExtended.getUTCMilliseconds() == 708;
35876 } catch (exception) {}
35877
35878 // Internal: Determines whether the native `JSON.stringify` and `parse`
35879 // implementations are spec-compliant. Based on work by Ken Snyder.
35880 function has(name) {
35881 if (has[name] !== undef) {
35882 // Return cached feature test result.
35883 return has[name];
35884 }
35885 var isSupported;
35886 if (name == "bug-string-char-index") {
35887 // IE <= 7 doesn't support accessing string characters using square
35888 // bracket notation. IE 8 only supports this for primitives.
35889 isSupported = "a"[0] != "a";
35890 } else if (name == "json") {
35891 // Indicates whether both `JSON.stringify` and `JSON.parse` are
35892 // supported.
35893 isSupported = has("json-stringify") && has("json-parse");
35894 } else {
35895 var value, serialized = '{"a":[1,true,false,null,"\\u0000\\b\\n\\f\\r\\t"]}';
35896 // Test `JSON.stringify`.
35897 if (name == "json-stringify") {
35898 var stringify = exports.stringify, stringifySupported = typeof stringify == "function" && isExtended;
35899 if (stringifySupported) {
35900 // A test function object with a custom `toJSON` method.
35901 (value = function () {
35902 return 1;
35903 }).toJSON = value;
35904 try {
35905 stringifySupported =
35906 // Firefox 3.1b1 and b2 serialize string, number, and boolean
35907 // primitives as object literals.
35908 stringify(0) === "0" &&
35909 // FF 3.1b1, b2, and JSON 2 serialize wrapped primitives as object
35910 // literals.
35911 stringify(new Number()) === "0" &&
35912 stringify(new String()) == '""' &&
35913 // FF 3.1b1, 2 throw an error if the value is `null`, `undefined`, or
35914 // does not define a canonical JSON representation (this applies to
35915 // objects with `toJSON` properties as well, *unless* they are nested
35916 // within an object or array).
35917 stringify(getClass) === undef &&
35918 // IE 8 serializes `undefined` as `"undefined"`. Safari <= 5.1.7 and
35919 // FF 3.1b3 pass this test.
35920 stringify(undef) === undef &&
35921 // Safari <= 5.1.7 and FF 3.1b3 throw `Error`s and `TypeError`s,
35922 // respectively, if the value is omitted entirely.
35923 stringify() === undef &&
35924 // FF 3.1b1, 2 throw an error if the given value is not a number,
35925 // string, array, object, Boolean, or `null` literal. This applies to
35926 // objects with custom `toJSON` methods as well, unless they are nested
35927 // inside object or array literals. YUI 3.0.0b1 ignores custom `toJSON`
35928 // methods entirely.
35929 stringify(value) === "1" &&
35930 stringify([value]) == "[1]" &&
35931 // Prototype <= 1.6.1 serializes `[undefined]` as `"[]"` instead of
35932 // `"[null]"`.
35933 stringify([undef]) == "[null]" &&
35934 // YUI 3.0.0b1 fails to serialize `null` literals.
35935 stringify(null) == "null" &&
35936 // FF 3.1b1, 2 halts serialization if an array contains a function:
35937 // `[1, true, getClass, 1]` serializes as "[1,true,],". FF 3.1b3
35938 // elides non-JSON values from objects and arrays, unless they
35939 // define custom `toJSON` methods.
35940 stringify([undef, getClass, null]) == "[null,null,null]" &&
35941 // Simple serialization test. FF 3.1b1 uses Unicode escape sequences
35942 // where character escape codes are expected (e.g., `\b` => `\u0008`).
35943 stringify({ "a": [value, true, false, null, "\x00\b\n\f\r\t"] }) == serialized &&
35944 // FF 3.1b1 and b2 ignore the `filter` and `width` arguments.
35945 stringify(null, value) === "1" &&
35946 stringify([1, 2], null, 1) == "[\n 1,\n 2\n]" &&
35947 // JSON 2, Prototype <= 1.7, and older WebKit builds incorrectly
35948 // serialize extended years.
35949 stringify(new Date(-8.64e15)) == '"-271821-04-20T00:00:00.000Z"' &&
35950 // The milliseconds are optional in ES 5, but required in 5.1.
35951 stringify(new Date(8.64e15)) == '"+275760-09-13T00:00:00.000Z"' &&
35952 // Firefox <= 11.0 incorrectly serializes years prior to 0 as negative
35953 // four-digit years instead of six-digit years. Credits: @Yaffle.
35954 stringify(new Date(-621987552e5)) == '"-000001-01-01T00:00:00.000Z"' &&
35955 // Safari <= 5.1.5 and Opera >= 10.53 incorrectly serialize millisecond
35956 // values less than 1000. Credits: @Yaffle.
35957 stringify(new Date(-1)) == '"1969-12-31T23:59:59.999Z"';
35958 } catch (exception) {
35959 stringifySupported = false;
35960 }
35961 }
35962 isSupported = stringifySupported;
35963 }
35964 // Test `JSON.parse`.
35965 if (name == "json-parse") {
35966 var parse = exports.parse;
35967 if (typeof parse == "function") {
35968 try {
35969 // FF 3.1b1, b2 will throw an exception if a bare literal is provided.
35970 // Conforming implementations should also coerce the initial argument to
35971 // a string prior to parsing.
35972 if (parse("0") === 0 && !parse(false)) {
35973 // Simple parsing test.
35974 value = parse(serialized);
35975 var parseSupported = value["a"].length == 5 && value["a"][0] === 1;
35976 if (parseSupported) {
35977 try {
35978 // Safari <= 5.1.2 and FF 3.1b1 allow unescaped tabs in strings.
35979 parseSupported = !parse('"\t"');
35980 } catch (exception) {}
35981 if (parseSupported) {
35982 try {
35983 // FF 4.0 and 4.0.1 allow leading `+` signs and leading
35984 // decimal points. FF 4.0, 4.0.1, and IE 9-10 also allow
35985 // certain octal literals.
35986 parseSupported = parse("01") !== 1;
35987 } catch (exception) {}
35988 }
35989 if (parseSupported) {
35990 try {
35991 // FF 4.0, 4.0.1, and Rhino 1.7R3-R4 allow trailing decimal
35992 // points. These environments, along with FF 3.1b1 and 2,
35993 // also allow trailing commas in JSON objects and arrays.
35994 parseSupported = parse("1.") !== 1;
35995 } catch (exception) {}
35996 }
35997 }
35998 }
35999 } catch (exception) {
36000 parseSupported = false;
36001 }
36002 }
36003 isSupported = parseSupported;
36004 }
36005 }
36006 return has[name] = !!isSupported;
36007 }
36008
36009 if (!has("json")) {
36010 // Common `[[Class]]` name aliases.
36011 var functionClass = "[object Function]",
36012 dateClass = "[object Date]",
36013 numberClass = "[object Number]",
36014 stringClass = "[object String]",
36015 arrayClass = "[object Array]",
36016 booleanClass = "[object Boolean]";
36017
36018 // Detect incomplete support for accessing string characters by index.
36019 var charIndexBuggy = has("bug-string-char-index");
36020
36021 // Define additional utility methods if the `Date` methods are buggy.
36022 if (!isExtended) {
36023 var floor = Math.floor;
36024 // A mapping between the months of the year and the number of days between
36025 // January 1st and the first of the respective month.
36026 var Months = [0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334];
36027 // Internal: Calculates the number of days between the Unix epoch and the
36028 // first day of the given month.
36029 var getDay = function (year, month) {
36030 return Months[month] + 365 * (year - 1970) + floor((year - 1969 + (month = +(month > 1))) / 4) - floor((year - 1901 + month) / 100) + floor((year - 1601 + month) / 400);
36031 };
36032 }
36033
36034 // Internal: Determines if a property is a direct property of the given
36035 // object. Delegates to the native `Object#hasOwnProperty` method.
36036 if (!(isProperty = objectProto.hasOwnProperty)) {
36037 isProperty = function (property) {
36038 var members = {}, constructor;
36039 if ((members.__proto__ = null, members.__proto__ = {
36040 // The *proto* property cannot be set multiple times in recent
36041 // versions of Firefox and SeaMonkey.
36042 "toString": 1
36043 }, members).toString != getClass) {
36044 // Safari <= 2.0.3 doesn't implement `Object#hasOwnProperty`, but
36045 // supports the mutable *proto* property.
36046 isProperty = function (property) {
36047 // Capture and break the object's prototype chain (see section 8.6.2
36048 // of the ES 5.1 spec). The parenthesized expression prevents an
36049 // unsafe transformation by the Closure Compiler.
36050 var original = this.__proto__, result = property in (this.__proto__ = null, this);
36051 // Restore the original prototype chain.
36052 this.__proto__ = original;
36053 return result;
36054 };
36055 } else {
36056 // Capture a reference to the top-level `Object` constructor.
36057 constructor = members.constructor;
36058 // Use the `constructor` property to simulate `Object#hasOwnProperty` in
36059 // other environments.
36060 isProperty = function (property) {
36061 var parent = (this.constructor || constructor).prototype;
36062 return property in this && !(property in parent && this[property] === parent[property]);
36063 };
36064 }
36065 members = null;
36066 return isProperty.call(this, property);
36067 };
36068 }
36069
36070 // Internal: Normalizes the `for...in` iteration algorithm across
36071 // environments. Each enumerated key is yielded to a `callback` function.
36072 forEach = function (object, callback) {
36073 var size = 0, Properties, members, property;
36074
36075 // Tests for bugs in the current environment's `for...in` algorithm. The
36076 // `valueOf` property inherits the non-enumerable flag from
36077 // `Object.prototype` in older versions of IE, Netscape, and Mozilla.
36078 (Properties = function () {
36079 this.valueOf = 0;
36080 }).prototype.valueOf = 0;
36081
36082 // Iterate over a new instance of the `Properties` class.
36083 members = new Properties();
36084 for (property in members) {
36085 // Ignore all properties inherited from `Object.prototype`.
36086 if (isProperty.call(members, property)) {
36087 size++;
36088 }
36089 }
36090 Properties = members = null;
36091
36092 // Normalize the iteration algorithm.
36093 if (!size) {
36094 // A list of non-enumerable properties inherited from `Object.prototype`.
36095 members = ["valueOf", "toString", "toLocaleString", "propertyIsEnumerable", "isPrototypeOf", "hasOwnProperty", "constructor"];
36096 // IE <= 8, Mozilla 1.0, and Netscape 6.2 ignore shadowed non-enumerable
36097 // properties.
36098 forEach = function (object, callback) {
36099 var isFunction = getClass.call(object) == functionClass, property, length;
36100 var hasProperty = !isFunction && typeof object.constructor != "function" && objectTypes[typeof object.hasOwnProperty] && object.hasOwnProperty || isProperty;
36101 for (property in object) {
36102 // Gecko <= 1.0 enumerates the `prototype` property of functions under
36103 // certain conditions; IE does not.
36104 if (!(isFunction && property == "prototype") && hasProperty.call(object, property)) {
36105 callback(property);
36106 }
36107 }
36108 // Manually invoke the callback for each non-enumerable property.
36109 for (length = members.length; property = members[--length]; hasProperty.call(object, property) && callback(property));
36110 };
36111 } else if (size == 2) {
36112 // Safari <= 2.0.4 enumerates shadowed properties twice.
36113 forEach = function (object, callback) {
36114 // Create a set of iterated properties.
36115 var members = {}, isFunction = getClass.call(object) == functionClass, property;
36116 for (property in object) {
36117 // Store each property name to prevent double enumeration. The
36118 // `prototype` property of functions is not enumerated due to cross-
36119 // environment inconsistencies.
36120 if (!(isFunction && property == "prototype") && !isProperty.call(members, property) && (members[property] = 1) && isProperty.call(object, property)) {
36121 callback(property);
36122 }
36123 }
36124 };
36125 } else {
36126 // No bugs detected; use the standard `for...in` algorithm.
36127 forEach = function (object, callback) {
36128 var isFunction = getClass.call(object) == functionClass, property, isConstructor;
36129 for (property in object) {
36130 if (!(isFunction && property == "prototype") && isProperty.call(object, property) && !(isConstructor = property === "constructor")) {
36131 callback(property);
36132 }
36133 }
36134 // Manually invoke the callback for the `constructor` property due to
36135 // cross-environment inconsistencies.
36136 if (isConstructor || isProperty.call(object, (property = "constructor"))) {
36137 callback(property);
36138 }
36139 };
36140 }
36141 return forEach(object, callback);
36142 };
36143
36144 // Public: Serializes a JavaScript `value` as a JSON string. The optional
36145 // `filter` argument may specify either a function that alters how object and
36146 // array members are serialized, or an array of strings and numbers that
36147 // indicates which properties should be serialized. The optional `width`
36148 // argument may be either a string or number that specifies the indentation
36149 // level of the output.
36150 if (!has("json-stringify")) {
36151 // Internal: A map of control characters and their escaped equivalents.
36152 var Escapes = {
36153 92: "\\\\",
36154 34: '\\"',
36155 8: "\\b",
36156 12: "\\f",
36157 10: "\\n",
36158 13: "\\r",
36159 9: "\\t"
36160 };
36161
36162 // Internal: Converts `value` into a zero-padded string such that its
36163 // length is at least equal to `width`. The `width` must be <= 6.
36164 var leadingZeroes = "000000";
36165 var toPaddedString = function (width, value) {
36166 // The `|| 0` expression is necessary to work around a bug in
36167 // Opera <= 7.54u2 where `0 == -0`, but `String(-0) !== "0"`.
36168 return (leadingZeroes + (value || 0)).slice(-width);
36169 };
36170
36171 // Internal: Double-quotes a string `value`, replacing all ASCII control
36172 // characters (characters with code unit values between 0 and 31) with
36173 // their escaped equivalents. This is an implementation of the
36174 // `Quote(value)` operation defined in ES 5.1 section 15.12.3.
36175 var unicodePrefix = "\\u00";
36176 var quote = function (value) {
36177 var result = '"', index = 0, length = value.length, useCharIndex = !charIndexBuggy || length > 10;
36178 var symbols = useCharIndex && (charIndexBuggy ? value.split("") : value);
36179 for (; index < length; index++) {
36180 var charCode = value.charCodeAt(index);
36181 // If the character is a control character, append its Unicode or
36182 // shorthand escape sequence; otherwise, append the character as-is.
36183 switch (charCode) {
36184 case 8: case 9: case 10: case 12: case 13: case 34: case 92:
36185 result += Escapes[charCode];
36186 break;
36187 default:
36188 if (charCode < 32) {
36189 result += unicodePrefix + toPaddedString(2, charCode.toString(16));
36190 break;
36191 }
36192 result += useCharIndex ? symbols[index] : value.charAt(index);
36193 }
36194 }
36195 return result + '"';
36196 };
36197
36198 // Internal: Recursively serializes an object. Implements the
36199 // `Str(key, holder)`, `JO(value)`, and `JA(value)` operations.
36200 var serialize = function (property, object, callback, properties, whitespace, indentation, stack) {
36201 var value, className, year, month, date, time, hours, minutes, seconds, milliseconds, results, element, index, length, prefix, result;
36202 try {
36203 // Necessary for host object support.
36204 value = object[property];
36205 } catch (exception) {}
36206 if (typeof value == "object" && value) {
36207 className = getClass.call(value);
36208 if (className == dateClass && !isProperty.call(value, "toJSON")) {
36209 if (value > -1 / 0 && value < 1 / 0) {
36210 // Dates are serialized according to the `Date#toJSON` method
36211 // specified in ES 5.1 section 15.9.5.44. See section 15.9.1.15
36212 // for the ISO 8601 date time string format.
36213 if (getDay) {
36214 // Manually compute the year, month, date, hours, minutes,
36215 // seconds, and milliseconds if the `getUTC*` methods are
36216 // buggy. Adapted from @Yaffle's `date-shim` project.
36217 date = floor(value / 864e5);
36218 for (year = floor(date / 365.2425) + 1970 - 1; getDay(year + 1, 0) <= date; year++);
36219 for (month = floor((date - getDay(year, 0)) / 30.42); getDay(year, month + 1) <= date; month++);
36220 date = 1 + date - getDay(year, month);
36221 // The `time` value specifies the time within the day (see ES
36222 // 5.1 section 15.9.1.2). The formula `(A % B + B) % B` is used
36223 // to compute `A modulo B`, as the `%` operator does not
36224 // correspond to the `modulo` operation for negative numbers.
36225 time = (value % 864e5 + 864e5) % 864e5;
36226 // The hours, minutes, seconds, and milliseconds are obtained by
36227 // decomposing the time within the day. See section 15.9.1.10.
36228 hours = floor(time / 36e5) % 24;
36229 minutes = floor(time / 6e4) % 60;
36230 seconds = floor(time / 1e3) % 60;
36231 milliseconds = time % 1e3;
36232 } else {
36233 year = value.getUTCFullYear();
36234 month = value.getUTCMonth();
36235 date = value.getUTCDate();
36236 hours = value.getUTCHours();
36237 minutes = value.getUTCMinutes();
36238 seconds = value.getUTCSeconds();
36239 milliseconds = value.getUTCMilliseconds();
36240 }
36241 // Serialize extended years correctly.
36242 value = (year <= 0 || year >= 1e4 ? (year < 0 ? "-" : "+") + toPaddedString(6, year < 0 ? -year : year) : toPaddedString(4, year)) +
36243 "-" + toPaddedString(2, month + 1) + "-" + toPaddedString(2, date) +
36244 // Months, dates, hours, minutes, and seconds should have two
36245 // digits; milliseconds should have three.
36246 "T" + toPaddedString(2, hours) + ":" + toPaddedString(2, minutes) + ":" + toPaddedString(2, seconds) +
36247 // Milliseconds are optional in ES 5.0, but required in 5.1.
36248 "." + toPaddedString(3, milliseconds) + "Z";
36249 } else {
36250 value = null;
36251 }
36252 } else if (typeof value.toJSON == "function" && ((className != numberClass && className != stringClass && className != arrayClass) || isProperty.call(value, "toJSON"))) {
36253 // Prototype <= 1.6.1 adds non-standard `toJSON` methods to the
36254 // `Number`, `String`, `Date`, and `Array` prototypes. JSON 3
36255 // ignores all `toJSON` methods on these objects unless they are
36256 // defined directly on an instance.
36257 value = value.toJSON(property);
36258 }
36259 }
36260 if (callback) {
36261 // If a replacement function was provided, call it to obtain the value
36262 // for serialization.
36263 value = callback.call(object, property, value);
36264 }
36265 if (value === null) {
36266 return "null";
36267 }
36268 className = getClass.call(value);
36269 if (className == booleanClass) {
36270 // Booleans are represented literally.
36271 return "" + value;
36272 } else if (className == numberClass) {
36273 // JSON numbers must be finite. `Infinity` and `NaN` are serialized as
36274 // `"null"`.
36275 return value > -1 / 0 && value < 1 / 0 ? "" + value : "null";
36276 } else if (className == stringClass) {
36277 // Strings are double-quoted and escaped.
36278 return quote("" + value);
36279 }
36280 // Recursively serialize objects and arrays.
36281 if (typeof value == "object") {
36282 // Check for cyclic structures. This is a linear search; performance
36283 // is inversely proportional to the number of unique nested objects.
36284 for (length = stack.length; length--;) {
36285 if (stack[length] === value) {
36286 // Cyclic structures cannot be serialized by `JSON.stringify`.
36287 throw TypeError();
36288 }
36289 }
36290 // Add the object to the stack of traversed objects.
36291 stack.push(value);
36292 results = [];
36293 // Save the current indentation level and indent one additional level.
36294 prefix = indentation;
36295 indentation += whitespace;
36296 if (className == arrayClass) {
36297 // Recursively serialize array elements.
36298 for (index = 0, length = value.length; index < length; index++) {
36299 element = serialize(index, value, callback, properties, whitespace, indentation, stack);
36300 results.push(element === undef ? "null" : element);
36301 }
36302 result = results.length ? (whitespace ? "[\n" + indentation + results.join(",\n" + indentation) + "\n" + prefix + "]" : ("[" + results.join(",") + "]")) : "[]";
36303 } else {
36304 // Recursively serialize object members. Members are selected from
36305 // either a user-specified list of property names, or the object
36306 // itself.
36307 forEach(properties || value, function (property) {
36308 var element = serialize(property, value, callback, properties, whitespace, indentation, stack);
36309 if (element !== undef) {
36310 // According to ES 5.1 section 15.12.3: "If `gap` {whitespace}
36311 // is not the empty string, let `member` {quote(property) + ":"}
36312 // be the concatenation of `member` and the `space` character."
36313 // The "`space` character" refers to the literal space
36314 // character, not the `space` {width} argument provided to
36315 // `JSON.stringify`.
36316 results.push(quote(property) + ":" + (whitespace ? " " : "") + element);
36317 }
36318 });
36319 result = results.length ? (whitespace ? "{\n" + indentation + results.join(",\n" + indentation) + "\n" + prefix + "}" : ("{" + results.join(",") + "}")) : "{}";
36320 }
36321 // Remove the object from the traversed object stack.
36322 stack.pop();
36323 return result;
36324 }
36325 };
36326
36327 // Public: `JSON.stringify`. See ES 5.1 section 15.12.3.
36328 exports.stringify = function (source, filter, width) {
36329 var whitespace, callback, properties, className;
36330 if (objectTypes[typeof filter] && filter) {
36331 if ((className = getClass.call(filter)) == functionClass) {
36332 callback = filter;
36333 } else if (className == arrayClass) {
36334 // Convert the property names array into a makeshift set.
36335 properties = {};
36336 for (var index = 0, length = filter.length, value; index < length; value = filter[index++], ((className = getClass.call(value)), className == stringClass || className == numberClass) && (properties[value] = 1));
36337 }
36338 }
36339 if (width) {
36340 if ((className = getClass.call(width)) == numberClass) {
36341 // Convert the `width` to an integer and create a string containing
36342 // `width` number of space characters.
36343 if ((width -= width % 1) > 0) {
36344 for (whitespace = "", width > 10 && (width = 10); whitespace.length < width; whitespace += " ");
36345 }
36346 } else if (className == stringClass) {
36347 whitespace = width.length <= 10 ? width : width.slice(0, 10);
36348 }
36349 }
36350 // Opera <= 7.54u2 discards the values associated with empty string keys
36351 // (`""`) only if they are used directly within an object member list
36352 // (e.g., `!("" in { "": 1})`).
36353 return serialize("", (value = {}, value[""] = source, value), callback, properties, whitespace, "", []);
36354 };
36355 }
36356
36357 // Public: Parses a JSON source string.
36358 if (!has("json-parse")) {
36359 var fromCharCode = String.fromCharCode;
36360
36361 // Internal: A map of escaped control characters and their unescaped
36362 // equivalents.
36363 var Unescapes = {
36364 92: "\\",
36365 34: '"',
36366 47: "/",
36367 98: "\b",
36368 116: "\t",
36369 110: "\n",
36370 102: "\f",
36371 114: "\r"
36372 };
36373
36374 // Internal: Stores the parser state.
36375 var Index, Source;
36376
36377 // Internal: Resets the parser state and throws a `SyntaxError`.
36378 var abort = function () {
36379 Index = Source = null;
36380 throw SyntaxError();
36381 };
36382
36383 // Internal: Returns the next token, or `"$"` if the parser has reached
36384 // the end of the source string. A token may be a string, number, `null`
36385 // literal, or Boolean literal.
36386 var lex = function () {
36387 var source = Source, length = source.length, value, begin, position, isSigned, charCode;
36388 while (Index < length) {
36389 charCode = source.charCodeAt(Index);
36390 switch (charCode) {
36391 case 9: case 10: case 13: case 32:
36392 // Skip whitespace tokens, including tabs, carriage returns, line
36393 // feeds, and space characters.
36394 Index++;
36395 break;
36396 case 123: case 125: case 91: case 93: case 58: case 44:
36397 // Parse a punctuator token (`{`, `}`, `[`, `]`, `:`, or `,`) at
36398 // the current position.
36399 value = charIndexBuggy ? source.charAt(Index) : source[Index];
36400 Index++;
36401 return value;
36402 case 34:
36403 // `"` delimits a JSON string; advance to the next character and
36404 // begin parsing the string. String tokens are prefixed with the
36405 // sentinel `@` character to distinguish them from punctuators and
36406 // end-of-string tokens.
36407 for (value = "@", Index++; Index < length;) {
36408 charCode = source.charCodeAt(Index);
36409 if (charCode < 32) {
36410 // Unescaped ASCII control characters (those with a code unit
36411 // less than the space character) are not permitted.
36412 abort();
36413 } else if (charCode == 92) {
36414 // A reverse solidus (`\`) marks the beginning of an escaped
36415 // control character (including `"`, `\`, and `/`) or Unicode
36416 // escape sequence.
36417 charCode = source.charCodeAt(++Index);
36418 switch (charCode) {
36419 case 92: case 34: case 47: case 98: case 116: case 110: case 102: case 114:
36420 // Revive escaped control characters.
36421 value += Unescapes[charCode];
36422 Index++;
36423 break;
36424 case 117:
36425 // `\u` marks the beginning of a Unicode escape sequence.
36426 // Advance to the first character and validate the
36427 // four-digit code point.
36428 begin = ++Index;
36429 for (position = Index + 4; Index < position; Index++) {
36430 charCode = source.charCodeAt(Index);
36431 // A valid sequence comprises four hexdigits (case-
36432 // insensitive) that form a single hexadecimal value.
36433 if (!(charCode >= 48 && charCode <= 57 || charCode >= 97 && charCode <= 102 || charCode >= 65 && charCode <= 70)) {
36434 // Invalid Unicode escape sequence.
36435 abort();
36436 }
36437 }
36438 // Revive the escaped character.
36439 value += fromCharCode("0x" + source.slice(begin, Index));
36440 break;
36441 default:
36442 // Invalid escape sequence.
36443 abort();
36444 }
36445 } else {
36446 if (charCode == 34) {
36447 // An unescaped double-quote character marks the end of the
36448 // string.
36449 break;
36450 }
36451 charCode = source.charCodeAt(Index);
36452 begin = Index;
36453 // Optimize for the common case where a string is valid.
36454 while (charCode >= 32 && charCode != 92 && charCode != 34) {
36455 charCode = source.charCodeAt(++Index);
36456 }
36457 // Append the string as-is.
36458 value += source.slice(begin, Index);
36459 }
36460 }
36461 if (source.charCodeAt(Index) == 34) {
36462 // Advance to the next character and return the revived string.
36463 Index++;
36464 return value;
36465 }
36466 // Unterminated string.
36467 abort();
36468 default:
36469 // Parse numbers and literals.
36470 begin = Index;
36471 // Advance past the negative sign, if one is specified.
36472 if (charCode == 45) {
36473 isSigned = true;
36474 charCode = source.charCodeAt(++Index);
36475 }
36476 // Parse an integer or floating-point value.
36477 if (charCode >= 48 && charCode <= 57) {
36478 // Leading zeroes are interpreted as octal literals.
36479 if (charCode == 48 && ((charCode = source.charCodeAt(Index + 1)), charCode >= 48 && charCode <= 57)) {
36480 // Illegal octal literal.
36481 abort();
36482 }
36483 isSigned = false;
36484 // Parse the integer component.
36485 for (; Index < length && ((charCode = source.charCodeAt(Index)), charCode >= 48 && charCode <= 57); Index++);
36486 // Floats cannot contain a leading decimal point; however, this
36487 // case is already accounted for by the parser.
36488 if (source.charCodeAt(Index) == 46) {
36489 position = ++Index;
36490 // Parse the decimal component.
36491 for (; position < length && ((charCode = source.charCodeAt(position)), charCode >= 48 && charCode <= 57); position++);
36492 if (position == Index) {
36493 // Illegal trailing decimal.
36494 abort();
36495 }
36496 Index = position;
36497 }
36498 // Parse exponents. The `e` denoting the exponent is
36499 // case-insensitive.
36500 charCode = source.charCodeAt(Index);
36501 if (charCode == 101 || charCode == 69) {
36502 charCode = source.charCodeAt(++Index);
36503 // Skip past the sign following the exponent, if one is
36504 // specified.
36505 if (charCode == 43 || charCode == 45) {
36506 Index++;
36507 }
36508 // Parse the exponential component.
36509 for (position = Index; position < length && ((charCode = source.charCodeAt(position)), charCode >= 48 && charCode <= 57); position++);
36510 if (position == Index) {
36511 // Illegal empty exponent.
36512 abort();
36513 }
36514 Index = position;
36515 }
36516 // Coerce the parsed value to a JavaScript number.
36517 return +source.slice(begin, Index);
36518 }
36519 // A negative sign may only precede numbers.
36520 if (isSigned) {
36521 abort();
36522 }
36523 // `true`, `false`, and `null` literals.
36524 if (source.slice(Index, Index + 4) == "true") {
36525 Index += 4;
36526 return true;
36527 } else if (source.slice(Index, Index + 5) == "false") {
36528 Index += 5;
36529 return false;
36530 } else if (source.slice(Index, Index + 4) == "null") {
36531 Index += 4;
36532 return null;
36533 }
36534 // Unrecognized token.
36535 abort();
36536 }
36537 }
36538 // Return the sentinel `$` character if the parser has reached the end
36539 // of the source string.
36540 return "$";
36541 };
36542
36543 // Internal: Parses a JSON `value` token.
36544 var get = function (value) {
36545 var results, hasMembers;
36546 if (value == "$") {
36547 // Unexpected end of input.
36548 abort();
36549 }
36550 if (typeof value == "string") {
36551 if ((charIndexBuggy ? value.charAt(0) : value[0]) == "@") {
36552 // Remove the sentinel `@` character.
36553 return value.slice(1);
36554 }
36555 // Parse object and array literals.
36556 if (value == "[") {
36557 // Parses a JSON array, returning a new JavaScript array.
36558 results = [];
36559 for (;; hasMembers || (hasMembers = true)) {
36560 value = lex();
36561 // A closing square bracket marks the end of the array literal.
36562 if (value == "]") {
36563 break;
36564 }
36565 // If the array literal contains elements, the current token
36566 // should be a comma separating the previous element from the
36567 // next.
36568 if (hasMembers) {
36569 if (value == ",") {
36570 value = lex();
36571 if (value == "]") {
36572 // Unexpected trailing `,` in array literal.
36573 abort();
36574 }
36575 } else {
36576 // A `,` must separate each array element.
36577 abort();
36578 }
36579 }
36580 // Elisions and leading commas are not permitted.
36581 if (value == ",") {
36582 abort();
36583 }
36584 results.push(get(value));
36585 }
36586 return results;
36587 } else if (value == "{") {
36588 // Parses a JSON object, returning a new JavaScript object.
36589 results = {};
36590 for (;; hasMembers || (hasMembers = true)) {
36591 value = lex();
36592 // A closing curly brace marks the end of the object literal.
36593 if (value == "}") {
36594 break;
36595 }
36596 // If the object literal contains members, the current token
36597 // should be a comma separator.
36598 if (hasMembers) {
36599 if (value == ",") {
36600 value = lex();
36601 if (value == "}") {
36602 // Unexpected trailing `,` in object literal.
36603 abort();
36604 }
36605 } else {
36606 // A `,` must separate each object member.
36607 abort();
36608 }
36609 }
36610 // Leading commas are not permitted, object property names must be
36611 // double-quoted strings, and a `:` must separate each property
36612 // name and value.
36613 if (value == "," || typeof value != "string" || (charIndexBuggy ? value.charAt(0) : value[0]) != "@" || lex() != ":") {
36614 abort();
36615 }
36616 results[value.slice(1)] = get(lex());
36617 }
36618 return results;
36619 }
36620 // Unexpected token encountered.
36621 abort();
36622 }
36623 return value;
36624 };
36625
36626 // Internal: Updates a traversed object member.
36627 var update = function (source, property, callback) {
36628 var element = walk(source, property, callback);
36629 if (element === undef) {
36630 delete source[property];
36631 } else {
36632 source[property] = element;
36633 }
36634 };
36635
36636 // Internal: Recursively traverses a parsed JSON object, invoking the
36637 // `callback` function for each value. This is an implementation of the
36638 // `Walk(holder, name)` operation defined in ES 5.1 section 15.12.2.
36639 var walk = function (source, property, callback) {
36640 var value = source[property], length;
36641 if (typeof value == "object" && value) {
36642 // `forEach` can't be used to traverse an array in Opera <= 8.54
36643 // because its `Object#hasOwnProperty` implementation returns `false`
36644 // for array indices (e.g., `![1, 2, 3].hasOwnProperty("0")`).
36645 if (getClass.call(value) == arrayClass) {
36646 for (length = value.length; length--;) {
36647 update(value, length, callback);
36648 }
36649 } else {
36650 forEach(value, function (property) {
36651 update(value, property, callback);
36652 });
36653 }
36654 }
36655 return callback.call(source, property, value);
36656 };
36657
36658 // Public: `JSON.parse`. See ES 5.1 section 15.12.2.
36659 exports.parse = function (source, callback) {
36660 var result, value;
36661 Index = 0;
36662 Source = "" + source;
36663 result = get(lex());
36664 // If a JSON string contains multiple tokens, it is invalid.
36665 if (lex() != "$") {
36666 abort();
36667 }
36668 // Reset the parser state.
36669 Index = Source = null;
36670 return callback && getClass.call(callback) == functionClass ? walk((value = {}, value[""] = result, value), "", callback) : result;
36671 };
36672 }
36673 }
36674
36675 exports["runInContext"] = runInContext;
36676 return exports;
36677 }
36678
36679 if (freeExports && !isLoader) {
36680 // Export for CommonJS environments.
36681 runInContext(root, freeExports);
36682 } else {
36683 // Export for web browsers and JavaScript engines.
36684 var nativeJSON = root.JSON,
36685 previousJSON = root["JSON3"],
36686 isRestored = false;
36687
36688 var JSON3 = runInContext(root, (root["JSON3"] = {
36689 // Public: Restores the original value of the global `JSON` object and
36690 // returns a reference to the `JSON3` object.
36691 "noConflict": function () {
36692 if (!isRestored) {
36693 isRestored = true;
36694 root.JSON = nativeJSON;
36695 root["JSON3"] = previousJSON;
36696 nativeJSON = previousJSON = null;
36697 }
36698 return JSON3;
36699 }
36700 }));
36701
36702 root.JSON = {
36703 "parse": JSON3.parse,
36704 "stringify": JSON3.stringify
36705 };
36706 }
36707
36708 // Export for asynchronous module loaders.
36709 if (isLoader) {
36710 define(function () {
36711 return JSON3;
36712 });
36713 }
36714}).call(this);
36715
36716}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
36717},{}],331:[function(require,module,exports){
36718'use strict';
36719module.exports = function (str) {
36720 return encodeURIComponent(str).replace(/[!'()*]/g, function (c) {
36721 return '%' + c.charCodeAt(0).toString(16).toUpperCase();
36722 });
36723};
36724
36725},{}],332:[function(require,module,exports){
36726var minimist = require(85);
36727
36728module.exports = function parse (args, opts) {
36729 var level = 0, index;
36730 var args_ = [];
36731
36732 for (var i = 0; i < args.length; i++) {
36733 if (typeof args[i] === 'string' && /^\[/.test(args[i])) {
36734 if (level ++ === 0) {
36735 index = i;
36736 }
36737 }
36738 if (typeof args[i] === 'string' && /\]$/.test(args[i])) {
36739 if (-- level > 0) continue;
36740
36741 var sub = args.slice(index, i + 1);
36742 if (typeof sub[0] === 'string') {
36743 sub[0] = sub[0].replace(/^\[/, '');
36744 }
36745 if (sub[0] === '') sub.shift();
36746
36747 var n = sub.length - 1;
36748 if (typeof sub[n] === 'string') {
36749 sub[n] = sub[n].replace(/\]$/, '');
36750 }
36751 if (sub[n] === '') sub.pop();
36752
36753 args_.push(parse(sub));
36754 }
36755 else if (level === 0) args_.push(args[i]);
36756 }
36757
36758 var argv = minimist(args_, opts);
36759 return argv;
36760};
36761
36762},{"85":85}],333:[function(require,module,exports){
36763module.exports = toArray
36764
36765function toArray(list, index) {
36766 var array = []
36767
36768 index = index || 0
36769
36770 for (var i = index || 0; i < list.length; i++) {
36771 array[i - index] = list[i]
36772 }
36773
36774 return array
36775}
36776
36777},{}],334:[function(require,module,exports){
36778// Copyright Joyent, Inc. and other Node contributors.
36779//
36780// Permission is hereby granted, free of charge, to any person obtaining a
36781// copy of this software and associated documentation files (the
36782// "Software"), to deal in the Software without restriction, including
36783// without limitation the rights to use, copy, modify, merge, publish,
36784// distribute, sublicense, and/or sell copies of the Software, and to permit
36785// persons to whom the Software is furnished to do so, subject to the
36786// following conditions:
36787//
36788// The above copyright notice and this permission notice shall be included
36789// in all copies or substantial portions of the Software.
36790//
36791// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
36792// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
36793// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
36794// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
36795// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
36796// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
36797// USE OR OTHER DEALINGS IN THE SOFTWARE.
36798
36799'use strict';
36800
36801var punycode = require(92);
36802var util = require(335);
36803
36804exports.parse = urlParse;
36805exports.resolve = urlResolve;
36806exports.resolveObject = urlResolveObject;
36807exports.format = urlFormat;
36808
36809exports.Url = Url;
36810
36811function Url() {
36812 this.protocol = null;
36813 this.slashes = null;
36814 this.auth = null;
36815 this.host = null;
36816 this.port = null;
36817 this.hostname = null;
36818 this.hash = null;
36819 this.search = null;
36820 this.query = null;
36821 this.pathname = null;
36822 this.path = null;
36823 this.href = null;
36824}
36825
36826// Reference: RFC 3986, RFC 1808, RFC 2396
36827
36828// define these here so at least they only have to be
36829// compiled once on the first module load.
36830var protocolPattern = /^([a-z0-9.+-]+:)/i,
36831 portPattern = /:[0-9]*$/,
36832
36833 // Special case for a simple path URL
36834 simplePathPattern = /^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/,
36835
36836 // RFC 2396: characters reserved for delimiting URLs.
36837 // We actually just auto-escape these.
36838 delims = ['<', '>', '"', '`', ' ', '\r', '\n', '\t'],
36839
36840 // RFC 2396: characters not allowed for various reasons.
36841 unwise = ['{', '}', '|', '\\', '^', '`'].concat(delims),
36842
36843 // Allowed by RFCs, but cause of XSS attacks. Always escape these.
36844 autoEscape = ['\''].concat(unwise),
36845 // Characters that are never ever allowed in a hostname.
36846 // Note that any invalid chars are also handled, but these
36847 // are the ones that are *expected* to be seen, so we fast-path
36848 // them.
36849 nonHostChars = ['%', '/', '?', ';', '#'].concat(autoEscape),
36850 hostEndingChars = ['/', '?', '#'],
36851 hostnameMaxLen = 255,
36852 hostnamePartPattern = /^[+a-z0-9A-Z_-]{0,63}$/,
36853 hostnamePartStart = /^([+a-z0-9A-Z_-]{0,63})(.*)$/,
36854 // protocols that can allow "unsafe" and "unwise" chars.
36855 unsafeProtocol = {
36856 'javascript': true,
36857 'javascript:': true
36858 },
36859 // protocols that never have a hostname.
36860 hostlessProtocol = {
36861 'javascript': true,
36862 'javascript:': true
36863 },
36864 // protocols that always contain a // bit.
36865 slashedProtocol = {
36866 'http': true,
36867 'https': true,
36868 'ftp': true,
36869 'gopher': true,
36870 'file': true,
36871 'http:': true,
36872 'https:': true,
36873 'ftp:': true,
36874 'gopher:': true,
36875 'file:': true
36876 },
36877 querystring = require(96);
36878
36879function urlParse(url, parseQueryString, slashesDenoteHost) {
36880 if (url && util.isObject(url) && url instanceof Url) return url;
36881
36882 var u = new Url;
36883 u.parse(url, parseQueryString, slashesDenoteHost);
36884 return u;
36885}
36886
36887Url.prototype.parse = function(url, parseQueryString, slashesDenoteHost) {
36888 if (!util.isString(url)) {
36889 throw new TypeError("Parameter 'url' must be a string, not " + typeof url);
36890 }
36891
36892 // Copy chrome, IE, opera backslash-handling behavior.
36893 // Back slashes before the query string get converted to forward slashes
36894 // See: https://code.google.com/p/chromium/issues/detail?id=25916
36895 var queryIndex = url.indexOf('?'),
36896 splitter =
36897 (queryIndex !== -1 && queryIndex < url.indexOf('#')) ? '?' : '#',
36898 uSplit = url.split(splitter),
36899 slashRegex = /\\/g;
36900 uSplit[0] = uSplit[0].replace(slashRegex, '/');
36901 url = uSplit.join(splitter);
36902
36903 var rest = url;
36904
36905 // trim before proceeding.
36906 // This is to support parse stuff like " http://foo.com \n"
36907 rest = rest.trim();
36908
36909 if (!slashesDenoteHost && url.split('#').length === 1) {
36910 // Try fast path regexp
36911 var simplePath = simplePathPattern.exec(rest);
36912 if (simplePath) {
36913 this.path = rest;
36914 this.href = rest;
36915 this.pathname = simplePath[1];
36916 if (simplePath[2]) {
36917 this.search = simplePath[2];
36918 if (parseQueryString) {
36919 this.query = querystring.parse(this.search.substr(1));
36920 } else {
36921 this.query = this.search.substr(1);
36922 }
36923 } else if (parseQueryString) {
36924 this.search = '';
36925 this.query = {};
36926 }
36927 return this;
36928 }
36929 }
36930
36931 var proto = protocolPattern.exec(rest);
36932 if (proto) {
36933 proto = proto[0];
36934 var lowerProto = proto.toLowerCase();
36935 this.protocol = lowerProto;
36936 rest = rest.substr(proto.length);
36937 }
36938
36939 // figure out if it's got a host
36940 // user@server is *always* interpreted as a hostname, and url
36941 // resolution will treat //foo/bar as host=foo,path=bar because that's
36942 // how the browser resolves relative URLs.
36943 if (slashesDenoteHost || proto || rest.match(/^\/\/[^@\/]+@[^@\/]+/)) {
36944 var slashes = rest.substr(0, 2) === '//';
36945 if (slashes && !(proto && hostlessProtocol[proto])) {
36946 rest = rest.substr(2);
36947 this.slashes = true;
36948 }
36949 }
36950
36951 if (!hostlessProtocol[proto] &&
36952 (slashes || (proto && !slashedProtocol[proto]))) {
36953
36954 // there's a hostname.
36955 // the first instance of /, ?, ;, or # ends the host.
36956 //
36957 // If there is an @ in the hostname, then non-host chars *are* allowed
36958 // to the left of the last @ sign, unless some host-ending character
36959 // comes *before* the @-sign.
36960 // URLs are obnoxious.
36961 //
36962 // ex:
36963 // http://a@b@c/ => user:a@b host:c
36964 // http://a@b?@c => user:a host:c path:/?@c
36965
36966 // v0.12 TODO(isaacs): This is not quite how Chrome does things.
36967 // Review our test case against browsers more comprehensively.
36968
36969 // find the first instance of any hostEndingChars
36970 var hostEnd = -1;
36971 for (var i = 0; i < hostEndingChars.length; i++) {
36972 var hec = rest.indexOf(hostEndingChars[i]);
36973 if (hec !== -1 && (hostEnd === -1 || hec < hostEnd))
36974 hostEnd = hec;
36975 }
36976
36977 // at this point, either we have an explicit point where the
36978 // auth portion cannot go past, or the last @ char is the decider.
36979 var auth, atSign;
36980 if (hostEnd === -1) {
36981 // atSign can be anywhere.
36982 atSign = rest.lastIndexOf('@');
36983 } else {
36984 // atSign must be in auth portion.
36985 // http://a@b/c@d => host:b auth:a path:/c@d
36986 atSign = rest.lastIndexOf('@', hostEnd);
36987 }
36988
36989 // Now we have a portion which is definitely the auth.
36990 // Pull that off.
36991 if (atSign !== -1) {
36992 auth = rest.slice(0, atSign);
36993 rest = rest.slice(atSign + 1);
36994 this.auth = decodeURIComponent(auth);
36995 }
36996
36997 // the host is the remaining to the left of the first non-host char
36998 hostEnd = -1;
36999 for (var i = 0; i < nonHostChars.length; i++) {
37000 var hec = rest.indexOf(nonHostChars[i]);
37001 if (hec !== -1 && (hostEnd === -1 || hec < hostEnd))
37002 hostEnd = hec;
37003 }
37004 // if we still have not hit it, then the entire thing is a host.
37005 if (hostEnd === -1)
37006 hostEnd = rest.length;
37007
37008 this.host = rest.slice(0, hostEnd);
37009 rest = rest.slice(hostEnd);
37010
37011 // pull out port.
37012 this.parseHost();
37013
37014 // we've indicated that there is a hostname,
37015 // so even if it's empty, it has to be present.
37016 this.hostname = this.hostname || '';
37017
37018 // if hostname begins with [ and ends with ]
37019 // assume that it's an IPv6 address.
37020 var ipv6Hostname = this.hostname[0] === '[' &&
37021 this.hostname[this.hostname.length - 1] === ']';
37022
37023 // validate a little.
37024 if (!ipv6Hostname) {
37025 var hostparts = this.hostname.split(/\./);
37026 for (var i = 0, l = hostparts.length; i < l; i++) {
37027 var part = hostparts[i];
37028 if (!part) continue;
37029 if (!part.match(hostnamePartPattern)) {
37030 var newpart = '';
37031 for (var j = 0, k = part.length; j < k; j++) {
37032 if (part.charCodeAt(j) > 127) {
37033 // we replace non-ASCII char with a temporary placeholder
37034 // we need this to make sure size of hostname is not
37035 // broken by replacing non-ASCII by nothing
37036 newpart += 'x';
37037 } else {
37038 newpart += part[j];
37039 }
37040 }
37041 // we test again with ASCII char only
37042 if (!newpart.match(hostnamePartPattern)) {
37043 var validParts = hostparts.slice(0, i);
37044 var notHost = hostparts.slice(i + 1);
37045 var bit = part.match(hostnamePartStart);
37046 if (bit) {
37047 validParts.push(bit[1]);
37048 notHost.unshift(bit[2]);
37049 }
37050 if (notHost.length) {
37051 rest = '/' + notHost.join('.') + rest;
37052 }
37053 this.hostname = validParts.join('.');
37054 break;
37055 }
37056 }
37057 }
37058 }
37059
37060 if (this.hostname.length > hostnameMaxLen) {
37061 this.hostname = '';
37062 } else {
37063 // hostnames are always lower case.
37064 this.hostname = this.hostname.toLowerCase();
37065 }
37066
37067 if (!ipv6Hostname) {
37068 // IDNA Support: Returns a punycoded representation of "domain".
37069 // It only converts parts of the domain name that
37070 // have non-ASCII characters, i.e. it doesn't matter if
37071 // you call it with a domain that already is ASCII-only.
37072 this.hostname = punycode.toASCII(this.hostname);
37073 }
37074
37075 var p = this.port ? ':' + this.port : '';
37076 var h = this.hostname || '';
37077 this.host = h + p;
37078 this.href += this.host;
37079
37080 // strip [ and ] from the hostname
37081 // the host field still retains them, though
37082 if (ipv6Hostname) {
37083 this.hostname = this.hostname.substr(1, this.hostname.length - 2);
37084 if (rest[0] !== '/') {
37085 rest = '/' + rest;
37086 }
37087 }
37088 }
37089
37090 // now rest is set to the post-host stuff.
37091 // chop off any delim chars.
37092 if (!unsafeProtocol[lowerProto]) {
37093
37094 // First, make 100% sure that any "autoEscape" chars get
37095 // escaped, even if encodeURIComponent doesn't think they
37096 // need to be.
37097 for (var i = 0, l = autoEscape.length; i < l; i++) {
37098 var ae = autoEscape[i];
37099 if (rest.indexOf(ae) === -1)
37100 continue;
37101 var esc = encodeURIComponent(ae);
37102 if (esc === ae) {
37103 esc = escape(ae);
37104 }
37105 rest = rest.split(ae).join(esc);
37106 }
37107 }
37108
37109
37110 // chop off from the tail first.
37111 var hash = rest.indexOf('#');
37112 if (hash !== -1) {
37113 // got a fragment string.
37114 this.hash = rest.substr(hash);
37115 rest = rest.slice(0, hash);
37116 }
37117 var qm = rest.indexOf('?');
37118 if (qm !== -1) {
37119 this.search = rest.substr(qm);
37120 this.query = rest.substr(qm + 1);
37121 if (parseQueryString) {
37122 this.query = querystring.parse(this.query);
37123 }
37124 rest = rest.slice(0, qm);
37125 } else if (parseQueryString) {
37126 // no query string, but parseQueryString still requested
37127 this.search = '';
37128 this.query = {};
37129 }
37130 if (rest) this.pathname = rest;
37131 if (slashedProtocol[lowerProto] &&
37132 this.hostname && !this.pathname) {
37133 this.pathname = '/';
37134 }
37135
37136 //to support http.request
37137 if (this.pathname || this.search) {
37138 var p = this.pathname || '';
37139 var s = this.search || '';
37140 this.path = p + s;
37141 }
37142
37143 // finally, reconstruct the href based on what has been validated.
37144 this.href = this.format();
37145 return this;
37146};
37147
37148// format a parsed object into a url string
37149function urlFormat(obj) {
37150 // ensure it's an object, and not a string url.
37151 // If it's an obj, this is a no-op.
37152 // this way, you can call url_format() on strings
37153 // to clean up potentially wonky urls.
37154 if (util.isString(obj)) obj = urlParse(obj);
37155 if (!(obj instanceof Url)) return Url.prototype.format.call(obj);
37156 return obj.format();
37157}
37158
37159Url.prototype.format = function() {
37160 var auth = this.auth || '';
37161 if (auth) {
37162 auth = encodeURIComponent(auth);
37163 auth = auth.replace(/%3A/i, ':');
37164 auth += '@';
37165 }
37166
37167 var protocol = this.protocol || '',
37168 pathname = this.pathname || '',
37169 hash = this.hash || '',
37170 host = false,
37171 query = '';
37172
37173 if (this.host) {
37174 host = auth + this.host;
37175 } else if (this.hostname) {
37176 host = auth + (this.hostname.indexOf(':') === -1 ?
37177 this.hostname :
37178 '[' + this.hostname + ']');
37179 if (this.port) {
37180 host += ':' + this.port;
37181 }
37182 }
37183
37184 if (this.query &&
37185 util.isObject(this.query) &&
37186 Object.keys(this.query).length) {
37187 query = querystring.stringify(this.query);
37188 }
37189
37190 var search = this.search || (query && ('?' + query)) || '';
37191
37192 if (protocol && protocol.substr(-1) !== ':') protocol += ':';
37193
37194 // only the slashedProtocols get the //. Not mailto:, xmpp:, etc.
37195 // unless they had them to begin with.
37196 if (this.slashes ||
37197 (!protocol || slashedProtocol[protocol]) && host !== false) {
37198 host = '//' + (host || '');
37199 if (pathname && pathname.charAt(0) !== '/') pathname = '/' + pathname;
37200 } else if (!host) {
37201 host = '';
37202 }
37203
37204 if (hash && hash.charAt(0) !== '#') hash = '#' + hash;
37205 if (search && search.charAt(0) !== '?') search = '?' + search;
37206
37207 pathname = pathname.replace(/[?#]/g, function(match) {
37208 return encodeURIComponent(match);
37209 });
37210 search = search.replace('#', '%23');
37211
37212 return protocol + host + pathname + search + hash;
37213};
37214
37215function urlResolve(source, relative) {
37216 return urlParse(source, false, true).resolve(relative);
37217}
37218
37219Url.prototype.resolve = function(relative) {
37220 return this.resolveObject(urlParse(relative, false, true)).format();
37221};
37222
37223function urlResolveObject(source, relative) {
37224 if (!source) return relative;
37225 return urlParse(source, false, true).resolveObject(relative);
37226}
37227
37228Url.prototype.resolveObject = function(relative) {
37229 if (util.isString(relative)) {
37230 var rel = new Url();
37231 rel.parse(relative, false, true);
37232 relative = rel;
37233 }
37234
37235 var result = new Url();
37236 var tkeys = Object.keys(this);
37237 for (var tk = 0; tk < tkeys.length; tk++) {
37238 var tkey = tkeys[tk];
37239 result[tkey] = this[tkey];
37240 }
37241
37242 // hash is always overridden, no matter what.
37243 // even href="" will remove it.
37244 result.hash = relative.hash;
37245
37246 // if the relative url is empty, then there's nothing left to do here.
37247 if (relative.href === '') {
37248 result.href = result.format();
37249 return result;
37250 }
37251
37252 // hrefs like //foo/bar always cut to the protocol.
37253 if (relative.slashes && !relative.protocol) {
37254 // take everything except the protocol from relative
37255 var rkeys = Object.keys(relative);
37256 for (var rk = 0; rk < rkeys.length; rk++) {
37257 var rkey = rkeys[rk];
37258 if (rkey !== 'protocol')
37259 result[rkey] = relative[rkey];
37260 }
37261
37262 //urlParse appends trailing / to urls like http://www.example.com
37263 if (slashedProtocol[result.protocol] &&
37264 result.hostname && !result.pathname) {
37265 result.path = result.pathname = '/';
37266 }
37267
37268 result.href = result.format();
37269 return result;
37270 }
37271
37272 if (relative.protocol && relative.protocol !== result.protocol) {
37273 // if it's a known url protocol, then changing
37274 // the protocol does weird things
37275 // first, if it's not file:, then we MUST have a host,
37276 // and if there was a path
37277 // to begin with, then we MUST have a path.
37278 // if it is file:, then the host is dropped,
37279 // because that's known to be hostless.
37280 // anything else is assumed to be absolute.
37281 if (!slashedProtocol[relative.protocol]) {
37282 var keys = Object.keys(relative);
37283 for (var v = 0; v < keys.length; v++) {
37284 var k = keys[v];
37285 result[k] = relative[k];
37286 }
37287 result.href = result.format();
37288 return result;
37289 }
37290
37291 result.protocol = relative.protocol;
37292 if (!relative.host && !hostlessProtocol[relative.protocol]) {
37293 var relPath = (relative.pathname || '').split('/');
37294 while (relPath.length && !(relative.host = relPath.shift()));
37295 if (!relative.host) relative.host = '';
37296 if (!relative.hostname) relative.hostname = '';
37297 if (relPath[0] !== '') relPath.unshift('');
37298 if (relPath.length < 2) relPath.unshift('');
37299 result.pathname = relPath.join('/');
37300 } else {
37301 result.pathname = relative.pathname;
37302 }
37303 result.search = relative.search;
37304 result.query = relative.query;
37305 result.host = relative.host || '';
37306 result.auth = relative.auth;
37307 result.hostname = relative.hostname || relative.host;
37308 result.port = relative.port;
37309 // to support http.request
37310 if (result.pathname || result.search) {
37311 var p = result.pathname || '';
37312 var s = result.search || '';
37313 result.path = p + s;
37314 }
37315 result.slashes = result.slashes || relative.slashes;
37316 result.href = result.format();
37317 return result;
37318 }
37319
37320 var isSourceAbs = (result.pathname && result.pathname.charAt(0) === '/'),
37321 isRelAbs = (
37322 relative.host ||
37323 relative.pathname && relative.pathname.charAt(0) === '/'
37324 ),
37325 mustEndAbs = (isRelAbs || isSourceAbs ||
37326 (result.host && relative.pathname)),
37327 removeAllDots = mustEndAbs,
37328 srcPath = result.pathname && result.pathname.split('/') || [],
37329 relPath = relative.pathname && relative.pathname.split('/') || [],
37330 psychotic = result.protocol && !slashedProtocol[result.protocol];
37331
37332 // if the url is a non-slashed url, then relative
37333 // links like ../.. should be able
37334 // to crawl up to the hostname, as well. This is strange.
37335 // result.protocol has already been set by now.
37336 // Later on, put the first path part into the host field.
37337 if (psychotic) {
37338 result.hostname = '';
37339 result.port = null;
37340 if (result.host) {
37341 if (srcPath[0] === '') srcPath[0] = result.host;
37342 else srcPath.unshift(result.host);
37343 }
37344 result.host = '';
37345 if (relative.protocol) {
37346 relative.hostname = null;
37347 relative.port = null;
37348 if (relative.host) {
37349 if (relPath[0] === '') relPath[0] = relative.host;
37350 else relPath.unshift(relative.host);
37351 }
37352 relative.host = null;
37353 }
37354 mustEndAbs = mustEndAbs && (relPath[0] === '' || srcPath[0] === '');
37355 }
37356
37357 if (isRelAbs) {
37358 // it's absolute.
37359 result.host = (relative.host || relative.host === '') ?
37360 relative.host : result.host;
37361 result.hostname = (relative.hostname || relative.hostname === '') ?
37362 relative.hostname : result.hostname;
37363 result.search = relative.search;
37364 result.query = relative.query;
37365 srcPath = relPath;
37366 // fall through to the dot-handling below.
37367 } else if (relPath.length) {
37368 // it's relative
37369 // throw away the existing file, and take the new path instead.
37370 if (!srcPath) srcPath = [];
37371 srcPath.pop();
37372 srcPath = srcPath.concat(relPath);
37373 result.search = relative.search;
37374 result.query = relative.query;
37375 } else if (!util.isNullOrUndefined(relative.search)) {
37376 // just pull out the search.
37377 // like href='?foo'.
37378 // Put this after the other two cases because it simplifies the booleans
37379 if (psychotic) {
37380 result.hostname = result.host = srcPath.shift();
37381 //occationaly the auth can get stuck only in host
37382 //this especially happens in cases like
37383 //url.resolveObject('mailto:local1@domain1', 'local2@domain2')
37384 var authInHost = result.host && result.host.indexOf('@') > 0 ?
37385 result.host.split('@') : false;
37386 if (authInHost) {
37387 result.auth = authInHost.shift();
37388 result.host = result.hostname = authInHost.shift();
37389 }
37390 }
37391 result.search = relative.search;
37392 result.query = relative.query;
37393 //to support http.request
37394 if (!util.isNull(result.pathname) || !util.isNull(result.search)) {
37395 result.path = (result.pathname ? result.pathname : '') +
37396 (result.search ? result.search : '');
37397 }
37398 result.href = result.format();
37399 return result;
37400 }
37401
37402 if (!srcPath.length) {
37403 // no path at all. easy.
37404 // we've already handled the other stuff above.
37405 result.pathname = null;
37406 //to support http.request
37407 if (result.search) {
37408 result.path = '/' + result.search;
37409 } else {
37410 result.path = null;
37411 }
37412 result.href = result.format();
37413 return result;
37414 }
37415
37416 // if a url ENDs in . or .., then it must get a trailing slash.
37417 // however, if it ends in anything else non-slashy,
37418 // then it must NOT get a trailing slash.
37419 var last = srcPath.slice(-1)[0];
37420 var hasTrailingSlash = (
37421 (result.host || relative.host || srcPath.length > 1) &&
37422 (last === '.' || last === '..') || last === '');
37423
37424 // strip single dots, resolve double dots to parent dir
37425 // if the path tries to go above the root, `up` ends up > 0
37426 var up = 0;
37427 for (var i = srcPath.length; i >= 0; i--) {
37428 last = srcPath[i];
37429 if (last === '.') {
37430 srcPath.splice(i, 1);
37431 } else if (last === '..') {
37432 srcPath.splice(i, 1);
37433 up++;
37434 } else if (up) {
37435 srcPath.splice(i, 1);
37436 up--;
37437 }
37438 }
37439
37440 // if the path is allowed to go above the root, restore leading ..s
37441 if (!mustEndAbs && !removeAllDots) {
37442 for (; up--; up) {
37443 srcPath.unshift('..');
37444 }
37445 }
37446
37447 if (mustEndAbs && srcPath[0] !== '' &&
37448 (!srcPath[0] || srcPath[0].charAt(0) !== '/')) {
37449 srcPath.unshift('');
37450 }
37451
37452 if (hasTrailingSlash && (srcPath.join('/').substr(-1) !== '/')) {
37453 srcPath.push('');
37454 }
37455
37456 var isAbsolute = srcPath[0] === '' ||
37457 (srcPath[0] && srcPath[0].charAt(0) === '/');
37458
37459 // put the host back
37460 if (psychotic) {
37461 result.hostname = result.host = isAbsolute ? '' :
37462 srcPath.length ? srcPath.shift() : '';
37463 //occationaly the auth can get stuck only in host
37464 //this especially happens in cases like
37465 //url.resolveObject('mailto:local1@domain1', 'local2@domain2')
37466 var authInHost = result.host && result.host.indexOf('@') > 0 ?
37467 result.host.split('@') : false;
37468 if (authInHost) {
37469 result.auth = authInHost.shift();
37470 result.host = result.hostname = authInHost.shift();
37471 }
37472 }
37473
37474 mustEndAbs = mustEndAbs || (result.host && srcPath.length);
37475
37476 if (mustEndAbs && !isAbsolute) {
37477 srcPath.unshift('');
37478 }
37479
37480 if (!srcPath.length) {
37481 result.pathname = null;
37482 result.path = null;
37483 } else {
37484 result.pathname = srcPath.join('/');
37485 }
37486
37487 //to support request.http
37488 if (!util.isNull(result.pathname) || !util.isNull(result.search)) {
37489 result.path = (result.pathname ? result.pathname : '') +
37490 (result.search ? result.search : '');
37491 }
37492 result.auth = relative.auth || result.auth;
37493 result.slashes = result.slashes || relative.slashes;
37494 result.href = result.format();
37495 return result;
37496};
37497
37498Url.prototype.parseHost = function() {
37499 var host = this.host;
37500 var port = portPattern.exec(host);
37501 if (port) {
37502 port = port[0];
37503 if (port !== ':') {
37504 this.port = port.substr(1);
37505 }
37506 host = host.substr(0, host.length - port.length);
37507 }
37508 if (host) this.hostname = host;
37509};
37510
37511},{"335":335,"92":92,"96":96}],335:[function(require,module,exports){
37512'use strict';
37513
37514module.exports = {
37515 isString: function(arg) {
37516 return typeof(arg) === 'string';
37517 },
37518 isObject: function(arg) {
37519 return typeof(arg) === 'object' && arg !== null;
37520 },
37521 isNull: function(arg) {
37522 return arg === null;
37523 },
37524 isNullOrUndefined: function(arg) {
37525 return arg == null;
37526 }
37527};
37528
37529},{}],336:[function(require,module,exports){
37530(function (global){
37531/*! https://mths.be/utf8js v2.0.0 by @mathias */
37532;(function(root) {
37533
37534 // Detect free variables `exports`
37535 var freeExports = typeof exports == 'object' && exports;
37536
37537 // Detect free variable `module`
37538 var freeModule = typeof module == 'object' && module &&
37539 module.exports == freeExports && module;
37540
37541 // Detect free variable `global`, from Node.js or Browserified code,
37542 // and use it as `root`
37543 var freeGlobal = typeof global == 'object' && global;
37544 if (freeGlobal.global === freeGlobal || freeGlobal.window === freeGlobal) {
37545 root = freeGlobal;
37546 }
37547
37548 /*--------------------------------------------------------------------------*/
37549
37550 var stringFromCharCode = String.fromCharCode;
37551
37552 // Taken from https://mths.be/punycode
37553 function ucs2decode(string) {
37554 var output = [];
37555 var counter = 0;
37556 var length = string.length;
37557 var value;
37558 var extra;
37559 while (counter < length) {
37560 value = string.charCodeAt(counter++);
37561 if (value >= 0xD800 && value <= 0xDBFF && counter < length) {
37562 // high surrogate, and there is a next character
37563 extra = string.charCodeAt(counter++);
37564 if ((extra & 0xFC00) == 0xDC00) { // low surrogate
37565 output.push(((value & 0x3FF) << 10) + (extra & 0x3FF) + 0x10000);
37566 } else {
37567 // unmatched surrogate; only append this code unit, in case the next
37568 // code unit is the high surrogate of a surrogate pair
37569 output.push(value);
37570 counter--;
37571 }
37572 } else {
37573 output.push(value);
37574 }
37575 }
37576 return output;
37577 }
37578
37579 // Taken from https://mths.be/punycode
37580 function ucs2encode(array) {
37581 var length = array.length;
37582 var index = -1;
37583 var value;
37584 var output = '';
37585 while (++index < length) {
37586 value = array[index];
37587 if (value > 0xFFFF) {
37588 value -= 0x10000;
37589 output += stringFromCharCode(value >>> 10 & 0x3FF | 0xD800);
37590 value = 0xDC00 | value & 0x3FF;
37591 }
37592 output += stringFromCharCode(value);
37593 }
37594 return output;
37595 }
37596
37597 function checkScalarValue(codePoint) {
37598 if (codePoint >= 0xD800 && codePoint <= 0xDFFF) {
37599 throw Error(
37600 'Lone surrogate U+' + codePoint.toString(16).toUpperCase() +
37601 ' is not a scalar value'
37602 );
37603 }
37604 }
37605 /*--------------------------------------------------------------------------*/
37606
37607 function createByte(codePoint, shift) {
37608 return stringFromCharCode(((codePoint >> shift) & 0x3F) | 0x80);
37609 }
37610
37611 function encodeCodePoint(codePoint) {
37612 if ((codePoint & 0xFFFFFF80) == 0) { // 1-byte sequence
37613 return stringFromCharCode(codePoint);
37614 }
37615 var symbol = '';
37616 if ((codePoint & 0xFFFFF800) == 0) { // 2-byte sequence
37617 symbol = stringFromCharCode(((codePoint >> 6) & 0x1F) | 0xC0);
37618 }
37619 else if ((codePoint & 0xFFFF0000) == 0) { // 3-byte sequence
37620 checkScalarValue(codePoint);
37621 symbol = stringFromCharCode(((codePoint >> 12) & 0x0F) | 0xE0);
37622 symbol += createByte(codePoint, 6);
37623 }
37624 else if ((codePoint & 0xFFE00000) == 0) { // 4-byte sequence
37625 symbol = stringFromCharCode(((codePoint >> 18) & 0x07) | 0xF0);
37626 symbol += createByte(codePoint, 12);
37627 symbol += createByte(codePoint, 6);
37628 }
37629 symbol += stringFromCharCode((codePoint & 0x3F) | 0x80);
37630 return symbol;
37631 }
37632
37633 function utf8encode(string) {
37634 var codePoints = ucs2decode(string);
37635 var length = codePoints.length;
37636 var index = -1;
37637 var codePoint;
37638 var byteString = '';
37639 while (++index < length) {
37640 codePoint = codePoints[index];
37641 byteString += encodeCodePoint(codePoint);
37642 }
37643 return byteString;
37644 }
37645
37646 /*--------------------------------------------------------------------------*/
37647
37648 function readContinuationByte() {
37649 if (byteIndex >= byteCount) {
37650 throw Error('Invalid byte index');
37651 }
37652
37653 var continuationByte = byteArray[byteIndex] & 0xFF;
37654 byteIndex++;
37655
37656 if ((continuationByte & 0xC0) == 0x80) {
37657 return continuationByte & 0x3F;
37658 }
37659
37660 // If we end up here, it’s not a continuation byte
37661 throw Error('Invalid continuation byte');
37662 }
37663
37664 function decodeSymbol() {
37665 var byte1;
37666 var byte2;
37667 var byte3;
37668 var byte4;
37669 var codePoint;
37670
37671 if (byteIndex > byteCount) {
37672 throw Error('Invalid byte index');
37673 }
37674
37675 if (byteIndex == byteCount) {
37676 return false;
37677 }
37678
37679 // Read first byte
37680 byte1 = byteArray[byteIndex] & 0xFF;
37681 byteIndex++;
37682
37683 // 1-byte sequence (no continuation bytes)
37684 if ((byte1 & 0x80) == 0) {
37685 return byte1;
37686 }
37687
37688 // 2-byte sequence
37689 if ((byte1 & 0xE0) == 0xC0) {
37690 var byte2 = readContinuationByte();
37691 codePoint = ((byte1 & 0x1F) << 6) | byte2;
37692 if (codePoint >= 0x80) {
37693 return codePoint;
37694 } else {
37695 throw Error('Invalid continuation byte');
37696 }
37697 }
37698
37699 // 3-byte sequence (may include unpaired surrogates)
37700 if ((byte1 & 0xF0) == 0xE0) {
37701 byte2 = readContinuationByte();
37702 byte3 = readContinuationByte();
37703 codePoint = ((byte1 & 0x0F) << 12) | (byte2 << 6) | byte3;
37704 if (codePoint >= 0x0800) {
37705 checkScalarValue(codePoint);
37706 return codePoint;
37707 } else {
37708 throw Error('Invalid continuation byte');
37709 }
37710 }
37711
37712 // 4-byte sequence
37713 if ((byte1 & 0xF8) == 0xF0) {
37714 byte2 = readContinuationByte();
37715 byte3 = readContinuationByte();
37716 byte4 = readContinuationByte();
37717 codePoint = ((byte1 & 0x0F) << 0x12) | (byte2 << 0x0C) |
37718 (byte3 << 0x06) | byte4;
37719 if (codePoint >= 0x010000 && codePoint <= 0x10FFFF) {
37720 return codePoint;
37721 }
37722 }
37723
37724 throw Error('Invalid UTF-8 detected');
37725 }
37726
37727 var byteArray;
37728 var byteCount;
37729 var byteIndex;
37730 function utf8decode(byteString) {
37731 byteArray = ucs2decode(byteString);
37732 byteCount = byteArray.length;
37733 byteIndex = 0;
37734 var codePoints = [];
37735 var tmp;
37736 while ((tmp = decodeSymbol()) !== false) {
37737 codePoints.push(tmp);
37738 }
37739 return ucs2encode(codePoints);
37740 }
37741
37742 /*--------------------------------------------------------------------------*/
37743
37744 var utf8 = {
37745 'version': '2.0.0',
37746 'encode': utf8encode,
37747 'decode': utf8decode
37748 };
37749
37750 // Some AMD build optimizers, like r.js, check for specific condition patterns
37751 // like the following:
37752 if (
37753 typeof define == 'function' &&
37754 typeof define.amd == 'object' &&
37755 define.amd
37756 ) {
37757 define(function() {
37758 return utf8;
37759 });
37760 } else if (freeExports && !freeExports.nodeType) {
37761 if (freeModule) { // in Node.js or RingoJS v0.8.0+
37762 freeModule.exports = utf8;
37763 } else { // in Narwhal or RingoJS v0.7.0-
37764 var object = {};
37765 var hasOwnProperty = object.hasOwnProperty;
37766 for (var key in utf8) {
37767 hasOwnProperty.call(utf8, key) && (freeExports[key] = utf8[key]);
37768 }
37769 }
37770 } else { // in Rhino or a web browser
37771 root.utf8 = utf8;
37772 }
37773
37774}(this));
37775
37776}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
37777},{}],337:[function(require,module,exports){
37778(function (process){
37779/**
37780 * Copyright 2014-2015, Facebook, Inc.
37781 * All rights reserved.
37782 *
37783 * This source code is licensed under the BSD-style license found in the
37784 * LICENSE file in the root directory of this source tree. An additional grant
37785 * of patent rights can be found in the PATENTS file in the same directory.
37786 */
37787
37788'use strict';
37789
37790/**
37791 * Similar to invariant but only logs a warning if the condition is not met.
37792 * This can be used to log issues in development environments in critical
37793 * paths. Removing the logging code for production environments will keep the
37794 * same logic and follow the same code paths.
37795 */
37796
37797var warning = function() {};
37798
37799if (process.env.NODE_ENV !== 'production') {
37800 warning = function(condition, format, args) {
37801 var len = arguments.length;
37802 args = new Array(len > 2 ? len - 2 : 0);
37803 for (var key = 2; key < len; key++) {
37804 args[key - 2] = arguments[key];
37805 }
37806 if (format === undefined) {
37807 throw new Error(
37808 '`warning(condition, format, ...args)` requires a warning ' +
37809 'message argument'
37810 );
37811 }
37812
37813 if (format.length < 10 || (/^[s\W]*$/).test(format)) {
37814 throw new Error(
37815 'The warning format should be able to uniquely identify this ' +
37816 'warning. Please, use a more descriptive format than: ' + format
37817 );
37818 }
37819
37820 if (!condition) {
37821 var argIndex = 0;
37822 var message = 'Warning: ' +
37823 format.replace(/%s/g, function() {
37824 return args[argIndex++];
37825 });
37826 if (typeof console !== 'undefined') {
37827 console.error(message);
37828 }
37829 try {
37830 // This error was thrown as a convenience so that you can use this stack
37831 // to find the callsite that caused this warning to fire.
37832 throw new Error(message);
37833 } catch(x) {}
37834 }
37835 };
37836}
37837
37838module.exports = warning;
37839
37840}).call(this,require(91))
37841},{"91":91}],338:[function(require,module,exports){
37842'use strict';
37843
37844var alphabet = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_'.split('')
37845 , length = 64
37846 , map = {}
37847 , seed = 0
37848 , i = 0
37849 , prev;
37850
37851/**
37852 * Return a string representing the specified number.
37853 *
37854 * @param {Number} num The number to convert.
37855 * @returns {String} The string representation of the number.
37856 * @api public
37857 */
37858function encode(num) {
37859 var encoded = '';
37860
37861 do {
37862 encoded = alphabet[num % length] + encoded;
37863 num = Math.floor(num / length);
37864 } while (num > 0);
37865
37866 return encoded;
37867}
37868
37869/**
37870 * Return the integer value specified by the given string.
37871 *
37872 * @param {String} str The string to convert.
37873 * @returns {Number} The integer value represented by the string.
37874 * @api public
37875 */
37876function decode(str) {
37877 var decoded = 0;
37878
37879 for (i = 0; i < str.length; i++) {
37880 decoded = decoded * length + map[str.charAt(i)];
37881 }
37882
37883 return decoded;
37884}
37885
37886/**
37887 * Yeast: A tiny growing id generator.
37888 *
37889 * @returns {String} A unique id.
37890 * @api public
37891 */
37892function yeast() {
37893 var now = encode(+new Date());
37894
37895 if (now !== prev) return seed = 0, prev = now;
37896 return now +'.'+ encode(seed++);
37897}
37898
37899//
37900// Map each character to its index.
37901//
37902for (; i < length; i++) map[alphabet[i]] = i;
37903
37904//
37905// Expose the `yeast`, `encode` and `decode` functions.
37906//
37907yeast.encode = encode;
37908yeast.decode = decode;
37909module.exports = yeast;
37910
37911},{}],339:[function(require,module,exports){
37912'use strict';
37913
37914var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
37915
37916Object.defineProperty(exports, "__esModule", {
37917 value: true
37918});
37919
37920var _react = require(297);
37921
37922var _react2 = _interopRequireDefault(_react);
37923
37924var _url = require(334);
37925
37926var _url2 = _interopRequireDefault(_url);
37927
37928var _lodash = require(84);
37929
37930var _lodash2 = _interopRequireDefault(_lodash);
37931
37932function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
37933
37934function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
37935
37936function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
37937
37938function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
37939
37940var Bookmark = function (_Component) {
37941 _inherits(Bookmark, _Component);
37942
37943 function Bookmark() {
37944 _classCallCheck(this, Bookmark);
37945
37946 return _possibleConstructorReturn(this, Object.getPrototypeOf(Bookmark).apply(this, arguments));
37947 }
37948
37949 _createClass(Bookmark, [{
37950 key: 'destroyBookmark',
37951 value: function destroyBookmark(evt) {
37952 evt.preventDefault();
37953
37954 if (typeof window !== 'undefined') {
37955 window.app.socket.emit('destroy-bookmark', {
37956 id: this.props.bookmark.id
37957 });
37958 }
37959 }
37960 }, {
37961 key: 'getTimeString',
37962 value: function getTimeString() {
37963 var months = {
37964 0: 'January',
37965 1: 'February',
37966 2: 'March',
37967 3: 'April',
37968 4: 'May',
37969 5: 'June',
37970 6: 'July',
37971 7: 'August',
37972 8: 'September',
37973 9: 'October',
37974 10: 'November',
37975 11: 'December'
37976 };
37977 var date = new Date(this.props.bookmark.createdOn);
37978 var month = months[date.getMonth()];
37979 var day = date.getDate();
37980 var year = date.getFullYear();
37981
37982 return month + ' ' + day + ', ' + year;
37983 }
37984 }, {
37985 key: 'getWebsite',
37986 value: function getWebsite() {
37987 var bookmarkURL = this.props.bookmark.url;
37988
37989 var rootUrl = bookmarkURL;
37990 var name = _url2.default.parse(bookmarkURL).hostname;
37991
37992 return {
37993 name: name,
37994 url: rootUrl
37995 };
37996 }
37997 }, {
37998 key: 'render',
37999 value: function render() {
38000 return _react2.default.createElement(
38001 'li',
38002 null,
38003 _react2.default.createElement(
38004 'a',
38005 { href: this.props.bookmark.url, target: '_blank' },
38006 _react2.default.createElement(
38007 'h2',
38008 { className: 'bookmark-name' },
38009 (0, _lodash2.default)(this.props.bookmark.title)
38010 )
38011 ),
38012 _react2.default.createElement(
38013 'span',
38014 { className: 'date' },
38015 this.getTimeString()
38016 ),
38017 _react2.default.createElement(
38018 'a',
38019 { href: this.getWebsite().url, target: '_blank', className: 'website' },
38020 this.getWebsite().name
38021 ),
38022 _react2.default.createElement(
38023 'a',
38024 { href: '/api/destroy/' + this.props.bookmark.id, onClick: this.destroyBookmark.bind(this), className: 'destroy' },
38025 'destroy'
38026 )
38027 );
38028 }
38029 }]);
38030
38031 return Bookmark;
38032}(_react.Component);
38033
38034Bookmark.propTypes = {
38035 bookmark: _react.PropTypes.object.isRequired,
38036 dispatch: _react.PropTypes.func.isRequired
38037};
38038exports.default = Bookmark;
38039
38040},{"297":297,"334":334,"84":84}],340:[function(require,module,exports){
38041'use strict';
38042
38043var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
38044
38045Object.defineProperty(exports, "__esModule", {
38046 value: true
38047});
38048exports.Bookmarks = undefined;
38049
38050var _react = require(297);
38051
38052var _react2 = _interopRequireDefault(_react);
38053
38054var _reactRedux = require(100);
38055
38056var _reactRouter = require(136);
38057
38058var _bookmark = require(339);
38059
38060var _bookmark2 = _interopRequireDefault(_bookmark);
38061
38062var _actions = require(346);
38063
38064var _actionTypes = require(345);
38065
38066function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
38067
38068function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
38069
38070function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
38071
38072function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
38073
38074var Bookmarks = exports.Bookmarks = function (_Component) {
38075 _inherits(Bookmarks, _Component);
38076
38077 function Bookmarks() {
38078 _classCallCheck(this, Bookmarks);
38079
38080 return _possibleConstructorReturn(this, Object.getPrototypeOf(Bookmarks).apply(this, arguments));
38081 }
38082
38083 _createClass(Bookmarks, [{
38084 key: 'getMoreBookmarks',
38085 value: function getMoreBookmarks(evt) {
38086 var _this2 = this;
38087
38088 if (this.props.networkState !== _actionTypes.REQUEST_LOADING) {
38089 (function () {
38090 var action = undefined;
38091 var pageIncrementer = 0;
38092
38093 if (evt) {
38094 action = evt.target.getAttribute('data-hook');
38095
38096 if (action === 'previous' && _this2.props.page !== 1) {
38097 pageIncrementer = -1;
38098 } else if (action === 'next' && !_this2.props.endOfBookmarks) {
38099 pageIncrementer = 1;
38100 }
38101 }
38102
38103 _this2.props.dispatch((0, _actions.requestLoading)());
38104
38105 if (typeof window !== 'undefined') {
38106 window.app.socket.emit('get-bookmarks', {
38107 page: _this2.props.page + pageIncrementer
38108 });
38109
38110 window.app.socket.on('old-bookmarks', function (data) {
38111 _this2.props.dispatch((0, _actions.requestFinished)());
38112 _this2.props.dispatch((0, _actions.updateBookmarks)(data.bookmarks));
38113 _this2.props.dispatch((0, _actions.changePage)(_this2.props.page + pageIncrementer));
38114 _this2.props.dispatch((0, _actions.endOfBookmarks)(data.endOfBookmarks));
38115
38116 pageIncrementer = 0;
38117 });
38118 }
38119 })();
38120 }
38121 }
38122 }, {
38123 key: 'pagination',
38124 value: function pagination() {
38125 return _react2.default.createElement(
38126 'div',
38127 { className: 'pagination' },
38128 _react2.default.createElement(
38129 _reactRouter.Link,
38130 { to: this.props.page === 1 ? 'javascript:void(0)' : '/?page=' + (this.props.page - 1),
38131 className: this.props.page === 1 ? 'pagination__link disabled' : 'pagination__link',
38132 onClick: this.props.page === 1 ? function () {} : this.getMoreBookmarks,
38133 disabled: this.props.page === 1,
38134 'data-hook': 'previous'
38135 },
38136 '❮ Previous'
38137 ),
38138 _react2.default.createElement(
38139 _reactRouter.Link,
38140 { to: this.props.endOfBookmarks ? 'javascript:void(0)' : '/?page=' + (this.props.page + 1),
38141 className: this.props.endOfBookmarks ? 'pagination__link disabled' : 'pagination__link',
38142 onClick: this.props.endOfBookmarks ? function () {} : this.getMoreBookmarks,
38143 disabled: this.props.endOfBookmarks,
38144 'data-hook': 'next'
38145 },
38146 'Next ❯'
38147 )
38148 );
38149 }
38150 }, {
38151 key: 'componentDidUpdate',
38152 value: function componentDidUpdate() {
38153 document.documentElement.scrollTop = 0;
38154 document.body.scrollTop = 0;
38155 }
38156 }, {
38157 key: 'componentWillMount',
38158 value: function componentWillMount() {
38159 this.getMoreBookmarks();
38160 }
38161 }, {
38162 key: 'componentWillUnmount',
38163 value: function componentWillUnmount() {
38164 this.props.dispatch((0, _actions.changePage)(1));
38165 }
38166 }, {
38167 key: 'render',
38168 value: function render() {
38169 var _this3 = this;
38170
38171 if (typeof window !== 'undefined') {
38172 window.app.socket.on('new-bookmark', function (data) {
38173 _this3.props.dispatch((0, _actions.addBookmark)(data.bookmark));
38174 });
38175
38176 window.app.socket.on('bookmark-destroyed', function (data) {
38177 _this3.props.dispatch((0, _actions.destroyBookmark)(data.id));
38178 });
38179 }
38180
38181 if (this.props.bookmarks.length) {
38182 return _react2.default.createElement(
38183 'section',
38184 { className: 'bookmarks' },
38185 _react2.default.createElement(
38186 'ul',
38187 null,
38188 this.props.bookmarks.sort(function (a, b) {
38189 var dateA = new Date(a.createdOn);
38190 var dateB = new Date(b.createdOn);
38191
38192 if (dateA < dateB) {
38193 return 1;
38194 } else if (dateA > dateB) {
38195 return -1;
38196 } else {
38197 return 0;
38198 }
38199 }).map(function (bookmark) {
38200 return _react2.default.createElement(_bookmark2.default, { key: bookmark.id, bookmark: bookmark, dispatch: _this3.props.dispatch });
38201 })
38202 ),
38203 this.pagination()
38204 );
38205 } else {
38206 return _react2.default.createElement(
38207 'section',
38208 { className: 'bookmarks' },
38209 _react2.default.createElement(
38210 'h2',
38211 { className: 'h2' },
38212 'No bookmarks yet! Place the script in your bookmarks bar and start bookmarking.'
38213 )
38214 );
38215 }
38216 }
38217 }]);
38218
38219 return Bookmarks;
38220}(_react.Component);
38221
38222Bookmarks.propTypes = {
38223 bookmarks: _react.PropTypes.array.isRequired,
38224 dispatch: _react.PropTypes.func.isRequired,
38225 networkState: _react.PropTypes.string.isRequired,
38226 page: _react.PropTypes.number.isRequired,
38227 endOfBookmarks: _react.PropTypes.bool.isRequired
38228};
38229exports.default = (0, _reactRedux.connect)(function (state) {
38230 return {
38231 bookmarks: state.bookmarks,
38232 networkState: state.networkState,
38233 page: state.page,
38234 endOfBookmarks: state.endOfBookmarks
38235 };
38236})(Bookmarks);
38237
38238},{"100":100,"136":136,"297":297,"339":339,"345":345,"346":346}],341:[function(require,module,exports){
38239'use strict';
38240
38241Object.defineProperty(exports, "__esModule", {
38242 value: true
38243});
38244
38245var _react = require(297);
38246
38247var _react2 = _interopRequireDefault(_react);
38248
38249var _snippet = require(348);
38250
38251var _snippet2 = _interopRequireDefault(_snippet);
38252
38253function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
38254
38255exports.default = function () {
38256 return _react2.default.createElement(
38257 'div',
38258 { className: 'colophon' },
38259 _react2.default.createElement(
38260 'h2',
38261 { className: 'h2' },
38262 'Colophon'
38263 ),
38264 _react2.default.createElement(
38265 'p',
38266 null,
38267 'bkmrkd was created by ',
38268 _react2.default.createElement(
38269 'a',
38270 { href: 'https://github.com/mike-engel' },
38271 'Mike Engel'
38272 ),
38273 ' as an experiment in creating a service tied to a bookmarklet. Since then it\'s been rewritten in ',
38274 _react2.default.createElement(
38275 'a',
38276 { href: 'https://nodejs.org' },
38277 'Node'
38278 ),
38279 ' and ',
38280 _react2.default.createElement(
38281 'a',
38282 { href: 'https://facebook.github.io/react/index.html' },
38283 'React'
38284 ),
38285 '. It\'s used as a playground for new web dev techniques such as isomorphic rendering, service worker, etc.'
38286 ),
38287 _react2.default.createElement(
38288 'p',
38289 null,
38290 'To add bookmarks here, simply drag this ',
38291 _react2.default.createElement(
38292 'a',
38293 { href: _snippet2.default },
38294 'bookmarklet'
38295 ),
38296 ' to your bookmarks bar (or favorites bar or whatever) and click it when you\'re on a page you want to bookmark.'
38297 ),
38298 _react2.default.createElement(
38299 'p',
38300 null,
38301 'You can view the code on ',
38302 _react2.default.createElement(
38303 'a',
38304 { href: 'https://github.com/mike-engel/bkmrkd' },
38305 'Github'
38306 ),
38307 ', and file ',
38308 _react2.default.createElement(
38309 'a',
38310 { href: 'https://github.com/mike-engel/bkmrkd/issues' },
38311 'issues'
38312 ),
38313 ' there too.'
38314 )
38315 );
38316};
38317
38318},{"297":297,"348":348}],342:[function(require,module,exports){
38319'use strict';
38320
38321var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
38322
38323Object.defineProperty(exports, "__esModule", {
38324 value: true
38325});
38326exports.Search = undefined;
38327
38328var _react = require(297);
38329
38330var _react2 = _interopRequireDefault(_react);
38331
38332var _reactRedux = require(100);
38333
38334var _bookmark = require(339);
38335
38336var _bookmark2 = _interopRequireDefault(_bookmark);
38337
38338var _actions = require(346);
38339
38340function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
38341
38342function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
38343
38344function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
38345
38346function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
38347
38348var Search = exports.Search = function (_Component) {
38349 _inherits(Search, _Component);
38350
38351 function Search() {
38352 _classCallCheck(this, Search);
38353
38354 return _possibleConstructorReturn(this, Object.getPrototypeOf(Search).apply(this, arguments));
38355 }
38356
38357 _createClass(Search, [{
38358 key: 'componentWillMount',
38359 value: function componentWillMount() {
38360 var _this2 = this;
38361
38362 if (typeof window !== 'undefined') {
38363 this.props.dispatch((0, _actions.requestLoading)());
38364
38365 window.app.socket.emit('search', {
38366 term: this.props.searchTerm
38367 });
38368
38369 window.app.socket.on('search-results', function (data) {
38370 _this2.props.dispatch((0, _actions.requestFinished)());
38371
38372 _this2.props.dispatch((0, _actions.updateBookmarks)(data.bookmarks));
38373 });
38374 }
38375 }
38376 }, {
38377 key: 'render',
38378 value: function render() {
38379 var _this3 = this;
38380
38381 if (this.props.bookmarks.length) {
38382 return _react2.default.createElement(
38383 'section',
38384 { className: 'bookmarks search-results' },
38385 _react2.default.createElement(
38386 'ul',
38387 null,
38388 this.props.bookmarks.sort(function (a, b) {
38389 var dateA = new Date(a.createdOn);
38390 var dateB = new Date(b.createdOn);
38391
38392 if (dateA < dateB) {
38393 return 1;
38394 } else if (dateA > dateB) {
38395 return -1;
38396 } else {
38397 return 0;
38398 }
38399 }).map(function (bookmark) {
38400 return _react2.default.createElement(_bookmark2.default, { key: bookmark.id, bookmark: bookmark, dispatch: _this3.props.dispatch });
38401 })
38402 )
38403 );
38404 } else {
38405 return _react2.default.createElement(
38406 'section',
38407 { className: 'bookmarks search-results' },
38408 _react2.default.createElement(
38409 'h2',
38410 { className: 'h2' },
38411 'Couldn\'t find anything for ',
38412 this.props.searchTerm,
38413 '.'
38414 )
38415 );
38416 }
38417 }
38418 }]);
38419
38420 return Search;
38421}(_react.Component);
38422
38423Search.propTypes = {
38424 bookmarks: _react.PropTypes.array.isRequired,
38425 dispatch: _react.PropTypes.func.isRequired,
38426 networkState: _react.PropTypes.string.isRequired,
38427 searchTerm: _react.PropTypes.string.isRequired
38428};
38429exports.default = (0, _reactRedux.connect)(function (state) {
38430 return {
38431 bookmarks: state.bookmarks,
38432 networkState: state.networkState,
38433 searchTerm: state.searchTerm
38434 };
38435})(Search);
38436
38437},{"100":100,"297":297,"339":339,"346":346}],343:[function(require,module,exports){
38438'use strict';
38439
38440var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
38441
38442Object.defineProperty(exports, "__esModule", {
38443 value: true
38444});
38445exports.SearchForm = undefined;
38446
38447var _react = require(297);
38448
38449var _react2 = _interopRequireDefault(_react);
38450
38451var _actions = require(346);
38452
38453function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
38454
38455function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
38456
38457function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
38458
38459function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
38460
38461var SearchForm = exports.SearchForm = function (_Component) {
38462 _inherits(SearchForm, _Component);
38463
38464 function SearchForm() {
38465 _classCallCheck(this, SearchForm);
38466
38467 return _possibleConstructorReturn(this, Object.getPrototypeOf(SearchForm).apply(this, arguments));
38468 }
38469
38470 _createClass(SearchForm, [{
38471 key: 'handleSubmit',
38472 value: function handleSubmit(evt) {
38473 evt.preventDefault();
38474
38475 var term = evt.target.querySelector('#search-term').value;
38476
38477 this.props.dispatch((0, _actions.setSearchTerm)(term));
38478
38479 this.props.history.push('/search?term=' + term);
38480 }
38481 }, {
38482 key: 'render',
38483 value: function render() {
38484 return _react2.default.createElement(
38485 'form',
38486 { className: 'form search-form',
38487 action: 'search',
38488 method: 'GET',
38489 role: 'form',
38490 onSubmit: this.handleSubmit.bind(this)
38491 },
38492 _react2.default.createElement(
38493 'label',
38494 { htmlFor: 'search-term' },
38495 'Search'
38496 ),
38497 _react2.default.createElement('input', { type: 'search', name: 'term', id: 'search-term', placeholder: this.props.searchTerm || 'search' })
38498 );
38499 }
38500 }]);
38501
38502 return SearchForm;
38503}(_react.Component);
38504
38505SearchForm.propTypes = {
38506 dispatch: _react.PropTypes.func.isRequired,
38507 history: _react.PropTypes.object.isRequired,
38508 searchTerm: _react.PropTypes.string
38509};
38510
38511},{"297":297,"346":346}],344:[function(require,module,exports){
38512'use strict';
38513
38514Object.defineProperty(exports, "__esModule", {
38515 value: true
38516});
38517exports.Bkmrkd = Bkmrkd;
38518
38519var _react = require(297);
38520
38521var _react2 = _interopRequireDefault(_react);
38522
38523var _reactRouter = require(136);
38524
38525var _reactRedux = require(100);
38526
38527var _searchForm = require(343);
38528
38529var _snippet = require(348);
38530
38531var _snippet2 = _interopRequireDefault(_snippet);
38532
38533function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
38534
38535function Bkmrkd(props) {
38536 return _react2.default.createElement(
38537 'div',
38538 { className: 'app container' },
38539 _react2.default.createElement(
38540 'header',
38541 { className: 'main-nav' },
38542 _react2.default.createElement(
38543 'h1',
38544 { className: 'h1' },
38545 'bkmrkd'
38546 ),
38547 _react2.default.createElement(_searchForm.SearchForm, { dispatch: props.dispatch,
38548 history: props.history,
38549 searchTerm: props.searchTerm
38550 }),
38551 _react2.default.createElement(
38552 'nav',
38553 null,
38554 _react2.default.createElement(
38555 'ul',
38556 null,
38557 _react2.default.createElement(
38558 'li',
38559 null,
38560 _react2.default.createElement(
38561 _reactRouter.IndexLink,
38562 { to: '/', activeClassName: 'active' },
38563 'bkmrkd'
38564 )
38565 ),
38566 _react2.default.createElement(
38567 'li',
38568 null,
38569 _react2.default.createElement(
38570 _reactRouter.Link,
38571 { to: '/colophon', activeClassName: 'active' },
38572 'colophon'
38573 )
38574 ),
38575 _react2.default.createElement(
38576 'li',
38577 null,
38578 _react2.default.createElement(
38579 _reactRouter.Link,
38580 { to: _snippet2.default },
38581 'bookmarklet'
38582 )
38583 )
38584 )
38585 )
38586 ),
38587 props.children
38588 );
38589}
38590
38591Bkmrkd.propTypes = {
38592 children: _react.PropTypes.node,
38593 dispatch: _react.PropTypes.func.isRequired,
38594 history: _react.PropTypes.object.isRequired,
38595 searchTerm: _react.PropTypes.string
38596};
38597
38598exports.default = (0, _reactRedux.connect)(function (state) {
38599 return {
38600 dispatch: state.dispatch,
38601 searchTerm: state.searchTerm
38602 };
38603})(Bkmrkd);
38604
38605},{"100":100,"136":136,"297":297,"343":343,"348":348}],345:[function(require,module,exports){
38606'use strict';
38607
38608Object.defineProperty(exports, "__esModule", {
38609 value: true
38610});
38611var ADD_BOOKMARK = exports.ADD_BOOKMARK = 'ADD_BOOKMARK';
38612var ADD_TOAST = exports.ADD_TOAST = 'ADD_TOAST';
38613var CHANGE_PAGE = exports.CHANGE_PAGE = 'CHANGE_PAGE';
38614var DESTROY_BOOKMARK = exports.DESTROY_BOOKMARK = 'DESTROY_BOOKMARK';
38615var END_OF_BOOKMARKS = exports.END_OF_BOOKMARKS = 'END_OF_BOOKMARKS';
38616var REQUEST_LOADING = exports.REQUEST_LOADING = 'REQUEST_LOADING';
38617var REQUEST_FINISHED = exports.REQUEST_FINISHED = 'REQUEST_FINISHED';
38618var SEARCH_TERM = exports.SEARCH_TERM = 'SEARCH_TERM';
38619var UPDATE_BOOKMARKS = exports.UPDATE_BOOKMARKS = 'UPDATE_BOOKMARKS';
38620
38621},{}],346:[function(require,module,exports){
38622'use strict';
38623
38624Object.defineProperty(exports, "__esModule", {
38625 value: true
38626});
38627exports.addBookmark = addBookmark;
38628exports.addToast = addToast;
38629exports.changePage = changePage;
38630exports.destroyBookmark = destroyBookmark;
38631exports.endOfBookmarks = endOfBookmarks;
38632exports.requestLoading = requestLoading;
38633exports.requestFinished = requestFinished;
38634exports.updateBookmarks = updateBookmarks;
38635exports.setSearchTerm = setSearchTerm;
38636
38637var _actionTypes = require(345);
38638
38639function addBookmark(bookmark) {
38640 return {
38641 type: _actionTypes.ADD_BOOKMARK,
38642 bookmark: bookmark
38643 };
38644}
38645
38646function addToast(_ref) {
38647 var message = _ref.message;
38648 var style = _ref.style;
38649
38650 return {
38651 type: _actionTypes.ADD_TOAST,
38652 message: message,
38653 style: style
38654 };
38655}
38656
38657function changePage(page) {
38658 return {
38659 type: _actionTypes.CHANGE_PAGE,
38660 page: page
38661 };
38662}
38663
38664function destroyBookmark(bookmarkID) {
38665 return {
38666 type: _actionTypes.DESTROY_BOOKMARK,
38667 bookmarkID: bookmarkID
38668 };
38669}
38670
38671function endOfBookmarks(end) {
38672 return {
38673 type: _actionTypes.END_OF_BOOKMARKS,
38674 end: end
38675 };
38676}
38677
38678function requestLoading() {
38679 return {
38680 type: _actionTypes.REQUEST_LOADING
38681 };
38682}
38683
38684function requestFinished() {
38685 return {
38686 type: _actionTypes.REQUEST_FINISHED
38687 };
38688}
38689
38690function updateBookmarks(bookmarks) {
38691 return {
38692 type: _actionTypes.UPDATE_BOOKMARKS,
38693 bookmarks: bookmarks
38694 };
38695}
38696
38697function setSearchTerm(term) {
38698 return {
38699 type: _actionTypes.SEARCH_TERM,
38700 term: term
38701 };
38702}
38703
38704},{"345":345}],347:[function(require,module,exports){
38705'use strict';
38706
38707Object.defineProperty(exports, "__esModule", {
38708 value: true
38709});
38710exports.bookmarks = bookmarks;
38711exports.endOfBookmarks = endOfBookmarks;
38712exports.networkState = networkState;
38713exports.page = page;
38714exports.searchTerm = searchTerm;
38715exports.toaster = toaster;
38716
38717var _actionTypes = require(345);
38718
38719function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }
38720
38721function bookmarks() {
38722 var state = arguments.length <= 0 || arguments[0] === undefined ? [] : arguments[0];
38723 var action = arguments[1];
38724
38725 switch (action.type) {
38726 case _actionTypes.ADD_BOOKMARK:
38727 return [action.bookmark].concat(_toConsumableArray(state));
38728 case _actionTypes.UPDATE_BOOKMARKS:
38729 return action.bookmarks;
38730 case _actionTypes.DESTROY_BOOKMARK:
38731 var bookmarkIdx = -1;
38732
38733 state.forEach(function (bookmark, idx) {
38734 if (bookmark.id === action.bookmarkID) {
38735 bookmarkIdx = idx;
38736 }
38737 });
38738
38739 if (bookmarkIdx === -1) {
38740 return state;
38741 }
38742
38743 return [].concat(_toConsumableArray(state.slice(0, bookmarkIdx)), _toConsumableArray(state.slice(bookmarkIdx + 1)));
38744 default:
38745 return state;
38746 }
38747}
38748
38749function endOfBookmarks() {
38750 var state = arguments.length <= 0 || arguments[0] === undefined ? false : arguments[0];
38751 var action = arguments[1];
38752
38753 switch (action.type) {
38754 case _actionTypes.END_OF_BOOKMARKS:
38755 return action.end;
38756 default:
38757 return state;
38758 }
38759}
38760
38761function networkState() {
38762 var state = arguments.length <= 0 || arguments[0] === undefined ? '' : arguments[0];
38763 var action = arguments[1];
38764
38765 switch (action.type) {
38766 case _actionTypes.REQUEST_LOADING:
38767 return _actionTypes.REQUEST_LOADING;
38768 case _actionTypes.REQUEST_FINISHED:
38769 return '';
38770 default:
38771 return state;
38772 }
38773}
38774
38775function page() {
38776 var state = arguments.length <= 0 || arguments[0] === undefined ? 1 : arguments[0];
38777 var action = arguments[1];
38778
38779 switch (action.type) {
38780 case _actionTypes.CHANGE_PAGE:
38781 return action.page;
38782 default:
38783 return state;
38784 }
38785}
38786
38787function searchTerm() {
38788 var state = arguments.length <= 0 || arguments[0] === undefined ? '' : arguments[0];
38789 var action = arguments[1];
38790
38791 switch (action.type) {
38792 case _actionTypes.SEARCH_TERM:
38793 return action.term;
38794 default:
38795 return state;
38796 }
38797}
38798
38799function toaster() {
38800 var state = arguments.length <= 0 || arguments[0] === undefined ? [] : arguments[0];
38801 var action = arguments[1];
38802
38803 switch (action.type) {
38804 case _actionTypes.ADD_TOAST:
38805 return [].concat(_toConsumableArray(state), [{
38806 style: action.style,
38807 message: action.message
38808 }]);
38809 default:
38810 return state;
38811 }
38812}
38813
38814},{"345":345}],348:[function(require,module,exports){
38815(function (process){
38816'use strict';
38817
38818Object.defineProperty(exports, "__esModule", {
38819 value: true
38820});
38821
38822var _config = require(2);
38823
38824var _config2 = _interopRequireDefault(_config);
38825
38826function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
38827
38828var env = process.env.NODE_ENV || 'development';
38829var snippetURL = 'javascript:function bkmrk(){var a=document.createElement("script"),b=window.location,c=document.title,d="' + (typeof window !== 'undefined' ? window.location.origin : _config2.default[env].snippetHost) + '/api/create?title="+c+"&url="+encodeURIComponent(b.href);try{/https/i.test(b.protocol)?window.open(d+"&action=close","_blank","width=100,height=100"):(document.title="Bookmarking "+c,a.setAttribute("src",d),a.setAttribute("async",""),document.body.appendChild(a),document.title=c)}catch(e){alert("Please wait until the page has loaded.")}}bkmrk();void 0;';
38830
38831exports.default = snippetURL;
38832
38833}).call(this,require(91))
38834},{"2":2,"91":91}],349:[function(require,module,exports){
38835'use strict';
38836
38837Object.defineProperty(exports, "__esModule", {
38838 value: true
38839});
38840
38841var _react = require(297);
38842
38843var _react2 = _interopRequireDefault(_react);
38844
38845var _reactDom = require(97);
38846
38847var _reactRedux = require(100);
38848
38849var _reactRouter = require(136);
38850
38851var _redux = require(316);
38852
38853var _reduxRouter = require(303);
38854
38855var _reducers = require(347);
38856
38857var _history = require(72);
38858
38859var _socket = require(321);
38860
38861var _socket2 = _interopRequireDefault(_socket);
38862
38863var _bkmrkd = require(344);
38864
38865var _bkmrkd2 = _interopRequireDefault(_bkmrkd);
38866
38867var _colophon = require(341);
38868
38869var _colophon2 = _interopRequireDefault(_colophon);
38870
38871var _bookmarks = require(340);
38872
38873var _bookmarks2 = _interopRequireDefault(_bookmarks);
38874
38875var _actions = require(346);
38876
38877var _search = require(342);
38878
38879var _search2 = _interopRequireDefault(_search);
38880
38881function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
38882
38883var routes = _react2.default.createElement(
38884 _reactRouter.Route,
38885 { path: '/', component: _bkmrkd2.default },
38886 _react2.default.createElement(_reactRouter.IndexRoute, { component: _bookmarks2.default }),
38887 _react2.default.createElement(_reactRouter.Route, { path: '/colophon', component: _colophon2.default }),
38888 _react2.default.createElement(_reactRouter.Route, { path: '/search', component: _search2.default })
38889);
38890
38891if (typeof window !== 'undefined') {
38892 (function () {
38893 window.app.socket = _socket2.default.connect(window.location.protocol + '//' + window.location.host);
38894
38895 window.app.__initialState = window.app.__initialState || {
38896 bookmarks: [],
38897 networkState: '',
38898 toaster: [],
38899 page: 1,
38900 endOfBookmarks: false,
38901 searchTerm: ''
38902 };
38903
38904 var reducer = (0, _redux.combineReducers)({
38905 router: _reduxRouter.routerStateReducer,
38906 bookmarks: _reducers.bookmarks,
38907 networkState: _reducers.networkState,
38908 toaster: _reducers.toaster,
38909 page: _reducers.page,
38910 endOfBookmarks: _reducers.endOfBookmarks,
38911 searchTerm: _reducers.searchTerm
38912 });
38913 var store = (0, _redux.compose)((0, _reduxRouter.reduxReactRouter)({
38914 routes: routes,
38915 createHistory: _history.createHistory
38916 }))(_redux.createStore)(reducer, window.app.__initialState);
38917
38918 window.app.socket.on('connect_error', function () {
38919 store.dispatch((0, _actions.addToast)({
38920 message: 'bkmrkd couldn\'nt connect to the server. You won\'t receive updates. You can try refreshing the page.',
38921 style: 'error'
38922 }));
38923 });
38924
38925 window.app.socket.on('connect_timeout', function () {
38926 store.dispatch((0, _actions.addToast)({
38927 message: 'bkmrkd couldn\'nt connect to the server. You won\'t receive updates. You can try refreshing the page.',
38928 style: 'error'
38929 }));
38930 });
38931
38932 window.app.socket.on('reconnecting', function () {
38933 store.dispatch((0, _actions.addToast)({
38934 message: 'Trying to reconnect to the bkrmrkd server...',
38935 style: 'warning'
38936 }));
38937 });
38938
38939 window.app.socket.on('reconnect', function () {
38940 store.dispatch((0, _actions.addToast)({
38941 message: 'Reconnected to the bkmrkd server',
38942 style: 'success'
38943 }));
38944 });
38945
38946 window.app.socket.on('reconnect_error', function () {
38947 store.dispatch((0, _actions.addToast)({
38948 message: 'bkmrkd couldn\'nt connect to the server. You won\'t receive updates. You can try refreshing the page.',
38949 style: 'error'
38950 }));
38951 });
38952
38953 window.app.socket.on('reconnect_failed', function () {
38954 store.dispatch((0, _actions.addToast)({
38955 message: 'bkmrkd couldn\'nt connect to the server. You won\'t receive updates. You can try refreshing the page.',
38956 style: 'error'
38957 }));
38958 });
38959
38960 window.app.socket.on('error', function (data) {
38961 store.dispatch((0, _actions.addToast)({
38962 message: 'Socket error: ' + data.message,
38963 style: 'error'
38964 }));
38965 });
38966
38967 (0, _reactDom.render)(_react2.default.createElement(
38968 _reactRedux.Provider,
38969 { store: store },
38970 _react2.default.createElement(
38971 _reactRouter.Router,
38972 { history: _reactRouter.browserHistory },
38973 routes
38974 )
38975 ), document.body.querySelector('[data-hook="app"]'));
38976 })();
38977}
38978
38979exports.default = routes;
38980
38981},{"100":100,"136":136,"297":297,"303":303,"316":316,"321":321,"340":340,"341":341,"342":342,"344":344,"346":346,"347":347,"72":72,"97":97}]},{},[349])(349)
38982});
38983//# sourceMappingURL=main.js.map