@samitouri / QOS-React / commits / cf24d87177

[site] Load libraries from unpkg (#9499)

* [site] Load libraries from unpkg * Revert Gemfile changes

Daniel Lo Nigro committed Apr 26, 2017 at 06:02 UTC cf24d871777ca97bd62068075cbb39582067ac4d
12 files changed +12 -32192
docs/_layouts/default.html
+11 -11
@@ -35,18 +35,18 @@
35 <script>try{Typekit.load();}catch(e){}</script>
36
37 <!--[if lte IE 8]>
38 - <script src="/react/js/html5shiv.min.js"></script>
39 - <script src="/react/js/es5-shim.min.js"></script>
40 - <script src="/react/js/es5-sham.min.js"></script>
38 + <script src="https://unpkg.com/html5shiv@3.7.3/dist/html5shiv.min.js"></script>
39 + <script src="https://unpkg.com/es5-shim@4.5.9/es5-shim.min.js"></script>
40 + <script src="https://unpkg.com/es5-shim@4.5.9/es5-sham.min.js"></script>
41 <![endif]-->
42 - <script type="text/javascript" src="https://cdn.jsdelivr.net/docsearch.js/1/docsearch.min.js"></script>
43 - <script src="/react/js/codemirror.js"></script>
44 - <script src="/react/js/javascript.js"></script>
45 - <script src="/react/js/xml.js"></script>
46 - <script src="/react/js/jsx.js"></script>
47 - <script src="/react/js/react.js"></script>
48 - <script src="/react/js/react-dom.js"></script>
49 - <script src="/react/js/babel.min.js"></script>
42 + <script src="https://unpkg.com/docsearch.js@1.5.0/dist/cdn/docsearch.min.js"></script>
43 + <script src="https://unpkg.com/codemirror@5.15.2"></script>
44 + <script src="https://unpkg.com/codemirror@5.15.2/mode/javascript/javascript.js"></script>
45 + <script src="https://unpkg.com/codemirror@5.15.2/mode/xml/xml.js"></script>
46 + <script src="https://unpkg.com/codemirror@5.15.2/mode/jsx/jsx.js"></script>
47 + <script src="https://unpkg.com/react/dist/react.min.js"></script>
48 + <script src="https://unpkg.com/react-dom/dist/react-dom.min.js"></script>
49 + <script src="https://unpkg.com/babel-standalone@6.15.0/babel.min.js"></script>
50 <script src="/react/js/live_editor.js"></script>
51 </head>
52 <body>
docs/index.md
+1 -1
@@ -72,7 +72,7 @@ id: home
72 <div id="markdownExample"></div>
73 </div>
74 </div>
75 - <script src="/react/js/remarkable.min.js"></script>
75 + <script src="https://unpkg.com/remarkable@1.7.1/dist/remarkable.min.js"></script>
76 <script src="/react/js/examples/hello.js"></script>
77 <script src="/react/js/examples/timer.js"></script>
78 <script src="/react/js/examples/todo.js"></script>
docs/js/codemirror.js deleted
-8902
@@ -1,8902 +0,0 @@
1 -// CodeMirror, copyright (c) by Marijn Haverbeke and others
2 -// Distributed under an MIT license: http://codemirror.net/LICENSE
3 -
4 -// This is CodeMirror (http://codemirror.net), a code editor
5 -// implemented in JavaScript on top of the browser's DOM.
6 -//
7 -// You can find some technical background for some of the code below
8 -// at http://marijnhaverbeke.nl/blog/#cm-internals .
9 -
10 -// CodeMirror is the only global var we claim
11 -window.CodeMirror = (function() {
12 - "use strict";
13 -
14 - // BROWSER SNIFFING
15 -
16 - // Kludges for bugs and behavior differences that can't be feature
17 - // detected are enabled based on userAgent etc sniffing.
18 - var userAgent = navigator.userAgent;
19 - var platform = navigator.platform;
20 -
21 - var gecko = /gecko\/\d/i.test(userAgent);
22 - var ie_upto10 = /MSIE \d/.test(userAgent);
23 - var ie_11up = /Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(userAgent);
24 - var ie = ie_upto10 || ie_11up;
25 - var ie_version = ie && (ie_upto10 ? document.documentMode || 6 : ie_11up[1]);
26 - var webkit = /WebKit\//.test(userAgent);
27 - var qtwebkit = webkit && /Qt\/\d+\.\d+/.test(userAgent);
28 - var chrome = /Chrome\//.test(userAgent);
29 - var presto = /Opera\//.test(userAgent);
30 - var safari = /Apple Computer/.test(navigator.vendor);
31 - var mac_geMountainLion = /Mac OS X 1\d\D([8-9]|\d\d)\D/.test(userAgent);
32 - var phantom = /PhantomJS/.test(userAgent);
33 -
34 - var ios = /AppleWebKit/.test(userAgent) && /Mobile\/\w+/.test(userAgent);
35 - // This is woefully incomplete. Suggestions for alternative methods welcome.
36 - var mobile = ios || /Android|webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(userAgent);
37 - var mac = ios || /Mac/.test(platform);
38 - var chromeOS = /\bCrOS\b/.test(userAgent);
39 - var windows = /win/i.test(platform);
40 -
41 - var presto_version = presto && userAgent.match(/Version\/(\d*\.\d*)/);
42 - if (presto_version) presto_version = Number(presto_version[1]);
43 - if (presto_version && presto_version >= 15) { presto = false; webkit = true; }
44 - // Some browsers use the wrong event properties to signal cmd/ctrl on OS X
45 - var flipCtrlCmd = mac && (qtwebkit || presto && (presto_version == null || presto_version < 12.11));
46 - var captureRightClick = gecko || (ie && ie_version >= 9);
47 -
48 - // Optimize some code when these features are not used.
49 - var sawReadOnlySpans = false, sawCollapsedSpans = false;
50 -
51 - // EDITOR CONSTRUCTOR
52 -
53 - // A CodeMirror instance represents an editor. This is the object
54 - // that user code is usually dealing with.
55 -
56 - function CodeMirror(place, options) {
57 - if (!(this instanceof CodeMirror)) return new CodeMirror(place, options);
58 -
59 - this.options = options = options ? copyObj(options) : {};
60 - // Determine effective options based on given values and defaults.
61 - copyObj(defaults, options, false);
62 - setGuttersForLineNumbers(options);
63 -
64 - var doc = options.value;
65 - if (typeof doc == "string") doc = new Doc(doc, options.mode, null, options.lineSeparator);
66 - this.doc = doc;
67 -
68 - var input = new CodeMirror.inputStyles[options.inputStyle](this);
69 - var display = this.display = new Display(place, doc, input);
70 - display.wrapper.CodeMirror = this;
71 - updateGutters(this);
72 - themeChanged(this);
73 - if (options.lineWrapping)
74 - this.display.wrapper.className += " CodeMirror-wrap";
75 - if (options.autofocus && !mobile) display.input.focus();
76 - initScrollbars(this);
77 -
78 - this.state = {
79 - keyMaps: [], // stores maps added by addKeyMap
80 - overlays: [], // highlighting overlays, as added by addOverlay
81 - modeGen: 0, // bumped when mode/overlay changes, used to invalidate highlighting info
82 - overwrite: false,
83 - delayingBlurEvent: false,
84 - focused: false,
85 - suppressEdits: false, // used to disable editing during key handlers when in readOnly mode
86 - pasteIncoming: false, cutIncoming: false, // help recognize paste/cut edits in input.poll
87 - selectingText: false,
88 - draggingText: false,
89 - highlight: new Delayed(), // stores highlight worker timeout
90 - keySeq: null, // Unfinished key sequence
91 - specialChars: null
92 - };
93 -
94 - var cm = this;
95 -
96 - // Override magic textarea content restore that IE sometimes does
97 - // on our hidden textarea on reload
98 - if (ie && ie_version < 11) setTimeout(function() { cm.display.input.reset(true); }, 20);
99 -
100 - registerEventHandlers(this);
101 - ensureGlobalHandlers();
102 -
103 - startOperation(this);
104 - this.curOp.forceUpdate = true;
105 - attachDoc(this, doc);
106 -
107 - if ((options.autofocus && !mobile) || cm.hasFocus())
108 - setTimeout(bind(onFocus, this), 20);
109 - else
110 - onBlur(this);
111 -
112 - for (var opt in optionHandlers) if (optionHandlers.hasOwnProperty(opt))
113 - optionHandlers[opt](this, options[opt], Init);
114 - maybeUpdateLineNumberWidth(this);
115 - if (options.finishInit) options.finishInit(this);
116 - for (var i = 0; i < initHooks.length; ++i) initHooks[i](this);
117 - endOperation(this);
118 - // Suppress optimizelegibility in Webkit, since it breaks text
119 - // measuring on line wrapping boundaries.
120 - if (webkit && options.lineWrapping &&
121 - getComputedStyle(display.lineDiv).textRendering == "optimizelegibility")
122 - display.lineDiv.style.textRendering = "auto";
123 - }
124 -
125 - // DISPLAY CONSTRUCTOR
126 -
127 - // The display handles the DOM integration, both for input reading
128 - // and content drawing. It holds references to DOM nodes and
129 - // display-related state.
130 -
131 - function Display(place, doc, input) {
132 - var d = this;
133 - this.input = input;
134 -
135 - // Covers bottom-right square when both scrollbars are present.
136 - d.scrollbarFiller = elt("div", null, "CodeMirror-scrollbar-filler");
137 - d.scrollbarFiller.setAttribute("cm-not-content", "true");
138 - // Covers bottom of gutter when coverGutterNextToScrollbar is on
139 - // and h scrollbar is present.
140 - d.gutterFiller = elt("div", null, "CodeMirror-gutter-filler");
141 - d.gutterFiller.setAttribute("cm-not-content", "true");
142 - // Will contain the actual code, positioned to cover the viewport.
143 - d.lineDiv = elt("div", null, "CodeMirror-code");
144 - // Elements are added to these to represent selection and cursors.
145 - d.selectionDiv = elt("div", null, null, "position: relative; z-index: 1");
146 - d.cursorDiv = elt("div", null, "CodeMirror-cursors");
147 - // A visibility: hidden element used to find the size of things.
148 - d.measure = elt("div", null, "CodeMirror-measure");
149 - // When lines outside of the viewport are measured, they are drawn in this.
150 - d.lineMeasure = elt("div", null, "CodeMirror-measure");
151 - // Wraps everything that needs to exist inside the vertically-padded coordinate system
152 - d.lineSpace = elt("div", [d.measure, d.lineMeasure, d.selectionDiv, d.cursorDiv, d.lineDiv],
153 - null, "position: relative; outline: none");
154 - // Moved around its parent to cover visible view.
155 - d.mover = elt("div", [elt("div", [d.lineSpace], "CodeMirror-lines")], null, "position: relative");
156 - // Set to the height of the document, allowing scrolling.
157 - d.sizer = elt("div", [d.mover], "CodeMirror-sizer");
158 - d.sizerWidth = null;
159 - // Behavior of elts with overflow: auto and padding is
160 - // inconsistent across browsers. This is used to ensure the
161 - // scrollable area is big enough.
162 - d.heightForcer = elt("div", null, null, "position: absolute; height: " + scrollerGap + "px; width: 1px;");
163 - // Will contain the gutters, if any.
164 - d.gutters = elt("div", null, "CodeMirror-gutters");
165 - d.lineGutter = null;
166 - // Actual scrollable element.
167 - d.scroller = elt("div", [d.sizer, d.heightForcer, d.gutters], "CodeMirror-scroll");
168 - d.scroller.setAttribute("tabIndex", "-1");
169 - // The element in which the editor lives.
170 - d.wrapper = elt("div", [d.scrollbarFiller, d.gutterFiller, d.scroller], "CodeMirror");
171 -
172 - // Work around IE7 z-index bug (not perfect, hence IE7 not really being supported)
173 - if (ie && ie_version < 8) { d.gutters.style.zIndex = -1; d.scroller.style.paddingRight = 0; }
174 - if (!webkit && !(gecko && mobile)) d.scroller.draggable = true;
175 -
176 - if (place) {
177 - if (place.appendChild) place.appendChild(d.wrapper);
178 - else place(d.wrapper);
179 - }
180 -
181 - // Current rendered range (may be bigger than the view window).
182 - d.viewFrom = d.viewTo = doc.first;
183 - d.reportedViewFrom = d.reportedViewTo = doc.first;
184 - // Information about the rendered lines.
185 - d.view = [];
186 - d.renderedView = null;
187 - // Holds info about a single rendered line when it was rendered
188 - // for measurement, while not in view.
189 - d.externalMeasured = null;
190 - // Empty space (in pixels) above the view
191 - d.viewOffset = 0;
192 - d.lastWrapHeight = d.lastWrapWidth = 0;
193 - d.updateLineNumbers = null;
194 -
195 - d.nativeBarWidth = d.barHeight = d.barWidth = 0;
196 - d.scrollbarsClipped = false;
197 -
198 - // Used to only resize the line number gutter when necessary (when
199 - // the amount of lines crosses a boundary that makes its width change)
200 - d.lineNumWidth = d.lineNumInnerWidth = d.lineNumChars = null;
201 - // Set to true when a non-horizontal-scrolling line widget is
202 - // added. As an optimization, line widget aligning is skipped when
203 - // this is false.
204 - d.alignWidgets = false;
205 -
206 - d.cachedCharWidth = d.cachedTextHeight = d.cachedPaddingH = null;
207 -
208 - // Tracks the maximum line length so that the horizontal scrollbar
209 - // can be kept static when scrolling.
210 - d.maxLine = null;
211 - d.maxLineLength = 0;
212 - d.maxLineChanged = false;
213 -
214 - // Used for measuring wheel scrolling granularity
215 - d.wheelDX = d.wheelDY = d.wheelStartX = d.wheelStartY = null;
216 -
217 - // True when shift is held down.
218 - d.shift = false;
219 -
220 - // Used to track whether anything happened since the context menu
221 - // was opened.
222 - d.selForContextMenu = null;
223 -
224 - d.activeTouch = null;
225 -
226 - input.init(d);
227 - }
228 -
229 - // STATE UPDATES
230 -
231 - // Used to get the editor into a consistent state again when options change.
232 -
233 - function loadMode(cm) {
234 - cm.doc.mode = CodeMirror.getMode(cm.options, cm.doc.modeOption);
235 - resetModeState(cm);
236 - }
237 -
238 - function resetModeState(cm) {
239 - cm.doc.iter(function(line) {
240 - if (line.stateAfter) line.stateAfter = null;
241 - if (line.styles) line.styles = null;
242 - });
243 - cm.doc.frontier = cm.doc.first;
244 - startWorker(cm, 100);
245 - cm.state.modeGen++;
246 - if (cm.curOp) regChange(cm);
247 - }
248 -
249 - function wrappingChanged(cm) {
250 - if (cm.options.lineWrapping) {
251 - addClass(cm.display.wrapper, "CodeMirror-wrap");
252 - cm.display.sizer.style.minWidth = "";
253 - cm.display.sizerWidth = null;
254 - } else {
255 - rmClass(cm.display.wrapper, "CodeMirror-wrap");
256 - findMaxLine(cm);
257 - }
258 - estimateLineHeights(cm);
259 - regChange(cm);
260 - clearCaches(cm);
261 - setTimeout(function(){updateScrollbars(cm);}, 100);
262 - }
263 -
264 - // Returns a function that estimates the height of a line, to use as
265 - // first approximation until the line becomes visible (and is thus
266 - // properly measurable).
267 - function estimateHeight(cm) {
268 - var th = textHeight(cm.display), wrapping = cm.options.lineWrapping;
269 - var perLine = wrapping && Math.max(5, cm.display.scroller.clientWidth / charWidth(cm.display) - 3);
270 - return function(line) {
271 - if (lineIsHidden(cm.doc, line)) return 0;
272 -
273 - var widgetsHeight = 0;
274 - if (line.widgets) for (var i = 0; i < line.widgets.length; i++) {
275 - if (line.widgets[i].height) widgetsHeight += line.widgets[i].height;
276 - }
277 -
278 - if (wrapping)
279 - return widgetsHeight + (Math.ceil(line.text.length / perLine) || 1) * th;
280 - else
281 - return widgetsHeight + th;
282 - };
283 - }
284 -
285 - function estimateLineHeights(cm) {
286 - var doc = cm.doc, est = estimateHeight(cm);
287 - doc.iter(function(line) {
288 - var estHeight = est(line);
289 - if (estHeight != line.height) updateLineHeight(line, estHeight);
290 - });
291 - }
292 -
293 - function themeChanged(cm) {
294 - cm.display.wrapper.className = cm.display.wrapper.className.replace(/\s*cm-s-\S+/g, "") +
295 - cm.options.theme.replace(/(^|\s)\s*/g, " cm-s-");
296 - clearCaches(cm);
297 - }
298 -
299 - function guttersChanged(cm) {
300 - updateGutters(cm);
301 - regChange(cm);
302 - setTimeout(function(){alignHorizontally(cm);}, 20);
303 - }
304 -
305 - // Rebuild the gutter elements, ensure the margin to the left of the
306 - // code matches their width.
307 - function updateGutters(cm) {
308 - var gutters = cm.display.gutters, specs = cm.options.gutters;
309 - removeChildren(gutters);
310 - for (var i = 0; i < specs.length; ++i) {
311 - var gutterClass = specs[i];
312 - var gElt = gutters.appendChild(elt("div", null, "CodeMirror-gutter " + gutterClass));
313 - if (gutterClass == "CodeMirror-linenumbers") {
314 - cm.display.lineGutter = gElt;
315 - gElt.style.width = (cm.display.lineNumWidth || 1) + "px";
316 - }
317 - }
318 - gutters.style.display = i ? "" : "none";
319 - updateGutterSpace(cm);
320 - }
321 -
322 - function updateGutterSpace(cm) {
323 - var width = cm.display.gutters.offsetWidth;
324 - cm.display.sizer.style.marginLeft = width + "px";
325 - }
326 -
327 - // Compute the character length of a line, taking into account
328 - // collapsed ranges (see markText) that might hide parts, and join
329 - // other lines onto it.
330 - function lineLength(line) {
331 - if (line.height == 0) return 0;
332 - var len = line.text.length, merged, cur = line;
333 - while (merged = collapsedSpanAtStart(cur)) {
334 - var found = merged.find(0, true);
335 - cur = found.from.line;
336 - len += found.from.ch - found.to.ch;
337 - }
338 - cur = line;
339 - while (merged = collapsedSpanAtEnd(cur)) {
340 - var found = merged.find(0, true);
341 - len -= cur.text.length - found.from.ch;
342 - cur = found.to.line;
343 - len += cur.text.length - found.to.ch;
344 - }
345 - return len;
346 - }
347 -
348 - // Find the longest line in the document.
349 - function findMaxLine(cm) {
350 - var d = cm.display, doc = cm.doc;
351 - d.maxLine = getLine(doc, doc.first);
352 - d.maxLineLength = lineLength(d.maxLine);
353 - d.maxLineChanged = true;
354 - doc.iter(function(line) {
355 - var len = lineLength(line);
356 - if (len > d.maxLineLength) {
357 - d.maxLineLength = len;
358 - d.maxLine = line;
359 - }
360 - });
361 - }
362 -
363 - // Make sure the gutters options contains the element
364 - // "CodeMirror-linenumbers" when the lineNumbers option is true.
365 - function setGuttersForLineNumbers(options) {
366 - var found = indexOf(options.gutters, "CodeMirror-linenumbers");
367 - if (found == -1 && options.lineNumbers) {
368 - options.gutters = options.gutters.concat(["CodeMirror-linenumbers"]);
369 - } else if (found > -1 && !options.lineNumbers) {
370 - options.gutters = options.gutters.slice(0);
371 - options.gutters.splice(found, 1);
372 - }
373 - }
374 -
375 - // SCROLLBARS
376 -
377 - // Prepare DOM reads needed to update the scrollbars. Done in one
378 - // shot to minimize update/measure roundtrips.
379 - function measureForScrollbars(cm) {
380 - var d = cm.display, gutterW = d.gutters.offsetWidth;
381 - var docH = Math.round(cm.doc.height + paddingVert(cm.display));
382 - return {
383 - clientHeight: d.scroller.clientHeight,
384 - viewHeight: d.wrapper.clientHeight,
385 - scrollWidth: d.scroller.scrollWidth, clientWidth: d.scroller.clientWidth,
386 - viewWidth: d.wrapper.clientWidth,
387 - barLeft: cm.options.fixedGutter ? gutterW : 0,
388 - docHeight: docH,
389 - scrollHeight: docH + scrollGap(cm) + d.barHeight,
390 - nativeBarWidth: d.nativeBarWidth,
391 - gutterWidth: gutterW
392 - };
393 - }
394 -
395 - function NativeScrollbars(place, scroll, cm) {
396 - this.cm = cm;
397 - var vert = this.vert = elt("div", [elt("div", null, null, "min-width: 1px")], "CodeMirror-vscrollbar");
398 - var horiz = this.horiz = elt("div", [elt("div", null, null, "height: 100%; min-height: 1px")], "CodeMirror-hscrollbar");
399 - place(vert); place(horiz);
400 -
401 - on(vert, "scroll", function() {
402 - if (vert.clientHeight) scroll(vert.scrollTop, "vertical");
403 - });
404 - on(horiz, "scroll", function() {
405 - if (horiz.clientWidth) scroll(horiz.scrollLeft, "horizontal");
406 - });
407 -
408 - this.checkedZeroWidth = false;
409 - // Need to set a minimum width to see the scrollbar on IE7 (but must not set it on IE8).
410 - if (ie && ie_version < 8) this.horiz.style.minHeight = this.vert.style.minWidth = "18px";
411 - }
412 -
413 - NativeScrollbars.prototype = copyObj({
414 - update: function(measure) {
415 - var needsH = measure.scrollWidth > measure.clientWidth + 1;
416 - var needsV = measure.scrollHeight > measure.clientHeight + 1;
417 - var sWidth = measure.nativeBarWidth;
418 -
419 - if (needsV) {
420 - this.vert.style.display = "block";
421 - this.vert.style.bottom = needsH ? sWidth + "px" : "0";
422 - var totalHeight = measure.viewHeight - (needsH ? sWidth : 0);
423 - // A bug in IE8 can cause this value to be negative, so guard it.
424 - this.vert.firstChild.style.height =
425 - Math.max(0, measure.scrollHeight - measure.clientHeight + totalHeight) + "px";
426 - } else {
427 - this.vert.style.display = "";
428 - this.vert.firstChild.style.height = "0";
429 - }
430 -
431 - if (needsH) {
432 - this.horiz.style.display = "block";
433 - this.horiz.style.right = needsV ? sWidth + "px" : "0";
434 - this.horiz.style.left = measure.barLeft + "px";
435 - var totalWidth = measure.viewWidth - measure.barLeft - (needsV ? sWidth : 0);
436 - this.horiz.firstChild.style.width =
437 - (measure.scrollWidth - measure.clientWidth + totalWidth) + "px";
438 - } else {
439 - this.horiz.style.display = "";
440 - this.horiz.firstChild.style.width = "0";
441 - }
442 -
443 - if (!this.checkedZeroWidth && measure.clientHeight > 0) {
444 - if (sWidth == 0) this.zeroWidthHack();
445 - this.checkedZeroWidth = true;
446 - }
447 -
448 - return {right: needsV ? sWidth : 0, bottom: needsH ? sWidth : 0};
449 - },
450 - setScrollLeft: function(pos) {
451 - if (this.horiz.scrollLeft != pos) this.horiz.scrollLeft = pos;
452 - if (this.disableHoriz) this.enableZeroWidthBar(this.horiz, this.disableHoriz);
453 - },
454 - setScrollTop: function(pos) {
455 - if (this.vert.scrollTop != pos) this.vert.scrollTop = pos;
456 - if (this.disableVert) this.enableZeroWidthBar(this.vert, this.disableVert);
457 - },
458 - zeroWidthHack: function() {
459 - var w = mac && !mac_geMountainLion ? "12px" : "18px";
460 - this.horiz.style.height = this.vert.style.width = w;
461 - this.horiz.style.pointerEvents = this.vert.style.pointerEvents = "none";
462 - this.disableHoriz = new Delayed;
463 - this.disableVert = new Delayed;
464 - },
465 - enableZeroWidthBar: function(bar, delay) {
466 - bar.style.pointerEvents = "auto";
467 - function maybeDisable() {
468 - // To find out whether the scrollbar is still visible, we
469 - // check whether the element under the pixel in the bottom
470 - // left corner of the scrollbar box is the scrollbar box
471 - // itself (when the bar is still visible) or its filler child
472 - // (when the bar is hidden). If it is still visible, we keep
473 - // it enabled, if it's hidden, we disable pointer events.
474 - var box = bar.getBoundingClientRect();
475 - var elt = document.elementFromPoint(box.left + 1, box.bottom - 1);
476 - if (elt != bar) bar.style.pointerEvents = "none";
477 - else delay.set(1000, maybeDisable);
478 - }
479 - delay.set(1000, maybeDisable);
480 - },
481 - clear: function() {
482 - var parent = this.horiz.parentNode;
483 - parent.removeChild(this.horiz);
484 - parent.removeChild(this.vert);
485 - }
486 - }, NativeScrollbars.prototype);
487 -
488 - function NullScrollbars() {}
489 -
490 - NullScrollbars.prototype = copyObj({
491 - update: function() { return {bottom: 0, right: 0}; },
492 - setScrollLeft: function() {},
493 - setScrollTop: function() {},
494 - clear: function() {}
495 - }, NullScrollbars.prototype);
496 -
497 - CodeMirror.scrollbarModel = {"native": NativeScrollbars, "null": NullScrollbars};
498 -
499 - function initScrollbars(cm) {
500 - if (cm.display.scrollbars) {
501 - cm.display.scrollbars.clear();
502 - if (cm.display.scrollbars.addClass)
503 - rmClass(cm.display.wrapper, cm.display.scrollbars.addClass);
504 - }
505 -
506 - cm.display.scrollbars = new CodeMirror.scrollbarModel[cm.options.scrollbarStyle](function(node) {
507 - cm.display.wrapper.insertBefore(node, cm.display.scrollbarFiller);
508 - // Prevent clicks in the scrollbars from killing focus
509 - on(node, "mousedown", function() {
510 - if (cm.state.focused) setTimeout(function() { cm.display.input.focus(); }, 0);
511 - });
512 - node.setAttribute("cm-not-content", "true");
513 - }, function(pos, axis) {
514 - if (axis == "horizontal") setScrollLeft(cm, pos);
515 - else setScrollTop(cm, pos);
516 - }, cm);
517 - if (cm.display.scrollbars.addClass)
518 - addClass(cm.display.wrapper, cm.display.scrollbars.addClass);
519 - }
520 -
521 - function updateScrollbars(cm, measure) {
522 - if (!measure) measure = measureForScrollbars(cm);
523 - var startWidth = cm.display.barWidth, startHeight = cm.display.barHeight;
524 - updateScrollbarsInner(cm, measure);
525 - for (var i = 0; i < 4 && startWidth != cm.display.barWidth || startHeight != cm.display.barHeight; i++) {
526 - if (startWidth != cm.display.barWidth && cm.options.lineWrapping)
527 - updateHeightsInViewport(cm);
528 - updateScrollbarsInner(cm, measureForScrollbars(cm));
529 - startWidth = cm.display.barWidth; startHeight = cm.display.barHeight;
530 - }
531 - }
532 -
533 - // Re-synchronize the fake scrollbars with the actual size of the
534 - // content.
535 - function updateScrollbarsInner(cm, measure) {
536 - var d = cm.display;
537 - var sizes = d.scrollbars.update(measure);
538 -
539 - d.sizer.style.paddingRight = (d.barWidth = sizes.right) + "px";
540 - d.sizer.style.paddingBottom = (d.barHeight = sizes.bottom) + "px";
541 - d.heightForcer.style.borderBottom = sizes.bottom + "px solid transparent"
542 -
543 - if (sizes.right && sizes.bottom) {
544 - d.scrollbarFiller.style.display = "block";
545 - d.scrollbarFiller.style.height = sizes.bottom + "px";
546 - d.scrollbarFiller.style.width = sizes.right + "px";
547 - } else d.scrollbarFiller.style.display = "";
548 - if (sizes.bottom && cm.options.coverGutterNextToScrollbar && cm.options.fixedGutter) {
549 - d.gutterFiller.style.display = "block";
550 - d.gutterFiller.style.height = sizes.bottom + "px";
551 - d.gutterFiller.style.width = measure.gutterWidth + "px";
552 - } else d.gutterFiller.style.display = "";
553 - }
554 -
555 - // Compute the lines that are visible in a given viewport (defaults
556 - // the the current scroll position). viewport may contain top,
557 - // height, and ensure (see op.scrollToPos) properties.
558 - function visibleLines(display, doc, viewport) {
559 - var top = viewport && viewport.top != null ? Math.max(0, viewport.top) : display.scroller.scrollTop;
560 - top = Math.floor(top - paddingTop(display));
561 - var bottom = viewport && viewport.bottom != null ? viewport.bottom : top + display.wrapper.clientHeight;
562 -
563 - var from = lineAtHeight(doc, top), to = lineAtHeight(doc, bottom);
564 - // Ensure is a {from: {line, ch}, to: {line, ch}} object, and
565 - // forces those lines into the viewport (if possible).
566 - if (viewport && viewport.ensure) {
567 - var ensureFrom = viewport.ensure.from.line, ensureTo = viewport.ensure.to.line;
568 - if (ensureFrom < from) {
569 - from = ensureFrom;
570 - to = lineAtHeight(doc, heightAtLine(getLine(doc, ensureFrom)) + display.wrapper.clientHeight);
571 - } else if (Math.min(ensureTo, doc.lastLine()) >= to) {
572 - from = lineAtHeight(doc, heightAtLine(getLine(doc, ensureTo)) - display.wrapper.clientHeight);
573 - to = ensureTo;
574 - }
575 - }
576 - return {from: from, to: Math.max(to, from + 1)};
577 - }
578 -
579 - // LINE NUMBERS
580 -
581 - // Re-align line numbers and gutter marks to compensate for
582 - // horizontal scrolling.
583 - function alignHorizontally(cm) {
584 - var display = cm.display, view = display.view;
585 - if (!display.alignWidgets && (!display.gutters.firstChild || !cm.options.fixedGutter)) return;
586 - var comp = compensateForHScroll(display) - display.scroller.scrollLeft + cm.doc.scrollLeft;
587 - var gutterW = display.gutters.offsetWidth, left = comp + "px";
588 - for (var i = 0; i < view.length; i++) if (!view[i].hidden) {
589 - if (cm.options.fixedGutter && view[i].gutter)
590 - view[i].gutter.style.left = left;
591 - var align = view[i].alignable;
592 - if (align) for (var j = 0; j < align.length; j++)
593 - align[j].style.left = left;
594 - }
595 - if (cm.options.fixedGutter)
596 - display.gutters.style.left = (comp + gutterW) + "px";
597 - }
598 -
599 - // Used to ensure that the line number gutter is still the right
600 - // size for the current document size. Returns true when an update
601 - // is needed.
602 - function maybeUpdateLineNumberWidth(cm) {
603 - if (!cm.options.lineNumbers) return false;
604 - var doc = cm.doc, last = lineNumberFor(cm.options, doc.first + doc.size - 1), display = cm.display;
605 - if (last.length != display.lineNumChars) {
606 - var test = display.measure.appendChild(elt("div", [elt("div", last)],
607 - "CodeMirror-linenumber CodeMirror-gutter-elt"));
608 - var innerW = test.firstChild.offsetWidth, padding = test.offsetWidth - innerW;
609 - display.lineGutter.style.width = "";
610 - display.lineNumInnerWidth = Math.max(innerW, display.lineGutter.offsetWidth - padding) + 1;
611 - display.lineNumWidth = display.lineNumInnerWidth + padding;
612 - display.lineNumChars = display.lineNumInnerWidth ? last.length : -1;
613 - display.lineGutter.style.width = display.lineNumWidth + "px";
614 - updateGutterSpace(cm);
615 - return true;
616 - }
617 - return false;
618 - }
619 -
620 - function lineNumberFor(options, i) {
621 - return String(options.lineNumberFormatter(i + options.firstLineNumber));
622 - }
623 -
624 - // Computes display.scroller.scrollLeft + display.gutters.offsetWidth,
625 - // but using getBoundingClientRect to get a sub-pixel-accurate
626 - // result.
627 - function compensateForHScroll(display) {
628 - return display.scroller.getBoundingClientRect().left - display.sizer.getBoundingClientRect().left;
629 - }
630 -
631 - // DISPLAY DRAWING
632 -
633 - function DisplayUpdate(cm, viewport, force) {
634 - var display = cm.display;
635 -
636 - this.viewport = viewport;
637 - // Store some values that we'll need later (but don't want to force a relayout for)
638 - this.visible = visibleLines(display, cm.doc, viewport);
639 - this.editorIsHidden = !display.wrapper.offsetWidth;
640 - this.wrapperHeight = display.wrapper.clientHeight;
641 - this.wrapperWidth = display.wrapper.clientWidth;
642 - this.oldDisplayWidth = displayWidth(cm);
643 - this.force = force;
644 - this.dims = getDimensions(cm);
645 - this.events = [];
646 - }
647 -
648 - DisplayUpdate.prototype.signal = function(emitter, type) {
649 - if (hasHandler(emitter, type))
650 - this.events.push(arguments);
651 - };
652 - DisplayUpdate.prototype.finish = function() {
653 - for (var i = 0; i < this.events.length; i++)
654 - signal.apply(null, this.events[i]);
655 - };
656 -
657 - function maybeClipScrollbars(cm) {
658 - var display = cm.display;
659 - if (!display.scrollbarsClipped && display.scroller.offsetWidth) {
660 - display.nativeBarWidth = display.scroller.offsetWidth - display.scroller.clientWidth;
661 - display.heightForcer.style.height = scrollGap(cm) + "px";
662 - display.sizer.style.marginBottom = -display.nativeBarWidth + "px";
663 - display.sizer.style.borderRightWidth = scrollGap(cm) + "px";
664 - display.scrollbarsClipped = true;
665 - }
666 - }
667 -
668 - // Does the actual updating of the line display. Bails out
669 - // (returning false) when there is nothing to be done and forced is
670 - // false.
671 - function updateDisplayIfNeeded(cm, update) {
672 - var display = cm.display, doc = cm.doc;
673 -
674 - if (update.editorIsHidden) {
675 - resetView(cm);
676 - return false;
677 - }
678 -
679 - // Bail out if the visible area is already rendered and nothing changed.
680 - if (!update.force &&
681 - update.visible.from >= display.viewFrom && update.visible.to <= display.viewTo &&
682 - (display.updateLineNumbers == null || display.updateLineNumbers >= display.viewTo) &&
683 - display.renderedView == display.view && countDirtyView(cm) == 0)
684 - return false;
685 -
686 - if (maybeUpdateLineNumberWidth(cm)) {
687 - resetView(cm);
688 - update.dims = getDimensions(cm);
689 - }
690 -
691 - // Compute a suitable new viewport (from & to)
692 - var end = doc.first + doc.size;
693 - var from = Math.max(update.visible.from - cm.options.viewportMargin, doc.first);
694 - var to = Math.min(end, update.visible.to + cm.options.viewportMargin);
695 - if (display.viewFrom < from && from - display.viewFrom < 20) from = Math.max(doc.first, display.viewFrom);
696 - if (display.viewTo > to && display.viewTo - to < 20) to = Math.min(end, display.viewTo);
697 - if (sawCollapsedSpans) {
698 - from = visualLineNo(cm.doc, from);
699 - to = visualLineEndNo(cm.doc, to);
700 - }
701 -
702 - var different = from != display.viewFrom || to != display.viewTo ||
703 - display.lastWrapHeight != update.wrapperHeight || display.lastWrapWidth != update.wrapperWidth;
704 - adjustView(cm, from, to);
705 -
706 - display.viewOffset = heightAtLine(getLine(cm.doc, display.viewFrom));
707 - // Position the mover div to align with the current scroll position
708 - cm.display.mover.style.top = display.viewOffset + "px";
709 -
710 - var toUpdate = countDirtyView(cm);
711 - if (!different && toUpdate == 0 && !update.force && display.renderedView == display.view &&
712 - (display.updateLineNumbers == null || display.updateLineNumbers >= display.viewTo))
713 - return false;
714 -
715 - // For big changes, we hide the enclosing element during the
716 - // update, since that speeds up the operations on most browsers.
717 - var focused = activeElt();
718 - if (toUpdate > 4) display.lineDiv.style.display = "none";
719 - patchDisplay(cm, display.updateLineNumbers, update.dims);
720 - if (toUpdate > 4) display.lineDiv.style.display = "";
721 - display.renderedView = display.view;
722 - // There might have been a widget with a focused element that got
723 - // hidden or updated, if so re-focus it.
724 - if (focused && activeElt() != focused && focused.offsetHeight) focused.focus();
725 -
726 - // Prevent selection and cursors from interfering with the scroll
727 - // width and height.
728 - removeChildren(display.cursorDiv);
729 - removeChildren(display.selectionDiv);
730 - display.gutters.style.height = display.sizer.style.minHeight = 0;
731 -
732 - if (different) {
733 - display.lastWrapHeight = update.wrapperHeight;
734 - display.lastWrapWidth = update.wrapperWidth;
735 - startWorker(cm, 400);
736 - }
737 -
738 - display.updateLineNumbers = null;
739 -
740 - return true;
741 - }
742 -
743 - function postUpdateDisplay(cm, update) {
744 - var viewport = update.viewport;
745 -
746 - for (var first = true;; first = false) {
747 - if (!first || !cm.options.lineWrapping || update.oldDisplayWidth == displayWidth(cm)) {
748 - // Clip forced viewport to actual scrollable area.
749 - if (viewport && viewport.top != null)
750 - viewport = {top: Math.min(cm.doc.height + paddingVert(cm.display) - displayHeight(cm), viewport.top)};
751 - // Updated line heights might result in the drawn area not
752 - // actually covering the viewport. Keep looping until it does.
753 - update.visible = visibleLines(cm.display, cm.doc, viewport);
754 - if (update.visible.from >= cm.display.viewFrom && update.visible.to <= cm.display.viewTo)
755 - break;
756 - }
757 - if (!updateDisplayIfNeeded(cm, update)) break;
758 - updateHeightsInViewport(cm);
759 - var barMeasure = measureForScrollbars(cm);
760 - updateSelection(cm);
761 - updateScrollbars(cm, barMeasure);
762 - setDocumentHeight(cm, barMeasure);
763 - }
764 -
765 - update.signal(cm, "update", cm);
766 - if (cm.display.viewFrom != cm.display.reportedViewFrom || cm.display.viewTo != cm.display.reportedViewTo) {
767 - update.signal(cm, "viewportChange", cm, cm.display.viewFrom, cm.display.viewTo);
768 - cm.display.reportedViewFrom = cm.display.viewFrom; cm.display.reportedViewTo = cm.display.viewTo;
769 - }
770 - }
771 -
772 - function updateDisplaySimple(cm, viewport) {
773 - var update = new DisplayUpdate(cm, viewport);
774 - if (updateDisplayIfNeeded(cm, update)) {
775 - updateHeightsInViewport(cm);
776 - postUpdateDisplay(cm, update);
777 - var barMeasure = measureForScrollbars(cm);
778 - updateSelection(cm);
779 - updateScrollbars(cm, barMeasure);
780 - setDocumentHeight(cm, barMeasure);
781 - update.finish();
782 - }
783 - }
784 -
785 - function setDocumentHeight(cm, measure) {
786 - cm.display.sizer.style.minHeight = measure.docHeight + "px";
787 - cm.display.heightForcer.style.top = measure.docHeight + "px";
788 - cm.display.gutters.style.height = (measure.docHeight + cm.display.barHeight + scrollGap(cm)) + "px";
789 - }
790 -
791 - // Read the actual heights of the rendered lines, and update their
792 - // stored heights to match.
793 - function updateHeightsInViewport(cm) {
794 - var display = cm.display;
795 - var prevBottom = display.lineDiv.offsetTop;
796 - for (var i = 0; i < display.view.length; i++) {
797 - var cur = display.view[i], height;
798 - if (cur.hidden) continue;
799 - if (ie && ie_version < 8) {
800 - var bot = cur.node.offsetTop + cur.node.offsetHeight;
801 - height = bot - prevBottom;
802 - prevBottom = bot;
803 - } else {
804 - var box = cur.node.getBoundingClientRect();
805 - height = box.bottom - box.top;
806 - }
807 - var diff = cur.line.height - height;
808 - if (height < 2) height = textHeight(display);
809 - if (diff > .001 || diff < -.001) {
810 - updateLineHeight(cur.line, height);
811 - updateWidgetHeight(cur.line);
812 - if (cur.rest) for (var j = 0; j < cur.rest.length; j++)
813 - updateWidgetHeight(cur.rest[j]);
814 - }
815 - }
816 - }
817 -
818 - // Read and store the height of line widgets associated with the
819 - // given line.
820 - function updateWidgetHeight(line) {
821 - if (line.widgets) for (var i = 0; i < line.widgets.length; ++i)
822 - line.widgets[i].height = line.widgets[i].node.parentNode.offsetHeight;
823 - }
824 -
825 - // Do a bulk-read of the DOM positions and sizes needed to draw the
826 - // view, so that we don't interleave reading and writing to the DOM.
827 - function getDimensions(cm) {
828 - var d = cm.display, left = {}, width = {};
829 - var gutterLeft = d.gutters.clientLeft;
830 - for (var n = d.gutters.firstChild, i = 0; n; n = n.nextSibling, ++i) {
831 - left[cm.options.gutters[i]] = n.offsetLeft + n.clientLeft + gutterLeft;
832 - width[cm.options.gutters[i]] = n.clientWidth;
833 - }
834 - return {fixedPos: compensateForHScroll(d),
835 - gutterTotalWidth: d.gutters.offsetWidth,
836 - gutterLeft: left,
837 - gutterWidth: width,
838 - wrapperWidth: d.wrapper.clientWidth};
839 - }
840 -
841 - // Sync the actual display DOM structure with display.view, removing
842 - // nodes for lines that are no longer in view, and creating the ones
843 - // that are not there yet, and updating the ones that are out of
844 - // date.
845 - function patchDisplay(cm, updateNumbersFrom, dims) {
846 - var display = cm.display, lineNumbers = cm.options.lineNumbers;
847 - var container = display.lineDiv, cur = container.firstChild;
848 -
849 - function rm(node) {
850 - var next = node.nextSibling;
851 - // Works around a throw-scroll bug in OS X Webkit
852 - if (webkit && mac && cm.display.currentWheelTarget == node)
853 - node.style.display = "none";
854 - else
855 - node.parentNode.removeChild(node);
856 - return next;
857 - }
858 -
859 - var view = display.view, lineN = display.viewFrom;
860 - // Loop over the elements in the view, syncing cur (the DOM nodes
861 - // in display.lineDiv) with the view as we go.
862 - for (var i = 0; i < view.length; i++) {
863 - var lineView = view[i];
864 - if (lineView.hidden) {
865 - } else if (!lineView.node || lineView.node.parentNode != container) { // Not drawn yet
866 - var node = buildLineElement(cm, lineView, lineN, dims);
867 - container.insertBefore(node, cur);
868 - } else { // Already drawn
869 - while (cur != lineView.node) cur = rm(cur);
870 - var updateNumber = lineNumbers && updateNumbersFrom != null &&
871 - updateNumbersFrom <= lineN && lineView.lineNumber;
872 - if (lineView.changes) {
873 - if (indexOf(lineView.changes, "gutter") > -1) updateNumber = false;
874 - updateLineForChanges(cm, lineView, lineN, dims);
875 - }
876 - if (updateNumber) {
877 - removeChildren(lineView.lineNumber);
878 - lineView.lineNumber.appendChild(document.createTextNode(lineNumberFor(cm.options, lineN)));
879 - }
880 - cur = lineView.node.nextSibling;
881 - }
882 - lineN += lineView.size;
883 - }
884 - while (cur) cur = rm(cur);
885 - }
886 -
887 - // When an aspect of a line changes, a string is added to
888 - // lineView.changes. This updates the relevant part of the line's
889 - // DOM structure.
890 - function updateLineForChanges(cm, lineView, lineN, dims) {
891 - for (var j = 0; j < lineView.changes.length; j++) {
892 - var type = lineView.changes[j];
893 - if (type == "text") updateLineText(cm, lineView);
894 - else if (type == "gutter") updateLineGutter(cm, lineView, lineN, dims);
895 - else if (type == "class") updateLineClasses(lineView);
896 - else if (type == "widget") updateLineWidgets(cm, lineView, dims);
897 - }
898 - lineView.changes = null;
899 - }
900 -
901 - // Lines with gutter elements, widgets or a background class need to
902 - // be wrapped, and have the extra elements added to the wrapper div
903 - function ensureLineWrapped(lineView) {
904 - if (lineView.node == lineView.text) {
905 - lineView.node = elt("div", null, null, "position: relative");
906 - if (lineView.text.parentNode)
907 - lineView.text.parentNode.replaceChild(lineView.node, lineView.text);
908 - lineView.node.appendChild(lineView.text);
909 - if (ie && ie_version < 8) lineView.node.style.zIndex = 2;
910 - }
911 - return lineView.node;
912 - }
913 -
914 - function updateLineBackground(lineView) {
915 - var cls = lineView.bgClass ? lineView.bgClass + " " + (lineView.line.bgClass || "") : lineView.line.bgClass;
916 - if (cls) cls += " CodeMirror-linebackground";
917 - if (lineView.background) {
918 - if (cls) lineView.background.className = cls;
919 - else { lineView.background.parentNode.removeChild(lineView.background); lineView.background = null; }
920 - } else if (cls) {
921 - var wrap = ensureLineWrapped(lineView);
922 - lineView.background = wrap.insertBefore(elt("div", null, cls), wrap.firstChild);
923 - }
924 - }
925 -
926 - // Wrapper around buildLineContent which will reuse the structure
927 - // in display.externalMeasured when possible.
928 - function getLineContent(cm, lineView) {
929 - var ext = cm.display.externalMeasured;
930 - if (ext && ext.line == lineView.line) {
931 - cm.display.externalMeasured = null;
932 - lineView.measure = ext.measure;
933 - return ext.built;
934 - }
935 - return buildLineContent(cm, lineView);
936 - }
937 -
938 - // Redraw the line's text. Interacts with the background and text
939 - // classes because the mode may output tokens that influence these
940 - // classes.
941 - function updateLineText(cm, lineView) {
942 - var cls = lineView.text.className;
943 - var built = getLineContent(cm, lineView);
944 - if (lineView.text == lineView.node) lineView.node = built.pre;
945 - lineView.text.parentNode.replaceChild(built.pre, lineView.text);
946 - lineView.text = built.pre;
947 - if (built.bgClass != lineView.bgClass || built.textClass != lineView.textClass) {
948 - lineView.bgClass = built.bgClass;
949 - lineView.textClass = built.textClass;
950 - updateLineClasses(lineView);
951 - } else if (cls) {
952 - lineView.text.className = cls;
953 - }
954 - }
955 -
956 - function updateLineClasses(lineView) {
957 - updateLineBackground(lineView);
958 - if (lineView.line.wrapClass)
959 - ensureLineWrapped(lineView).className = lineView.line.wrapClass;
960 - else if (lineView.node != lineView.text)
961 - lineView.node.className = "";
962 - var textClass = lineView.textClass ? lineView.textClass + " " + (lineView.line.textClass || "") : lineView.line.textClass;
963 - lineView.text.className = textClass || "";
964 - }
965 -
966 - function updateLineGutter(cm, lineView, lineN, dims) {
967 - if (lineView.gutter) {
968 - lineView.node.removeChild(lineView.gutter);
969 - lineView.gutter = null;
970 - }
971 - if (lineView.gutterBackground) {
972 - lineView.node.removeChild(lineView.gutterBackground);
973 - lineView.gutterBackground = null;
974 - }
975 - if (lineView.line.gutterClass) {
976 - var wrap = ensureLineWrapped(lineView);
977 - lineView.gutterBackground = elt("div", null, "CodeMirror-gutter-background " + lineView.line.gutterClass,
978 - "left: " + (cm.options.fixedGutter ? dims.fixedPos : -dims.gutterTotalWidth) +
979 - "px; width: " + dims.gutterTotalWidth + "px");
980 - wrap.insertBefore(lineView.gutterBackground, lineView.text);
981 - }
982 - var markers = lineView.line.gutterMarkers;
983 - if (cm.options.lineNumbers || markers) {
984 - var wrap = ensureLineWrapped(lineView);
985 - var gutterWrap = lineView.gutter = elt("div", null, "CodeMirror-gutter-wrapper", "left: " +
986 - (cm.options.fixedGutter ? dims.fixedPos : -dims.gutterTotalWidth) + "px");
987 - cm.display.input.setUneditable(gutterWrap);
988 - wrap.insertBefore(gutterWrap, lineView.text);
989 - if (lineView.line.gutterClass)
990 - gutterWrap.className += " " + lineView.line.gutterClass;
991 - if (cm.options.lineNumbers && (!markers || !markers["CodeMirror-linenumbers"]))
992 - lineView.lineNumber = gutterWrap.appendChild(
993 - elt("div", lineNumberFor(cm.options, lineN),
994 - "CodeMirror-linenumber CodeMirror-gutter-elt",
995 - "left: " + dims.gutterLeft["CodeMirror-linenumbers"] + "px; width: "
996 - + cm.display.lineNumInnerWidth + "px"));
997 - if (markers) for (var k = 0; k < cm.options.gutters.length; ++k) {
998 - var id = cm.options.gutters[k], found = markers.hasOwnProperty(id) && markers[id];
999 - if (found)
1000 - gutterWrap.appendChild(elt("div", [found], "CodeMirror-gutter-elt", "left: " +
1001 - dims.gutterLeft[id] + "px; width: " + dims.gutterWidth[id] + "px"));
1002 - }
1003 - }
1004 - }
1005 -
1006 - function updateLineWidgets(cm, lineView, dims) {
1007 - if (lineView.alignable) lineView.alignable = null;
1008 - for (var node = lineView.node.firstChild, next; node; node = next) {
1009 - var next = node.nextSibling;
1010 - if (node.className == "CodeMirror-linewidget")
1011 - lineView.node.removeChild(node);
1012 - }
1013 - insertLineWidgets(cm, lineView, dims);
1014 - }
1015 -
1016 - // Build a line's DOM representation from scratch
1017 - function buildLineElement(cm, lineView, lineN, dims) {
1018 - var built = getLineContent(cm, lineView);
1019 - lineView.text = lineView.node = built.pre;
1020 - if (built.bgClass) lineView.bgClass = built.bgClass;
1021 - if (built.textClass) lineView.textClass = built.textClass;
1022 -
1023 - updateLineClasses(lineView);
1024 - updateLineGutter(cm, lineView, lineN, dims);
1025 - insertLineWidgets(cm, lineView, dims);
1026 - return lineView.node;
1027 - }
1028 -
1029 - // A lineView may contain multiple logical lines (when merged by
1030 - // collapsed spans). The widgets for all of them need to be drawn.
1031 - function insertLineWidgets(cm, lineView, dims) {
1032 - insertLineWidgetsFor(cm, lineView.line, lineView, dims, true);
1033 - if (lineView.rest) for (var i = 0; i < lineView.rest.length; i++)
1034 - insertLineWidgetsFor(cm, lineView.rest[i], lineView, dims, false);
1035 - }
1036 -
1037 - function insertLineWidgetsFor(cm, line, lineView, dims, allowAbove) {
1038 - if (!line.widgets) return;
1039 - var wrap = ensureLineWrapped(lineView);
1040 - for (var i = 0, ws = line.widgets; i < ws.length; ++i) {
1041 - var widget = ws[i], node = elt("div", [widget.node], "CodeMirror-linewidget");
1042 - if (!widget.handleMouseEvents) node.setAttribute("cm-ignore-events", "true");
1043 - positionLineWidget(widget, node, lineView, dims);
1044 - cm.display.input.setUneditable(node);
1045 - if (allowAbove && widget.above)
1046 - wrap.insertBefore(node, lineView.gutter || lineView.text);
1047 - else
1048 - wrap.appendChild(node);
1049 - signalLater(widget, "redraw");
1050 - }
1051 - }
1052 -
1053 - function positionLineWidget(widget, node, lineView, dims) {
1054 - if (widget.noHScroll) {
1055 - (lineView.alignable || (lineView.alignable = [])).push(node);
1056 - var width = dims.wrapperWidth;
1057 - node.style.left = dims.fixedPos + "px";
1058 - if (!widget.coverGutter) {
1059 - width -= dims.gutterTotalWidth;
1060 - node.style.paddingLeft = dims.gutterTotalWidth + "px";
1061 - }
1062 - node.style.width = width + "px";
1063 - }
1064 - if (widget.coverGutter) {
1065 - node.style.zIndex = 5;
1066 - node.style.position = "relative";
1067 - if (!widget.noHScroll) node.style.marginLeft = -dims.gutterTotalWidth + "px";
1068 - }
1069 - }
1070 -
1071 - // POSITION OBJECT
1072 -
1073 - // A Pos instance represents a position within the text.
1074 - var Pos = CodeMirror.Pos = function(line, ch) {
1075 - if (!(this instanceof Pos)) return new Pos(line, ch);
1076 - this.line = line; this.ch = ch;
1077 - };
1078 -
1079 - // Compare two positions, return 0 if they are the same, a negative
1080 - // number when a is less, and a positive number otherwise.
1081 - var cmp = CodeMirror.cmpPos = function(a, b) { return a.line - b.line || a.ch - b.ch; };
1082 -
1083 - function copyPos(x) {return Pos(x.line, x.ch);}
1084 - function maxPos(a, b) { return cmp(a, b) < 0 ? b : a; }
1085 - function minPos(a, b) { return cmp(a, b) < 0 ? a : b; }
1086 -
1087 - // INPUT HANDLING
1088 -
1089 - function ensureFocus(cm) {
1090 - if (!cm.state.focused) { cm.display.input.focus(); onFocus(cm); }
1091 - }
1092 -
1093 - // This will be set to a {lineWise: bool, text: [string]} object, so
1094 - // that, when pasting, we know what kind of selections the copied
1095 - // text was made out of.
1096 - var lastCopied = null;
1097 -
1098 - function applyTextInput(cm, inserted, deleted, sel, origin) {
1099 - var doc = cm.doc;
1100 - cm.display.shift = false;
1101 - if (!sel) sel = doc.sel;
1102 -
1103 - var paste = cm.state.pasteIncoming || origin == "paste";
1104 - var textLines = doc.splitLines(inserted), multiPaste = null
1105 - // When pasing N lines into N selections, insert one line per selection
1106 - if (paste && sel.ranges.length > 1) {
1107 - if (lastCopied && lastCopied.text.join("\n") == inserted) {
1108 - if (sel.ranges.length % lastCopied.text.length == 0) {
1109 - multiPaste = [];
1110 - for (var i = 0; i < lastCopied.text.length; i++)
1111 - multiPaste.push(doc.splitLines(lastCopied.text[i]));
1112 - }
1113 - } else if (textLines.length == sel.ranges.length) {
1114 - multiPaste = map(textLines, function(l) { return [l]; });
1115 - }
1116 - }
1117 -
1118 - // Normal behavior is to insert the new text into every selection
1119 - for (var i = sel.ranges.length - 1; i >= 0; i--) {
1120 - var range = sel.ranges[i];
1121 - var from = range.from(), to = range.to();
1122 - if (range.empty()) {
1123 - if (deleted && deleted > 0) // Handle deletion
1124 - from = Pos(from.line, from.ch - deleted);
1125 - else if (cm.state.overwrite && !paste) // Handle overwrite
1126 - to = Pos(to.line, Math.min(getLine(doc, to.line).text.length, to.ch + lst(textLines).length));
1127 - else if (lastCopied && lastCopied.lineWise && lastCopied.text.join("\n") == inserted)
1128 - from = to = Pos(from.line, 0)
1129 - }
1130 - var updateInput = cm.curOp.updateInput;
1131 - var changeEvent = {from: from, to: to, text: multiPaste ? multiPaste[i % multiPaste.length] : textLines,
1132 - origin: origin || (paste ? "paste" : cm.state.cutIncoming ? "cut" : "+input")};
1133 - makeChange(cm.doc, changeEvent);
1134 - signalLater(cm, "inputRead", cm, changeEvent);
1135 - }
1136 - if (inserted && !paste)
1137 - triggerElectric(cm, inserted);
1138 -
1139 - ensureCursorVisible(cm);
1140 - cm.curOp.updateInput = updateInput;
1141 - cm.curOp.typing = true;
1142 - cm.state.pasteIncoming = cm.state.cutIncoming = false;
1143 - }
1144 -
1145 - function handlePaste(e, cm) {
1146 - var pasted = e.clipboardData && e.clipboardData.getData("text/plain");
1147 - if (pasted) {
1148 - e.preventDefault();
1149 - if (!cm.isReadOnly() && !cm.options.disableInput)
1150 - runInOp(cm, function() { applyTextInput(cm, pasted, 0, null, "paste"); });
1151 - return true;
1152 - }
1153 - }
1154 -
1155 - function triggerElectric(cm, inserted) {
1156 - // When an 'electric' character is inserted, immediately trigger a reindent
1157 - if (!cm.options.electricChars || !cm.options.smartIndent) return;
1158 - var sel = cm.doc.sel;
1159 -
1160 - for (var i = sel.ranges.length - 1; i >= 0; i--) {
1161 - var range = sel.ranges[i];
1162 - if (range.head.ch > 100 || (i && sel.ranges[i - 1].head.line == range.head.line)) continue;
1163 - var mode = cm.getModeAt(range.head);
1164 - var indented = false;
1165 - if (mode.electricChars) {
1166 - for (var j = 0; j < mode.electricChars.length; j++)
1167 - if (inserted.indexOf(mode.electricChars.charAt(j)) > -1) {
1168 - indented = indentLine(cm, range.head.line, "smart");
1169 - break;
1170 - }
1171 - } else if (mode.electricInput) {
1172 - if (mode.electricInput.test(getLine(cm.doc, range.head.line).text.slice(0, range.head.ch)))
1173 - indented = indentLine(cm, range.head.line, "smart");
1174 - }
1175 - if (indented) signalLater(cm, "electricInput", cm, range.head.line);
1176 - }
1177 - }
1178 -
1179 - function copyableRanges(cm) {
1180 - var text = [], ranges = [];
1181 - for (var i = 0; i < cm.doc.sel.ranges.length; i++) {
1182 - var line = cm.doc.sel.ranges[i].head.line;
1183 - var lineRange = {anchor: Pos(line, 0), head: Pos(line + 1, 0)};
1184 - ranges.push(lineRange);
1185 - text.push(cm.getRange(lineRange.anchor, lineRange.head));
1186 - }
1187 - return {text: text, ranges: ranges};
1188 - }
1189 -
1190 - function disableBrowserMagic(field) {
1191 - field.setAttribute("autocorrect", "off");
1192 - field.setAttribute("autocapitalize", "off");
1193 - field.setAttribute("spellcheck", "false");
1194 - }
1195 -
1196 - // TEXTAREA INPUT STYLE
1197 -
1198 - function TextareaInput(cm) {
1199 - this.cm = cm;
1200 - // See input.poll and input.reset
1201 - this.prevInput = "";
1202 -
1203 - // Flag that indicates whether we expect input to appear real soon
1204 - // now (after some event like 'keypress' or 'input') and are
1205 - // polling intensively.
1206 - this.pollingFast = false;
1207 - // Self-resetting timeout for the poller
1208 - this.polling = new Delayed();
1209 - // Tracks when input.reset has punted to just putting a short
1210 - // string into the textarea instead of the full selection.
1211 - this.inaccurateSelection = false;
1212 - // Used to work around IE issue with selection being forgotten when focus moves away from textarea
1213 - this.hasSelection = false;
1214 - this.composing = null;
1215 - };
1216 -
1217 - function hiddenTextarea() {
1218 - var te = elt("textarea", null, null, "position: absolute; padding: 0; width: 1px; height: 1em; outline: none");
1219 - var div = elt("div", [te], null, "overflow: hidden; position: relative; width: 3px; height: 0px;");
1220 - // The textarea is kept positioned near the cursor to prevent the
1221 - // fact that it'll be scrolled into view on input from scrolling
1222 - // our fake cursor out of view. On webkit, when wrap=off, paste is
1223 - // very slow. So make the area wide instead.
1224 - if (webkit) te.style.width = "1000px";
1225 - else te.setAttribute("wrap", "off");
1226 - // If border: 0; -- iOS fails to open keyboard (issue #1287)
1227 - if (ios) te.style.border = "1px solid black";
1228 - disableBrowserMagic(te);
1229 - return div;
1230 - }
1231 -
1232 - TextareaInput.prototype = copyObj({
1233 - init: function(display) {
1234 - var input = this, cm = this.cm;
1235 -
1236 - // Wraps and hides input textarea
1237 - var div = this.wrapper = hiddenTextarea();
1238 - // The semihidden textarea that is focused when the editor is
1239 - // focused, and receives input.
1240 - var te = this.textarea = div.firstChild;
1241 - display.wrapper.insertBefore(div, display.wrapper.firstChild);
1242 -
1243 - // Needed to hide big blue blinking cursor on Mobile Safari (doesn't seem to work in iOS 8 anymore)
1244 - if (ios) te.style.width = "0px";
1245 -
1246 - on(te, "input", function() {
1247 - if (ie && ie_version >= 9 && input.hasSelection) input.hasSelection = null;
1248 - input.poll();
1249 - });
1250 -
1251 - on(te, "paste", function(e) {
1252 - if (signalDOMEvent(cm, e) || handlePaste(e, cm)) return
1253 -
1254 - cm.state.pasteIncoming = true;
1255 - input.fastPoll();
1256 - });
1257 -
1258 - function prepareCopyCut(e) {
1259 - if (signalDOMEvent(cm, e)) return
1260 - if (cm.somethingSelected()) {
1261 - lastCopied = {lineWise: false, text: cm.getSelections()};
1262 - if (input.inaccurateSelection) {
1263 - input.prevInput = "";
1264 - input.inaccurateSelection = false;
1265 - te.value = lastCopied.text.join("\n");
1266 - selectInput(te);
1267 - }
1268 - } else if (!cm.options.lineWiseCopyCut) {
1269 - return;
1270 - } else {
1271 - var ranges = copyableRanges(cm);
1272 - lastCopied = {lineWise: true, text: ranges.text};
1273 - if (e.type == "cut") {
1274 - cm.setSelections(ranges.ranges, null, sel_dontScroll);
1275 - } else {
1276 - input.prevInput = "";
1277 - te.value = ranges.text.join("\n");
1278 - selectInput(te);
1279 - }
1280 - }
1281 - if (e.type == "cut") cm.state.cutIncoming = true;
1282 - }
1283 - on(te, "cut", prepareCopyCut);
1284 - on(te, "copy", prepareCopyCut);
1285 -
1286 - on(display.scroller, "paste", function(e) {
1287 - if (eventInWidget(display, e) || signalDOMEvent(cm, e)) return;
1288 - cm.state.pasteIncoming = true;
1289 - input.focus();
1290 - });
1291 -
1292 - // Prevent normal selection in the editor (we handle our own)
1293 - on(display.lineSpace, "selectstart", function(e) {
1294 - if (!eventInWidget(display, e)) e_preventDefault(e);
1295 - });
1296 -
1297 - on(te, "compositionstart", function() {
1298 - var start = cm.getCursor("from");
1299 - if (input.composing) input.composing.range.clear()
1300 - input.composing = {
1301 - start: start,
1302 - range: cm.markText(start, cm.getCursor("to"), {className: "CodeMirror-composing"})
1303 - };
1304 - });
1305 - on(te, "compositionend", function() {
1306 - if (input.composing) {
1307 - input.poll();
1308 - input.composing.range.clear();
1309 - input.composing = null;
1310 - }
1311 - });
1312 - },
1313 -
1314 - prepareSelection: function() {
1315 - // Redraw the selection and/or cursor
1316 - var cm = this.cm, display = cm.display, doc = cm.doc;
1317 - var result = prepareSelection(cm);
1318 -
1319 - // Move the hidden textarea near the cursor to prevent scrolling artifacts
1320 - if (cm.options.moveInputWithCursor) {
1321 - var headPos = cursorCoords(cm, doc.sel.primary().head, "div");
1322 - var wrapOff = display.wrapper.getBoundingClientRect(), lineOff = display.lineDiv.getBoundingClientRect();
1323 - result.teTop = Math.max(0, Math.min(display.wrapper.clientHeight - 10,
1324 - headPos.top + lineOff.top - wrapOff.top));
1325 - result.teLeft = Math.max(0, Math.min(display.wrapper.clientWidth - 10,
1326 - headPos.left + lineOff.left - wrapOff.left));
1327 - }
1328 -
1329 - return result;
1330 - },
1331 -
1332 - showSelection: function(drawn) {
1333 - var cm = this.cm, display = cm.display;
1334 - removeChildrenAndAdd(display.cursorDiv, drawn.cursors);
1335 - removeChildrenAndAdd(display.selectionDiv, drawn.selection);
1336 - if (drawn.teTop != null) {
1337 - this.wrapper.style.top = drawn.teTop + "px";
1338 - this.wrapper.style.left = drawn.teLeft + "px";
1339 - }
1340 - },
1341 -
1342 - // Reset the input to correspond to the selection (or to be empty,
1343 - // when not typing and nothing is selected)
1344 - reset: function(typing) {
1345 - if (this.contextMenuPending) return;
1346 - var minimal, selected, cm = this.cm, doc = cm.doc;
1347 - if (cm.somethingSelected()) {
1348 - this.prevInput = "";
1349 - var range = doc.sel.primary();
1350 - minimal = hasCopyEvent &&
1351 - (range.to().line - range.from().line > 100 || (selected = cm.getSelection()).length > 1000);
1352 - var content = minimal ? "-" : selected || cm.getSelection();
1353 - this.textarea.value = content;
1354 - if (cm.state.focused) selectInput(this.textarea);
1355 - if (ie && ie_version >= 9) this.hasSelection = content;
1356 - } else if (!typing) {
1357 - this.prevInput = this.textarea.value = "";
1358 - if (ie && ie_version >= 9) this.hasSelection = null;
1359 - }
1360 - this.inaccurateSelection = minimal;
1361 - },
1362 -
1363 - getField: function() { return this.textarea; },
1364 -
1365 - supportsTouch: function() { return false; },
1366 -
1367 - focus: function() {
1368 - if (this.cm.options.readOnly != "nocursor" && (!mobile || activeElt() != this.textarea)) {
1369 - try { this.textarea.focus(); }
1370 - catch (e) {} // IE8 will throw if the textarea is display: none or not in DOM
1371 - }
1372 - },
1373 -
1374 - blur: function() { this.textarea.blur(); },
1375 -
1376 - resetPosition: function() {
1377 - this.wrapper.style.top = this.wrapper.style.left = 0;
1378 - },
1379 -
1380 - receivedFocus: function() { this.slowPoll(); },
1381 -
1382 - // Poll for input changes, using the normal rate of polling. This
1383 - // runs as long as the editor is focused.
1384 - slowPoll: function() {
1385 - var input = this;
1386 - if (input.pollingFast) return;
1387 - input.polling.set(this.cm.options.pollInterval, function() {
1388 - input.poll();
1389 - if (input.cm.state.focused) input.slowPoll();
1390 - });
1391 - },
1392 -
1393 - // When an event has just come in that is likely to add or change
1394 - // something in the input textarea, we poll faster, to ensure that
1395 - // the change appears on the screen quickly.
1396 - fastPoll: function() {
1397 - var missed = false, input = this;
1398 - input.pollingFast = true;
1399 - function p() {
1400 - var changed = input.poll();
1401 - if (!changed && !missed) {missed = true; input.polling.set(60, p);}
1402 - else {input.pollingFast = false; input.slowPoll();}
1403 - }
1404 - input.polling.set(20, p);
1405 - },
1406 -
1407 - // Read input from the textarea, and update the document to match.
1408 - // When something is selected, it is present in the textarea, and
1409 - // selected (unless it is huge, in which case a placeholder is
1410 - // used). When nothing is selected, the cursor sits after previously
1411 - // seen text (can be empty), which is stored in prevInput (we must
1412 - // not reset the textarea when typing, because that breaks IME).
1413 - poll: function() {
1414 - var cm = this.cm, input = this.textarea, prevInput = this.prevInput;
1415 - // Since this is called a *lot*, try to bail out as cheaply as
1416 - // possible when it is clear that nothing happened. hasSelection
1417 - // will be the case when there is a lot of text in the textarea,
1418 - // in which case reading its value would be expensive.
1419 - if (this.contextMenuPending || !cm.state.focused ||
1420 - (hasSelection(input) && !prevInput && !this.composing) ||
1421 - cm.isReadOnly() || cm.options.disableInput || cm.state.keySeq)
1422 - return false;
1423 -
1424 - var text = input.value;
1425 - // If nothing changed, bail.
1426 - if (text == prevInput && !cm.somethingSelected()) return false;
1427 - // Work around nonsensical selection resetting in IE9/10, and
1428 - // inexplicable appearance of private area unicode characters on
1429 - // some key combos in Mac (#2689).
1430 - if (ie && ie_version >= 9 && this.hasSelection === text ||
1431 - mac && /[\uf700-\uf7ff]/.test(text)) {
1432 - cm.display.input.reset();
1433 - return false;
1434 - }
1435 -
1436 - if (cm.doc.sel == cm.display.selForContextMenu) {
1437 - var first = text.charCodeAt(0);
1438 - if (first == 0x200b && !prevInput) prevInput = "\u200b";
1439 - if (first == 0x21da) { this.reset(); return this.cm.execCommand("undo"); }
1440 - }
1441 - // Find the part of the input that is actually new
1442 - var same = 0, l = Math.min(prevInput.length, text.length);
1443 - while (same < l && prevInput.charCodeAt(same) == text.charCodeAt(same)) ++same;
1444 -
1445 - var self = this;
1446 - runInOp(cm, function() {
1447 - applyTextInput(cm, text.slice(same), prevInput.length - same,
1448 - null, self.composing ? "*compose" : null);
1449 -
1450 - // Don't leave long text in the textarea, since it makes further polling slow
1451 - if (text.length > 1000 || text.indexOf("\n") > -1) input.value = self.prevInput = "";
1452 - else self.prevInput = text;
1453 -
1454 - if (self.composing) {
1455 - self.composing.range.clear();
1456 - self.composing.range = cm.markText(self.composing.start, cm.getCursor("to"),
1457 - {className: "CodeMirror-composing"});
1458 - }
1459 - });
1460 - return true;
1461 - },
1462 -
1463 - ensurePolled: function() {
1464 - if (this.pollingFast && this.poll()) this.pollingFast = false;
1465 - },
1466 -
1467 - onKeyPress: function() {
1468 - if (ie && ie_version >= 9) this.hasSelection = null;
1469 - this.fastPoll();
1470 - },
1471 -
1472 - onContextMenu: function(e) {
1473 - var input = this, cm = input.cm, display = cm.display, te = input.textarea;
1474 - var pos = posFromMouse(cm, e), scrollPos = display.scroller.scrollTop;
1475 - if (!pos || presto) return; // Opera is difficult.
1476 -
1477 - // Reset the current text selection only if the click is done outside of the selection
1478 - // and 'resetSelectionOnContextMenu' option is true.
1479 - var reset = cm.options.resetSelectionOnContextMenu;
1480 - if (reset && cm.doc.sel.contains(pos) == -1)
1481 - operation(cm, setSelection)(cm.doc, simpleSelection(pos), sel_dontScroll);
1482 -
1483 - var oldCSS = te.style.cssText, oldWrapperCSS = input.wrapper.style.cssText;
1484 - input.wrapper.style.cssText = "position: absolute"
1485 - var wrapperBox = input.wrapper.getBoundingClientRect()
1486 - te.style.cssText = "position: absolute; width: 30px; height: 30px; top: " + (e.clientY - wrapperBox.top - 5) +
1487 - "px; left: " + (e.clientX - wrapperBox.left - 5) + "px; z-index: 1000; background: " +
1488 - (ie ? "rgba(255, 255, 255, .05)" : "transparent") +
1489 - "; outline: none; border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);";
1490 - if (webkit) var oldScrollY = window.scrollY; // Work around Chrome issue (#2712)
1491 - display.input.focus();
1492 - if (webkit) window.scrollTo(null, oldScrollY);
1493 - display.input.reset();
1494 - // Adds "Select all" to context menu in FF
1495 - if (!cm.somethingSelected()) te.value = input.prevInput = " ";
1496 - input.contextMenuPending = true;
1497 - display.selForContextMenu = cm.doc.sel;
1498 - clearTimeout(display.detectingSelectAll);
1499 -
1500 - // Select-all will be greyed out if there's nothing to select, so
1501 - // this adds a zero-width space so that we can later check whether
1502 - // it got selected.
1503 - function prepareSelectAllHack() {
1504 - if (te.selectionStart != null) {
1505 - var selected = cm.somethingSelected();
1506 - var extval = "\u200b" + (selected ? te.value : "");
1507 - te.value = "\u21da"; // Used to catch context-menu undo
1508 - te.value = extval;
1509 - input.prevInput = selected ? "" : "\u200b";
1510 - te.selectionStart = 1; te.selectionEnd = extval.length;
1511 - // Re-set this, in case some other handler touched the
1512 - // selection in the meantime.
1513 - display.selForContextMenu = cm.doc.sel;
1514 - }
1515 - }
1516 - function rehide() {
1517 - input.contextMenuPending = false;
1518 - input.wrapper.style.cssText = oldWrapperCSS
1519 - te.style.cssText = oldCSS;
1520 - if (ie && ie_version < 9) display.scrollbars.setScrollTop(display.scroller.scrollTop = scrollPos);
1521 -
1522 - // Try to detect the user choosing select-all
1523 - if (te.selectionStart != null) {
1524 - if (!ie || (ie && ie_version < 9)) prepareSelectAllHack();
1525 - var i = 0, poll = function() {
1526 - if (display.selForContextMenu == cm.doc.sel && te.selectionStart == 0 &&
1527 - te.selectionEnd > 0 && input.prevInput == "\u200b")
1528 - operation(cm, commands.selectAll)(cm);
1529 - else if (i++ < 10) display.detectingSelectAll = setTimeout(poll, 500);
1530 - else display.input.reset();
1531 - };
1532 - display.detectingSelectAll = setTimeout(poll, 200);
1533 - }
1534 - }
1535 -
1536 - if (ie && ie_version >= 9) prepareSelectAllHack();
1537 - if (captureRightClick) {
1538 - e_stop(e);
1539 - var mouseup = function() {
1540 - off(window, "mouseup", mouseup);
1541 - setTimeout(rehide, 20);
1542 - };
1543 - on(window, "mouseup", mouseup);
1544 - } else {
1545 - setTimeout(rehide, 50);
1546 - }
1547 - },
1548 -
1549 - readOnlyChanged: function(val) {
1550 - if (!val) this.reset();
1551 - },
1552 -
1553 - setUneditable: nothing,
1554 -
1555 - needsContentAttribute: false
1556 - }, TextareaInput.prototype);
1557 -
1558 - // CONTENTEDITABLE INPUT STYLE
1559 -
1560 - function ContentEditableInput(cm) {
1561 - this.cm = cm;
1562 - this.lastAnchorNode = this.lastAnchorOffset = this.lastFocusNode = this.lastFocusOffset = null;
1563 - this.polling = new Delayed();
1564 - this.gracePeriod = false;
1565 - }
1566 -
1567 - ContentEditableInput.prototype = copyObj({
1568 - init: function(display) {
1569 - var input = this, cm = input.cm;
1570 - var div = input.div = display.lineDiv;
1571 - disableBrowserMagic(div);
1572 -
1573 - on(div, "paste", function(e) {
1574 - if (!signalDOMEvent(cm, e)) handlePaste(e, cm);
1575 - })
1576 -
1577 - on(div, "compositionstart", function(e) {
1578 - var data = e.data;
1579 - input.composing = {sel: cm.doc.sel, data: data, startData: data};
1580 - if (!data) return;
1581 - var prim = cm.doc.sel.primary();
1582 - var line = cm.getLine(prim.head.line);
1583 - var found = line.indexOf(data, Math.max(0, prim.head.ch - data.length));
1584 - if (found > -1 && found <= prim.head.ch)
1585 - input.composing.sel = simpleSelection(Pos(prim.head.line, found),
1586 - Pos(prim.head.line, found + data.length));
1587 - });
1588 - on(div, "compositionupdate", function(e) {
1589 - input.composing.data = e.data;
1590 - });
1591 - on(div, "compositionend", function(e) {
1592 - var ours = input.composing;
1593 - if (!ours) return;
1594 - if (e.data != ours.startData && !/\u200b/.test(e.data))
1595 - ours.data = e.data;
1596 - // Need a small delay to prevent other code (input event,
1597 - // selection polling) from doing damage when fired right after
1598 - // compositionend.
1599 - setTimeout(function() {
1600 - if (!ours.handled)
1601 - input.applyComposition(ours);
1602 - if (input.composing == ours)
1603 - input.composing = null;
1604 - }, 50);
1605 - });
1606 -
1607 - on(div, "touchstart", function() {
1608 - input.forceCompositionEnd();
1609 - });
1610 -
1611 - on(div, "input", function() {
1612 - if (input.composing) return;
1613 - if (cm.isReadOnly() || !input.pollContent())
1614 - runInOp(input.cm, function() {regChange(cm);});
1615 - });
1616 -
1617 - function onCopyCut(e) {
1618 - if (signalDOMEvent(cm, e)) return
1619 - if (cm.somethingSelected()) {
1620 - lastCopied = {lineWise: false, text: cm.getSelections()};
1621 - if (e.type == "cut") cm.replaceSelection("", null, "cut");
1622 - } else if (!cm.options.lineWiseCopyCut) {
1623 - return;
1624 - } else {
1625 - var ranges = copyableRanges(cm);
1626 - lastCopied = {lineWise: true, text: ranges.text};
1627 - if (e.type == "cut") {
1628 - cm.operation(function() {
1629 - cm.setSelections(ranges.ranges, 0, sel_dontScroll);
1630 - cm.replaceSelection("", null, "cut");
1631 - });
1632 - }
1633 - }
1634 - // iOS exposes the clipboard API, but seems to discard content inserted into it
1635 - if (e.clipboardData && !ios) {
1636 - e.preventDefault();
1637 - e.clipboardData.clearData();
1638 - e.clipboardData.setData("text/plain", lastCopied.text.join("\n"));
1639 - } else {
1640 - // Old-fashioned briefly-focus-a-textarea hack
1641 - var kludge = hiddenTextarea(), te = kludge.firstChild;
1642 - cm.display.lineSpace.insertBefore(kludge, cm.display.lineSpace.firstChild);
1643 - te.value = lastCopied.text.join("\n");
1644 - var hadFocus = document.activeElement;
1645 - selectInput(te);
1646 - setTimeout(function() {
1647 - cm.display.lineSpace.removeChild(kludge);
1648 - hadFocus.focus();
1649 - }, 50);
1650 - }
1651 - }
1652 - on(div, "copy", onCopyCut);
1653 - on(div, "cut", onCopyCut);
1654 - },
1655 -
1656 - prepareSelection: function() {
1657 - var result = prepareSelection(this.cm, false);
1658 - result.focus = this.cm.state.focused;
1659 - return result;
1660 - },
1661 -
1662 - showSelection: function(info, takeFocus) {
1663 - if (!info || !this.cm.display.view.length) return;
1664 - if (info.focus || takeFocus) this.showPrimarySelection();
1665 - this.showMultipleSelections(info);
1666 - },
1667 -
1668 - showPrimarySelection: function() {
1669 - var sel = window.getSelection(), prim = this.cm.doc.sel.primary();
1670 - var curAnchor = domToPos(this.cm, sel.anchorNode, sel.anchorOffset);
1671 - var curFocus = domToPos(this.cm, sel.focusNode, sel.focusOffset);
1672 - if (curAnchor && !curAnchor.bad && curFocus && !curFocus.bad &&
1673 - cmp(minPos(curAnchor, curFocus), prim.from()) == 0 &&
1674 - cmp(maxPos(curAnchor, curFocus), prim.to()) == 0)
1675 - return;
1676 -
1677 - var start = posToDOM(this.cm, prim.from());
1678 - var end = posToDOM(this.cm, prim.to());
1679 - if (!start && !end) return;
1680 -
1681 - var view = this.cm.display.view;
1682 - var old = sel.rangeCount && sel.getRangeAt(0);
1683 - if (!start) {
1684 - start = {node: view[0].measure.map[2], offset: 0};
1685 - } else if (!end) { // FIXME dangerously hacky
1686 - var measure = view[view.length - 1].measure;
1687 - var map = measure.maps ? measure.maps[measure.maps.length - 1] : measure.map;
1688 - end = {node: map[map.length - 1], offset: map[map.length - 2] - map[map.length - 3]};
1689 - }
1690 -
1691 - try { var rng = range(start.node, start.offset, end.offset, end.node); }
1692 - catch(e) {} // Our model of the DOM might be outdated, in which case the range we try to set can be impossible
1693 - if (rng) {
1694 - if (!gecko && this.cm.state.focused) {
1695 - sel.collapse(start.node, start.offset);
1696 - if (!rng.collapsed) sel.addRange(rng);
1697 - } else {
1698 - sel.removeAllRanges();
1699 - sel.addRange(rng);
1700 - }
1701 - if (old && sel.anchorNode == null) sel.addRange(old);
1702 - else if (gecko) this.startGracePeriod();
1703 - }
1704 - this.rememberSelection();
1705 - },
1706 -
1707 - startGracePeriod: function() {
1708 - var input = this;
1709 - clearTimeout(this.gracePeriod);
1710 - this.gracePeriod = setTimeout(function() {
1711 - input.gracePeriod = false;
1712 - if (input.selectionChanged())
1713 - input.cm.operation(function() { input.cm.curOp.selectionChanged = true; });
1714 - }, 20);
1715 - },
1716 -
1717 - showMultipleSelections: function(info) {
1718 - removeChildrenAndAdd(this.cm.display.cursorDiv, info.cursors);
1719 - removeChildrenAndAdd(this.cm.display.selectionDiv, info.selection);
1720 - },
1721 -
1722 - rememberSelection: function() {
1723 - var sel = window.getSelection();
1724 - this.lastAnchorNode = sel.anchorNode; this.lastAnchorOffset = sel.anchorOffset;
1725 - this.lastFocusNode = sel.focusNode; this.lastFocusOffset = sel.focusOffset;
1726 - },
1727 -
1728 - selectionInEditor: function() {
1729 - var sel = window.getSelection();
1730 - if (!sel.rangeCount) return false;
1731 - var node = sel.getRangeAt(0).commonAncestorContainer;
1732 - return contains(this.div, node);
1733 - },
1734 -
1735 - focus: function() {
1736 - if (this.cm.options.readOnly != "nocursor") this.div.focus();
1737 - },
1738 - blur: function() { this.div.blur(); },
1739 - getField: function() { return this.div; },
1740 -
1741 - supportsTouch: function() { return true; },
1742 -
1743 - receivedFocus: function() {
1744 - var input = this;
1745 - if (this.selectionInEditor())
1746 - this.pollSelection();
1747 - else
1748 - runInOp(this.cm, function() { input.cm.curOp.selectionChanged = true; });
1749 -
1750 - function poll() {
1751 - if (input.cm.state.focused) {
1752 - input.pollSelection();
1753 - input.polling.set(input.cm.options.pollInterval, poll);
1754 - }
1755 - }
1756 - this.polling.set(this.cm.options.pollInterval, poll);
1757 - },
1758 -
1759 - selectionChanged: function() {
1760 - var sel = window.getSelection();
1761 - return sel.anchorNode != this.lastAnchorNode || sel.anchorOffset != this.lastAnchorOffset ||
1762 - sel.focusNode != this.lastFocusNode || sel.focusOffset != this.lastFocusOffset;
1763 - },
1764 -
1765 - pollSelection: function() {
1766 - if (!this.composing && !this.gracePeriod && this.selectionChanged()) {
1767 - var sel = window.getSelection(), cm = this.cm;
1768 - this.rememberSelection();
1769 - var anchor = domToPos(cm, sel.anchorNode, sel.anchorOffset);
1770 - var head = domToPos(cm, sel.focusNode, sel.focusOffset);
1771 - if (anchor && head) runInOp(cm, function() {
1772 - setSelection(cm.doc, simpleSelection(anchor, head), sel_dontScroll);
1773 - if (anchor.bad || head.bad) cm.curOp.selectionChanged = true;
1774 - });
1775 - }
1776 - },
1777 -
1778 - pollContent: function() {
1779 - var cm = this.cm, display = cm.display, sel = cm.doc.sel.primary();
1780 - var from = sel.from(), to = sel.to();
1781 - if (from.line < display.viewFrom || to.line > display.viewTo - 1) return false;
1782 -
1783 - var fromIndex;
1784 - if (from.line == display.viewFrom || (fromIndex = findViewIndex(cm, from.line)) == 0) {
1785 - var fromLine = lineNo(display.view[0].line);
1786 - var fromNode = display.view[0].node;
1787 - } else {
1788 - var fromLine = lineNo(display.view[fromIndex].line);
1789 - var fromNode = display.view[fromIndex - 1].node.nextSibling;
1790 - }
1791 - var toIndex = findViewIndex(cm, to.line);
1792 - if (toIndex == display.view.length - 1) {
1793 - var toLine = display.viewTo - 1;
1794 - var toNode = display.lineDiv.lastChild;
1795 - } else {
1796 - var toLine = lineNo(display.view[toIndex + 1].line) - 1;
1797 - var toNode = display.view[toIndex + 1].node.previousSibling;
1798 - }
1799 -
1800 - var newText = cm.doc.splitLines(domTextBetween(cm, fromNode, toNode, fromLine, toLine));
1801 - var oldText = getBetween(cm.doc, Pos(fromLine, 0), Pos(toLine, getLine(cm.doc, toLine).text.length));
1802 - while (newText.length > 1 && oldText.length > 1) {
1803 - if (lst(newText) == lst(oldText)) { newText.pop(); oldText.pop(); toLine--; }
1804 - else if (newText[0] == oldText[0]) { newText.shift(); oldText.shift(); fromLine++; }
1805 - else break;
1806 - }
1807 -
1808 - var cutFront = 0, cutEnd = 0;
1809 - var newTop = newText[0], oldTop = oldText[0], maxCutFront = Math.min(newTop.length, oldTop.length);
1810 - while (cutFront < maxCutFront && newTop.charCodeAt(cutFront) == oldTop.charCodeAt(cutFront))
1811 - ++cutFront;
1812 - var newBot = lst(newText), oldBot = lst(oldText);
1813 - var maxCutEnd = Math.min(newBot.length - (newText.length == 1 ? cutFront : 0),
1814 - oldBot.length - (oldText.length == 1 ? cutFront : 0));
1815 - while (cutEnd < maxCutEnd &&
1816 - newBot.charCodeAt(newBot.length - cutEnd - 1) == oldBot.charCodeAt(oldBot.length - cutEnd - 1))
1817 - ++cutEnd;
1818 -
1819 - newText[newText.length - 1] = newBot.slice(0, newBot.length - cutEnd);
1820 - newText[0] = newText[0].slice(cutFront);
1821 -
1822 - var chFrom = Pos(fromLine, cutFront);
1823 - var chTo = Pos(toLine, oldText.length ? lst(oldText).length - cutEnd : 0);
1824 - if (newText.length > 1 || newText[0] || cmp(chFrom, chTo)) {
1825 - replaceRange(cm.doc, newText, chFrom, chTo, "+input");
1826 - return true;
1827 - }
1828 - },
1829 -
1830 - ensurePolled: function() {
1831 - this.forceCompositionEnd();
1832 - },
1833 - reset: function() {
1834 - this.forceCompositionEnd();
1835 - },
1836 - forceCompositionEnd: function() {
1837 - if (!this.composing || this.composing.handled) return;
1838 - this.applyComposition(this.composing);
1839 - this.composing.handled = true;
1840 - this.div.blur();
1841 - this.div.focus();
1842 - },
1843 - applyComposition: function(composing) {
1844 - if (this.cm.isReadOnly())
1845 - operation(this.cm, regChange)(this.cm)
1846 - else if (composing.data && composing.data != composing.startData)
1847 - operation(this.cm, applyTextInput)(this.cm, composing.data, 0, composing.sel);
1848 - },
1849 -
1850 - setUneditable: function(node) {
1851 - node.contentEditable = "false"
1852 - },
1853 -
1854 - onKeyPress: function(e) {
1855 - e.preventDefault();
1856 - if (!this.cm.isReadOnly())
1857 - operation(this.cm, applyTextInput)(this.cm, String.fromCharCode(e.charCode == null ? e.keyCode : e.charCode), 0);
1858 - },
1859 -
1860 - readOnlyChanged: function(val) {
1861 - this.div.contentEditable = String(val != "nocursor")
1862 - },
1863 -
1864 - onContextMenu: nothing,
1865 - resetPosition: nothing,
1866 -
1867 - needsContentAttribute: true
1868 - }, ContentEditableInput.prototype);
1869 -
1870 - function posToDOM(cm, pos) {
1871 - var view = findViewForLine(cm, pos.line);
1872 - if (!view || view.hidden) return null;
1873 - var line = getLine(cm.doc, pos.line);
1874 - var info = mapFromLineView(view, line, pos.line);
1875 -
1876 - var order = getOrder(line), side = "left";
1877 - if (order) {
1878 - var partPos = getBidiPartAt(order, pos.ch);
1879 - side = partPos % 2 ? "right" : "left";
1880 - }
1881 - var result = nodeAndOffsetInLineMap(info.map, pos.ch, side);
1882 - result.offset = result.collapse == "right" ? result.end : result.start;
1883 - return result;
1884 - }
1885 -
1886 - function badPos(pos, bad) { if (bad) pos.bad = true; return pos; }
1887 -
1888 - function domToPos(cm, node, offset) {
1889 - var lineNode;
1890 - if (node == cm.display.lineDiv) {
1891 - lineNode = cm.display.lineDiv.childNodes[offset];
1892 - if (!lineNode) return badPos(cm.clipPos(Pos(cm.display.viewTo - 1)), true);
1893 - node = null; offset = 0;
1894 - } else {
1895 - for (lineNode = node;; lineNode = lineNode.parentNode) {
1896 - if (!lineNode || lineNode == cm.display.lineDiv) return null;
1897 - if (lineNode.parentNode && lineNode.parentNode == cm.display.lineDiv) break;
1898 - }
1899 - }
1900 - for (var i = 0; i < cm.display.view.length; i++) {
1901 - var lineView = cm.display.view[i];
1902 - if (lineView.node == lineNode)
1903 - return locateNodeInLineView(lineView, node, offset);
1904 - }
1905 - }
1906 -
1907 - function locateNodeInLineView(lineView, node, offset) {
1908 - var wrapper = lineView.text.firstChild, bad = false;
1909 - if (!node || !contains(wrapper, node)) return badPos(Pos(lineNo(lineView.line), 0), true);
1910 - if (node == wrapper) {
1911 - bad = true;
1912 - node = wrapper.childNodes[offset];
1913 - offset = 0;
1914 - if (!node) {
1915 - var line = lineView.rest ? lst(lineView.rest) : lineView.line;
1916 - return badPos(Pos(lineNo(line), line.text.length), bad);
1917 - }
1918 - }
1919 -
1920 - var textNode = node.nodeType == 3 ? node : null, topNode = node;
1921 - if (!textNode && node.childNodes.length == 1 && node.firstChild.nodeType == 3) {
1922 - textNode = node.firstChild;
1923 - if (offset) offset = textNode.nodeValue.length;
1924 - }
1925 - while (topNode.parentNode != wrapper) topNode = topNode.parentNode;
1926 - var measure = lineView.measure, maps = measure.maps;
1927 -
1928 - function find(textNode, topNode, offset) {
1929 - for (var i = -1; i < (maps ? maps.length : 0); i++) {
1930 - var map = i < 0 ? measure.map : maps[i];
1931 - for (var j = 0; j < map.length; j += 3) {
1932 - var curNode = map[j + 2];
1933 - if (curNode == textNode || curNode == topNode) {
1934 - var line = lineNo(i < 0 ? lineView.line : lineView.rest[i]);
1935 - var ch = map[j] + offset;
1936 - if (offset < 0 || curNode != textNode) ch = map[j + (offset ? 1 : 0)];
1937 - return Pos(line, ch);
1938 - }
1939 - }
1940 - }
1941 - }
1942 - var found = find(textNode, topNode, offset);
1943 - if (found) return badPos(found, bad);
1944 -
1945 - // FIXME this is all really shaky. might handle the few cases it needs to handle, but likely to cause problems
1946 - for (var after = topNode.nextSibling, dist = textNode ? textNode.nodeValue.length - offset : 0; after; after = after.nextSibling) {
1947 - found = find(after, after.firstChild, 0);
1948 - if (found)
1949 - return badPos(Pos(found.line, found.ch - dist), bad);
1950 - else
1951 - dist += after.textContent.length;
1952 - }
1953 - for (var before = topNode.previousSibling, dist = offset; before; before = before.previousSibling) {
1954 - found = find(before, before.firstChild, -1);
1955 - if (found)
1956 - return badPos(Pos(found.line, found.ch + dist), bad);
1957 - else
1958 - dist += after.textContent.length;
1959 - }
1960 - }
1961 -
1962 - function domTextBetween(cm, from, to, fromLine, toLine) {
1963 - var text = "", closing = false, lineSep = cm.doc.lineSeparator();
1964 - function recognizeMarker(id) { return function(marker) { return marker.id == id; }; }
1965 - function walk(node) {
1966 - if (node.nodeType == 1) {
1967 - var cmText = node.getAttribute("cm-text");
1968 - if (cmText != null) {
1969 - if (cmText == "") cmText = node.textContent.replace(/\u200b/g, "");
1970 - text += cmText;
1971 - return;
1972 - }
1973 - var markerID = node.getAttribute("cm-marker"), range;
1974 - if (markerID) {
1975 - var found = cm.findMarks(Pos(fromLine, 0), Pos(toLine + 1, 0), recognizeMarker(+markerID));
1976 - if (found.length && (range = found[0].find()))
1977 - text += getBetween(cm.doc, range.from, range.to).join(lineSep);
1978 - return;
1979 - }
1980 - if (node.getAttribute("contenteditable") == "false") return;
1981 - for (var i = 0; i < node.childNodes.length; i++)
1982 - walk(node.childNodes[i]);
1983 - if (/^(pre|div|p)$/i.test(node.nodeName))
1984 - closing = true;
1985 - } else if (node.nodeType == 3) {
1986 - var val = node.nodeValue;
1987 - if (!val) return;
1988 - if (closing) {
1989 - text += lineSep;
1990 - closing = false;
1991 - }
1992 - text += val;
1993 - }
1994 - }
1995 - for (;;) {
1996 - walk(from);
1997 - if (from == to) break;
1998 - from = from.nextSibling;
1999 - }
2000 - return text;
2001 - }
2002 -
2003 - CodeMirror.inputStyles = {"textarea": TextareaInput, "contenteditable": ContentEditableInput};
2004 -
2005 - // SELECTION / CURSOR
2006 -
2007 - // Selection objects are immutable. A new one is created every time
2008 - // the selection changes. A selection is one or more non-overlapping
2009 - // (and non-touching) ranges, sorted, and an integer that indicates
2010 - // which one is the primary selection (the one that's scrolled into
2011 - // view, that getCursor returns, etc).
2012 - function Selection(ranges, primIndex) {
2013 - this.ranges = ranges;
2014 - this.primIndex = primIndex;
2015 - }
2016 -
2017 - Selection.prototype = {
2018 - primary: function() { return this.ranges[this.primIndex]; },
2019 - equals: function(other) {
2020 - if (other == this) return true;
2021 - if (other.primIndex != this.primIndex || other.ranges.length != this.ranges.length) return false;
2022 - for (var i = 0; i < this.ranges.length; i++) {
2023 - var here = this.ranges[i], there = other.ranges[i];
2024 - if (cmp(here.anchor, there.anchor) != 0 || cmp(here.head, there.head) != 0) return false;
2025 - }
2026 - return true;
2027 - },
2028 - deepCopy: function() {
2029 - for (var out = [], i = 0; i < this.ranges.length; i++)
2030 - out[i] = new Range(copyPos(this.ranges[i].anchor), copyPos(this.ranges[i].head));
2031 - return new Selection(out, this.primIndex);
2032 - },
2033 - somethingSelected: function() {
2034 - for (var i = 0; i < this.ranges.length; i++)
2035 - if (!this.ranges[i].empty()) return true;
2036 - return false;
2037 - },
2038 - contains: function(pos, end) {
2039 - if (!end) end = pos;
2040 - for (var i = 0; i < this.ranges.length; i++) {
2041 - var range = this.ranges[i];
2042 - if (cmp(end, range.from()) >= 0 && cmp(pos, range.to()) <= 0)
2043 - return i;
2044 - }
2045 - return -1;
2046 - }
2047 - };
2048 -
2049 - function Range(anchor, head) {
2050 - this.anchor = anchor; this.head = head;
2051 - }
2052 -
2053 - Range.prototype = {
2054 - from: function() { return minPos(this.anchor, this.head); },
2055 - to: function() { return maxPos(this.anchor, this.head); },
2056 - empty: function() {
2057 - return this.head.line == this.anchor.line && this.head.ch == this.anchor.ch;
2058 - }
2059 - };
2060 -
2061 - // Take an unsorted, potentially overlapping set of ranges, and
2062 - // build a selection out of it. 'Consumes' ranges array (modifying
2063 - // it).
2064 - function normalizeSelection(ranges, primIndex) {
2065 - var prim = ranges[primIndex];
2066 - ranges.sort(function(a, b) { return cmp(a.from(), b.from()); });
2067 - primIndex = indexOf(ranges, prim);
2068 - for (var i = 1; i < ranges.length; i++) {
2069 - var cur = ranges[i], prev = ranges[i - 1];
2070 - if (cmp(prev.to(), cur.from()) >= 0) {
2071 - var from = minPos(prev.from(), cur.from()), to = maxPos(prev.to(), cur.to());
2072 - var inv = prev.empty() ? cur.from() == cur.head : prev.from() == prev.head;
2073 - if (i <= primIndex) --primIndex;
2074 - ranges.splice(--i, 2, new Range(inv ? to : from, inv ? from : to));
2075 - }
2076 - }
2077 - return new Selection(ranges, primIndex);
2078 - }
2079 -
2080 - function simpleSelection(anchor, head) {
2081 - return new Selection([new Range(anchor, head || anchor)], 0);
2082 - }
2083 -
2084 - // Most of the external API clips given positions to make sure they
2085 - // actually exist within the document.
2086 - function clipLine(doc, n) {return Math.max(doc.first, Math.min(n, doc.first + doc.size - 1));}
2087 - function clipPos(doc, pos) {
2088 - if (pos.line < doc.first) return Pos(doc.first, 0);
2089 - var last = doc.first + doc.size - 1;
2090 - if (pos.line > last) return Pos(last, getLine(doc, last).text.length);
2091 - return clipToLen(pos, getLine(doc, pos.line).text.length);
2092 - }
2093 - function clipToLen(pos, linelen) {
2094 - var ch = pos.ch;
2095 - if (ch == null || ch > linelen) return Pos(pos.line, linelen);
2096 - else if (ch < 0) return Pos(pos.line, 0);
2097 - else return pos;
2098 - }
2099 - function isLine(doc, l) {return l >= doc.first && l < doc.first + doc.size;}
2100 - function clipPosArray(doc, array) {
2101 - for (var out = [], i = 0; i < array.length; i++) out[i] = clipPos(doc, array[i]);
2102 - return out;
2103 - }
2104 -
2105 - // SELECTION UPDATES
2106 -
2107 - // The 'scroll' parameter given to many of these indicated whether
2108 - // the new cursor position should be scrolled into view after
2109 - // modifying the selection.
2110 -
2111 - // If shift is held or the extend flag is set, extends a range to
2112 - // include a given position (and optionally a second position).
2113 - // Otherwise, simply returns the range between the given positions.
2114 - // Used for cursor motion and such.
2115 - function extendRange(doc, range, head, other) {
2116 - if (doc.cm && doc.cm.display.shift || doc.extend) {
2117 - var anchor = range.anchor;
2118 - if (other) {
2119 - var posBefore = cmp(head, anchor) < 0;
2120 - if (posBefore != (cmp(other, anchor) < 0)) {
2121 - anchor = head;
2122 - head = other;
2123 - } else if (posBefore != (cmp(head, other) < 0)) {
2124 - head = other;
2125 - }
2126 - }
2127 - return new Range(anchor, head);
2128 - } else {
2129 - return new Range(other || head, head);
2130 - }
2131 - }
2132 -
2133 - // Extend the primary selection range, discard the rest.
2134 - function extendSelection(doc, head, other, options) {
2135 - setSelection(doc, new Selection([extendRange(doc, doc.sel.primary(), head, other)], 0), options);
2136 - }
2137 -
2138 - // Extend all selections (pos is an array of selections with length
2139 - // equal the number of selections)
2140 - function extendSelections(doc, heads, options) {
2141 - for (var out = [], i = 0; i < doc.sel.ranges.length; i++)
2142 - out[i] = extendRange(doc, doc.sel.ranges[i], heads[i], null);
2143 - var newSel = normalizeSelection(out, doc.sel.primIndex);
2144 - setSelection(doc, newSel, options);
2145 - }
2146 -
2147 - // Updates a single range in the selection.
2148 - function replaceOneSelection(doc, i, range, options) {
2149 - var ranges = doc.sel.ranges.slice(0);
2150 - ranges[i] = range;
2151 - setSelection(doc, normalizeSelection(ranges, doc.sel.primIndex), options);
2152 - }
2153 -
2154 - // Reset the selection to a single range.
2155 - function setSimpleSelection(doc, anchor, head, options) {
2156 - setSelection(doc, simpleSelection(anchor, head), options);
2157 - }
2158 -
2159 - // Give beforeSelectionChange handlers a change to influence a
2160 - // selection update.
2161 - function filterSelectionChange(doc, sel, options) {
2162 - var obj = {
2163 - ranges: sel.ranges,
2164 - update: function(ranges) {
2165 - this.ranges = [];
2166 - for (var i = 0; i < ranges.length; i++)
2167 - this.ranges[i] = new Range(clipPos(doc, ranges[i].anchor),
2168 - clipPos(doc, ranges[i].head));
2169 - },
2170 - origin: options && options.origin
2171 - };
2172 - signal(doc, "beforeSelectionChange", doc, obj);
2173 - if (doc.cm) signal(doc.cm, "beforeSelectionChange", doc.cm, obj);
2174 - if (obj.ranges != sel.ranges) return normalizeSelection(obj.ranges, obj.ranges.length - 1);
2175 - else return sel;
2176 - }
2177 -
2178 - function setSelectionReplaceHistory(doc, sel, options) {
2179 - var done = doc.history.done, last = lst(done);
2180 - if (last && last.ranges) {
2181 - done[done.length - 1] = sel;
2182 - setSelectionNoUndo(doc, sel, options);
2183 - } else {
2184 - setSelection(doc, sel, options);
2185 - }
2186 - }
2187 -
2188 - // Set a new selection.
2189 - function setSelection(doc, sel, options) {
2190 - setSelectionNoUndo(doc, sel, options);
2191 - addSelectionToHistory(doc, doc.sel, doc.cm ? doc.cm.curOp.id : NaN, options);
2192 - }
2193 -
2194 - function setSelectionNoUndo(doc, sel, options) {
2195 - if (hasHandler(doc, "beforeSelectionChange") || doc.cm && hasHandler(doc.cm, "beforeSelectionChange"))
2196 - sel = filterSelectionChange(doc, sel, options);
2197 -
2198 - var bias = options && options.bias ||
2199 - (cmp(sel.primary().head, doc.sel.primary().head) < 0 ? -1 : 1);
2200 - setSelectionInner(doc, skipAtomicInSelection(doc, sel, bias, true));
2201 -
2202 - if (!(options && options.scroll === false) && doc.cm)
2203 - ensureCursorVisible(doc.cm);
2204 - }
2205 -
2206 - function setSelectionInner(doc, sel) {
2207 - if (sel.equals(doc.sel)) return;
2208 -
2209 - doc.sel = sel;
2210 -
2211 - if (doc.cm) {
2212 - doc.cm.curOp.updateInput = doc.cm.curOp.selectionChanged = true;
2213 - signalCursorActivity(doc.cm);
2214 - }
2215 - signalLater(doc, "cursorActivity", doc);
2216 - }
2217 -
2218 - // Verify that the selection does not partially select any atomic
2219 - // marked ranges.
2220 - function reCheckSelection(doc) {
2221 - setSelectionInner(doc, skipAtomicInSelection(doc, doc.sel, null, false), sel_dontScroll);
2222 - }
2223 -
2224 - // Return a selection that does not partially select any atomic
2225 - // ranges.
2226 - function skipAtomicInSelection(doc, sel, bias, mayClear) {
2227 - var out;
2228 - for (var i = 0; i < sel.ranges.length; i++) {
2229 - var range = sel.ranges[i];
2230 - var old = sel.ranges.length == doc.sel.ranges.length && doc.sel.ranges[i];
2231 - var newAnchor = skipAtomic(doc, range.anchor, old && old.anchor, bias, mayClear);
2232 - var newHead = skipAtomic(doc, range.head, old && old.head, bias, mayClear);
2233 - if (out || newAnchor != range.anchor || newHead != range.head) {
2234 - if (!out) out = sel.ranges.slice(0, i);
2235 - out[i] = new Range(newAnchor, newHead);
2236 - }
2237 - }
2238 - return out ? normalizeSelection(out, sel.primIndex) : sel;
2239 - }
2240 -
2241 - function skipAtomicInner(doc, pos, oldPos, dir, mayClear) {
2242 - var line = getLine(doc, pos.line);
2243 - if (line.markedSpans) for (var i = 0; i < line.markedSpans.length; ++i) {
2244 - var sp = line.markedSpans[i], m = sp.marker;
2245 - if ((sp.from == null || (m.inclusiveLeft ? sp.from <= pos.ch : sp.from < pos.ch)) &&
2246 - (sp.to == null || (m.inclusiveRight ? sp.to >= pos.ch : sp.to > pos.ch))) {
2247 - if (mayClear) {
2248 - signal(m, "beforeCursorEnter");
2249 - if (m.explicitlyCleared) {
2250 - if (!line.markedSpans) break;
2251 - else {--i; continue;}
2252 - }
2253 - }
2254 - if (!m.atomic) continue;
2255 -
2256 - if (oldPos) {
2257 - var near = m.find(dir < 0 ? 1 : -1), diff;
2258 - if (dir < 0 ? m.inclusiveRight : m.inclusiveLeft)
2259 - near = movePos(doc, near, -dir, near && near.line == pos.line ? line : null);
2260 - if (near && near.line == pos.line && (diff = cmp(near, oldPos)) && (dir < 0 ? diff < 0 : diff > 0))
2261 - return skipAtomicInner(doc, near, pos, dir, mayClear);
2262 - }
2263 -
2264 - var far = m.find(dir < 0 ? -1 : 1);
2265 - if (dir < 0 ? m.inclusiveLeft : m.inclusiveRight)
2266 - far = movePos(doc, far, dir, far.line == pos.line ? line : null);
2267 - return far ? skipAtomicInner(doc, far, pos, dir, mayClear) : null;
2268 - }
2269 - }
2270 - return pos;
2271 - }
2272 -
2273 - // Ensure a given position is not inside an atomic range.
2274 - function skipAtomic(doc, pos, oldPos, bias, mayClear) {
2275 - var dir = bias || 1;
2276 - var found = skipAtomicInner(doc, pos, oldPos, dir, mayClear) ||
2277 - (!mayClear && skipAtomicInner(doc, pos, oldPos, dir, true)) ||
2278 - skipAtomicInner(doc, pos, oldPos, -dir, mayClear) ||
2279 - (!mayClear && skipAtomicInner(doc, pos, oldPos, -dir, true));
2280 - if (!found) {
2281 - doc.cantEdit = true;
2282 - return Pos(doc.first, 0);
2283 - }
2284 - return found;
2285 - }
2286 -
2287 - function movePos(doc, pos, dir, line) {
2288 - if (dir < 0 && pos.ch == 0) {
2289 - if (pos.line > doc.first) return clipPos(doc, Pos(pos.line - 1));
2290 - else return null;
2291 - } else if (dir > 0 && pos.ch == (line || getLine(doc, pos.line)).text.length) {
2292 - if (pos.line < doc.first + doc.size - 1) return Pos(pos.line + 1, 0);
2293 - else return null;
2294 - } else {
2295 - return new Pos(pos.line, pos.ch + dir);
2296 - }
2297 - }
2298 -
2299 - // SELECTION DRAWING
2300 -
2301 - function updateSelection(cm) {
2302 - cm.display.input.showSelection(cm.display.input.prepareSelection());
2303 - }
2304 -
2305 - function prepareSelection(cm, primary) {
2306 - var doc = cm.doc, result = {};
2307 - var curFragment = result.cursors = document.createDocumentFragment();
2308 - var selFragment = result.selection = document.createDocumentFragment();
2309 -
2310 - for (var i = 0; i < doc.sel.ranges.length; i++) {
2311 - if (primary === false && i == doc.sel.primIndex) continue;
2312 - var range = doc.sel.ranges[i];
2313 - if (range.from().line >= cm.display.viewTo || range.to().line < cm.display.viewFrom) continue;
2314 - var collapsed = range.empty();
2315 - if (collapsed || cm.options.showCursorWhenSelecting)
2316 - drawSelectionCursor(cm, range.head, curFragment);
2317 - if (!collapsed)
2318 - drawSelectionRange(cm, range, selFragment);
2319 - }
2320 - return result;
2321 - }
2322 -
2323 - // Draws a cursor for the given range
2324 - function drawSelectionCursor(cm, head, output) {
2325 - var pos = cursorCoords(cm, head, "div", null, null, !cm.options.singleCursorHeightPerLine);
2326 -
2327 - var cursor = output.appendChild(elt("div", "\u00a0", "CodeMirror-cursor"));
2328 - cursor.style.left = pos.left + "px";
2329 - cursor.style.top = pos.top + "px";
2330 - cursor.style.height = Math.max(0, pos.bottom - pos.top) * cm.options.cursorHeight + "px";
2331 -
2332 - if (pos.other) {
2333 - // Secondary cursor, shown when on a 'jump' in bi-directional text
2334 - var otherCursor = output.appendChild(elt("div", "\u00a0", "CodeMirror-cursor CodeMirror-secondarycursor"));
2335 - otherCursor.style.display = "";
2336 - otherCursor.style.left = pos.other.left + "px";
2337 - otherCursor.style.top = pos.other.top + "px";
2338 - otherCursor.style.height = (pos.other.bottom - pos.other.top) * .85 + "px";
2339 - }
2340 - }
2341 -
2342 - // Draws the given range as a highlighted selection
2343 - function drawSelectionRange(cm, range, output) {
2344 - var display = cm.display, doc = cm.doc;
2345 - var fragment = document.createDocumentFragment();
2346 - var padding = paddingH(cm.display), leftSide = padding.left;
2347 - var rightSide = Math.max(display.sizerWidth, displayWidth(cm) - display.sizer.offsetLeft) - padding.right;
2348 -
2349 - function add(left, top, width, bottom) {
2350 - if (top < 0) top = 0;
2351 - top = Math.round(top);
2352 - bottom = Math.round(bottom);
2353 - fragment.appendChild(elt("div", null, "CodeMirror-selected", "position: absolute; left: " + left +
2354 - "px; top: " + top + "px; width: " + (width == null ? rightSide - left : width) +
2355 - "px; height: " + (bottom - top) + "px"));
2356 - }
2357 -
2358 - function drawForLine(line, fromArg, toArg) {
2359 - var lineObj = getLine(doc, line);
2360 - var lineLen = lineObj.text.length;
2361 - var start, end;
2362 - function coords(ch, bias) {
2363 - return charCoords(cm, Pos(line, ch), "div", lineObj, bias);
2364 - }
2365 -
2366 - iterateBidiSections(getOrder(lineObj), fromArg || 0, toArg == null ? lineLen : toArg, function(from, to, dir) {
2367 - var leftPos = coords(from, "left"), rightPos, left, right;
2368 - if (from == to) {
2369 - rightPos = leftPos;
2370 - left = right = leftPos.left;
2371 - } else {
2372 - rightPos = coords(to - 1, "right");
2373 - if (dir == "rtl") { var tmp = leftPos; leftPos = rightPos; rightPos = tmp; }
2374 - left = leftPos.left;
2375 - right = rightPos.right;
2376 - }
2377 - if (fromArg == null && from == 0) left = leftSide;
2378 - if (rightPos.top - leftPos.top > 3) { // Different lines, draw top part
2379 - add(left, leftPos.top, null, leftPos.bottom);
2380 - left = leftSide;
2381 - if (leftPos.bottom < rightPos.top) add(left, leftPos.bottom, null, rightPos.top);
2382 - }
2383 - if (toArg == null && to == lineLen) right = rightSide;
2384 - if (!start || leftPos.top < start.top || leftPos.top == start.top && leftPos.left < start.left)
2385 - start = leftPos;
2386 - if (!end || rightPos.bottom > end.bottom || rightPos.bottom == end.bottom && rightPos.right > end.right)
2387 - end = rightPos;
2388 - if (left < leftSide + 1) left = leftSide;
2389 - add(left, rightPos.top, right - left, rightPos.bottom);
2390 - });
2391 - return {start: start, end: end};
2392 - }
2393 -
2394 - var sFrom = range.from(), sTo = range.to();
2395 - if (sFrom.line == sTo.line) {
2396 - drawForLine(sFrom.line, sFrom.ch, sTo.ch);
2397 - } else {
2398 - var fromLine = getLine(doc, sFrom.line), toLine = getLine(doc, sTo.line);
2399 - var singleVLine = visualLine(fromLine) == visualLine(toLine);
2400 - var leftEnd = drawForLine(sFrom.line, sFrom.ch, singleVLine ? fromLine.text.length + 1 : null).end;
2401 - var rightStart = drawForLine(sTo.line, singleVLine ? 0 : null, sTo.ch).start;
2402 - if (singleVLine) {
2403 - if (leftEnd.top < rightStart.top - 2) {
2404 - add(leftEnd.right, leftEnd.top, null, leftEnd.bottom);
2405 - add(leftSide, rightStart.top, rightStart.left, rightStart.bottom);
2406 - } else {
2407 - add(leftEnd.right, leftEnd.top, rightStart.left - leftEnd.right, leftEnd.bottom);
2408 - }
2409 - }
2410 - if (leftEnd.bottom < rightStart.top)
2411 - add(leftSide, leftEnd.bottom, null, rightStart.top);
2412 - }
2413 -
2414 - output.appendChild(fragment);
2415 - }
2416 -
2417 - // Cursor-blinking
2418 - function restartBlink(cm) {
2419 - if (!cm.state.focused) return;
2420 - var display = cm.display;
2421 - clearInterval(display.blinker);
2422 - var on = true;
2423 - display.cursorDiv.style.visibility = "";
2424 - if (cm.options.cursorBlinkRate > 0)
2425 - display.blinker = setInterval(function() {
2426 - display.cursorDiv.style.visibility = (on = !on) ? "" : "hidden";
2427 - }, cm.options.cursorBlinkRate);
2428 - else if (cm.options.cursorBlinkRate < 0)
2429 - display.cursorDiv.style.visibility = "hidden";
2430 - }
2431 -
2432 - // HIGHLIGHT WORKER
2433 -
2434 - function startWorker(cm, time) {
2435 - if (cm.doc.mode.startState && cm.doc.frontier < cm.display.viewTo)
2436 - cm.state.highlight.set(time, bind(highlightWorker, cm));
2437 - }
2438 -
2439 - function highlightWorker(cm) {
2440 - var doc = cm.doc;
2441 - if (doc.frontier < doc.first) doc.frontier = doc.first;
2442 - if (doc.frontier >= cm.display.viewTo) return;
2443 - var end = +new Date + cm.options.workTime;
2444 - var state = copyState(doc.mode, getStateBefore(cm, doc.frontier));
2445 - var changedLines = [];
2446 -
2447 - doc.iter(doc.frontier, Math.min(doc.first + doc.size, cm.display.viewTo + 500), function(line) {
2448 - if (doc.frontier >= cm.display.viewFrom) { // Visible
2449 - var oldStyles = line.styles, tooLong = line.text.length > cm.options.maxHighlightLength;
2450 - var highlighted = highlightLine(cm, line, tooLong ? copyState(doc.mode, state) : state, true);
2451 - line.styles = highlighted.styles;
2452 - var oldCls = line.styleClasses, newCls = highlighted.classes;
2453 - if (newCls) line.styleClasses = newCls;
2454 - else if (oldCls) line.styleClasses = null;
2455 - var ischange = !oldStyles || oldStyles.length != line.styles.length ||
2456 - oldCls != newCls && (!oldCls || !newCls || oldCls.bgClass != newCls.bgClass || oldCls.textClass != newCls.textClass);
2457 - for (var i = 0; !ischange && i < oldStyles.length; ++i) ischange = oldStyles[i] != line.styles[i];
2458 - if (ischange) changedLines.push(doc.frontier);
2459 - line.stateAfter = tooLong ? state : copyState(doc.mode, state);
2460 - } else {
2461 - if (line.text.length <= cm.options.maxHighlightLength)
2462 - processLine(cm, line.text, state);
2463 - line.stateAfter = doc.frontier % 5 == 0 ? copyState(doc.mode, state) : null;
2464 - }
2465 - ++doc.frontier;
2466 - if (+new Date > end) {
2467 - startWorker(cm, cm.options.workDelay);
2468 - return true;
2469 - }
2470 - });
2471 - if (changedLines.length) runInOp(cm, function() {
2472 - for (var i = 0; i < changedLines.length; i++)
2473 - regLineChange(cm, changedLines[i], "text");
2474 - });
2475 - }
2476 -
2477 - // Finds the line to start with when starting a parse. Tries to
2478 - // find a line with a stateAfter, so that it can start with a
2479 - // valid state. If that fails, it returns the line with the
2480 - // smallest indentation, which tends to need the least context to
2481 - // parse correctly.
2482 - function findStartLine(cm, n, precise) {
2483 - var minindent, minline, doc = cm.doc;
2484 - var lim = precise ? -1 : n - (cm.doc.mode.innerMode ? 1000 : 100);
2485 - for (var search = n; search > lim; --search) {
2486 - if (search <= doc.first) return doc.first;
2487 - var line = getLine(doc, search - 1);
2488 - if (line.stateAfter && (!precise || search <= doc.frontier)) return search;
2489 - var indented = countColumn(line.text, null, cm.options.tabSize);
2490 - if (minline == null || minindent > indented) {
2491 - minline = search - 1;
2492 - minindent = indented;
2493 - }
2494 - }
2495 - return minline;
2496 - }
2497 -
2498 - function getStateBefore(cm, n, precise) {
2499 - var doc = cm.doc, display = cm.display;
2500 - if (!doc.mode.startState) return true;
2501 - var pos = findStartLine(cm, n, precise), state = pos > doc.first && getLine(doc, pos-1).stateAfter;
2502 - if (!state) state = startState(doc.mode);
2503 - else state = copyState(doc.mode, state);
2504 - doc.iter(pos, n, function(line) {
2505 - processLine(cm, line.text, state);
2506 - var save = pos == n - 1 || pos % 5 == 0 || pos >= display.viewFrom && pos < display.viewTo;
2507 - line.stateAfter = save ? copyState(doc.mode, state) : null;
2508 - ++pos;
2509 - });
2510 - if (precise) doc.frontier = pos;
2511 - return state;
2512 - }
2513 -
2514 - // POSITION MEASUREMENT
2515 -
2516 - function paddingTop(display) {return display.lineSpace.offsetTop;}
2517 - function paddingVert(display) {return display.mover.offsetHeight - display.lineSpace.offsetHeight;}
2518 - function paddingH(display) {
2519 - if (display.cachedPaddingH) return display.cachedPaddingH;
2520 - var e = removeChildrenAndAdd(display.measure, elt("pre", "x"));
2521 - var style = window.getComputedStyle ? window.getComputedStyle(e) : e.currentStyle;
2522 - var data = {left: parseInt(style.paddingLeft), right: parseInt(style.paddingRight)};
2523 - if (!isNaN(data.left) && !isNaN(data.right)) display.cachedPaddingH = data;
2524 - return data;
2525 - }
2526 -
2527 - function scrollGap(cm) { return scrollerGap - cm.display.nativeBarWidth; }
2528 - function displayWidth(cm) {
2529 - return cm.display.scroller.clientWidth - scrollGap(cm) - cm.display.barWidth;
2530 - }
2531 - function displayHeight(cm) {
2532 - return cm.display.scroller.clientHeight - scrollGap(cm) - cm.display.barHeight;
2533 - }
2534 -
2535 - // Ensure the lineView.wrapping.heights array is populated. This is
2536 - // an array of bottom offsets for the lines that make up a drawn
2537 - // line. When lineWrapping is on, there might be more than one
2538 - // height.
2539 - function ensureLineHeights(cm, lineView, rect) {
2540 - var wrapping = cm.options.lineWrapping;
2541 - var curWidth = wrapping && displayWidth(cm);
2542 - if (!lineView.measure.heights || wrapping && lineView.measure.width != curWidth) {
2543 - var heights = lineView.measure.heights = [];
2544 - if (wrapping) {
2545 - lineView.measure.width = curWidth;
2546 - var rects = lineView.text.firstChild.getClientRects();
2547 - for (var i = 0; i < rects.length - 1; i++) {
2548 - var cur = rects[i], next = rects[i + 1];
2549 - if (Math.abs(cur.bottom - next.bottom) > 2)
2550 - heights.push((cur.bottom + next.top) / 2 - rect.top);
2551 - }
2552 - }
2553 - heights.push(rect.bottom - rect.top);
2554 - }
2555 - }
2556 -
2557 - // Find a line map (mapping character offsets to text nodes) and a
2558 - // measurement cache for the given line number. (A line view might
2559 - // contain multiple lines when collapsed ranges are present.)
2560 - function mapFromLineView(lineView, line, lineN) {
2561 - if (lineView.line == line)
2562 - return {map: lineView.measure.map, cache: lineView.measure.cache};
2563 - for (var i = 0; i < lineView.rest.length; i++)
2564 - if (lineView.rest[i] == line)
2565 - return {map: lineView.measure.maps[i], cache: lineView.measure.caches[i]};
2566 - for (var i = 0; i < lineView.rest.length; i++)
2567 - if (lineNo(lineView.rest[i]) > lineN)
2568 - return {map: lineView.measure.maps[i], cache: lineView.measure.caches[i], before: true};
2569 - }
2570 -
2571 - // Render a line into the hidden node display.externalMeasured. Used
2572 - // when measurement is needed for a line that's not in the viewport.
2573 - function updateExternalMeasurement(cm, line) {
2574 - line = visualLine(line);
2575 - var lineN = lineNo(line);
2576 - var view = cm.display.externalMeasured = new LineView(cm.doc, line, lineN);
2577 - view.lineN = lineN;
2578 - var built = view.built = buildLineContent(cm, view);
2579 - view.text = built.pre;
2580 - removeChildrenAndAdd(cm.display.lineMeasure, built.pre);
2581 - return view;
2582 - }
2583 -
2584 - // Get a {top, bottom, left, right} box (in line-local coordinates)
2585 - // for a given character.
2586 - function measureChar(cm, line, ch, bias) {
2587 - return measureCharPrepared(cm, prepareMeasureForLine(cm, line), ch, bias);
2588 - }
2589 -
2590 - // Find a line view that corresponds to the given line number.
2591 - function findViewForLine(cm, lineN) {
2592 - if (lineN >= cm.display.viewFrom && lineN < cm.display.viewTo)
2593 - return cm.display.view[findViewIndex(cm, lineN)];
2594 - var ext = cm.display.externalMeasured;
2595 - if (ext && lineN >= ext.lineN && lineN < ext.lineN + ext.size)
2596 - return ext;
2597 - }
2598 -
2599 - // Measurement can be split in two steps, the set-up work that
2600 - // applies to the whole line, and the measurement of the actual
2601 - // character. Functions like coordsChar, that need to do a lot of
2602 - // measurements in a row, can thus ensure that the set-up work is
2603 - // only done once.
2604 - function prepareMeasureForLine(cm, line) {
2605 - var lineN = lineNo(line);
2606 - var view = findViewForLine(cm, lineN);
2607 - if (view && !view.text) {
2608 - view = null;
2609 - } else if (view && view.changes) {
2610 - updateLineForChanges(cm, view, lineN, getDimensions(cm));
2611 - cm.curOp.forceUpdate = true;
2612 - }
2613 - if (!view)
2614 - view = updateExternalMeasurement(cm, line);
2615 -
2616 - var info = mapFromLineView(view, line, lineN);
2617 - return {
2618 - line: line, view: view, rect: null,
2619 - map: info.map, cache: info.cache, before: info.before,
2620 - hasHeights: false
2621 - };
2622 - }
2623 -
2624 - // Given a prepared measurement object, measures the position of an
2625 - // actual character (or fetches it from the cache).
2626 - function measureCharPrepared(cm, prepared, ch, bias, varHeight) {
2627 - if (prepared.before) ch = -1;
2628 - var key = ch + (bias || ""), found;
2629 - if (prepared.cache.hasOwnProperty(key)) {
2630 - found = prepared.cache[key];
2631 - } else {
2632 - if (!prepared.rect)
2633 - prepared.rect = prepared.view.text.getBoundingClientRect();
2634 - if (!prepared.hasHeights) {
2635 - ensureLineHeights(cm, prepared.view, prepared.rect);
2636 - prepared.hasHeights = true;
2637 - }
2638 - found = measureCharInner(cm, prepared, ch, bias);
2639 - if (!found.bogus) prepared.cache[key] = found;
2640 - }
2641 - return {left: found.left, right: found.right,
2642 - top: varHeight ? found.rtop : found.top,
2643 - bottom: varHeight ? found.rbottom : found.bottom};
2644 - }
2645 -
2646 - var nullRect = {left: 0, right: 0, top: 0, bottom: 0};
2647 -
2648 - function nodeAndOffsetInLineMap(map, ch, bias) {
2649 - var node, start, end, collapse;
2650 - // First, search the line map for the text node corresponding to,
2651 - // or closest to, the target character.
2652 - for (var i = 0; i < map.length; i += 3) {
2653 - var mStart = map[i], mEnd = map[i + 1];
2654 - if (ch < mStart) {
2655 - start = 0; end = 1;
2656 - collapse = "left";
2657 - } else if (ch < mEnd) {
2658 - start = ch - mStart;
2659 - end = start + 1;
2660 - } else if (i == map.length - 3 || ch == mEnd && map[i + 3] > ch) {
2661 - end = mEnd - mStart;
2662 - start = end - 1;
2663 - if (ch >= mEnd) collapse = "right";
2664 - }
2665 - if (start != null) {
2666 - node = map[i + 2];
2667 - if (mStart == mEnd && bias == (node.insertLeft ? "left" : "right"))
2668 - collapse = bias;
2669 - if (bias == "left" && start == 0)
2670 - while (i && map[i - 2] == map[i - 3] && map[i - 1].insertLeft) {
2671 - node = map[(i -= 3) + 2];
2672 - collapse = "left";
2673 - }
2674 - if (bias == "right" && start == mEnd - mStart)
2675 - while (i < map.length - 3 && map[i + 3] == map[i + 4] && !map[i + 5].insertLeft) {
2676 - node = map[(i += 3) + 2];
2677 - collapse = "right";
2678 - }
2679 - break;
2680 - }
2681 - }
2682 - return {node: node, start: start, end: end, collapse: collapse, coverStart: mStart, coverEnd: mEnd};
2683 - }
2684 -
2685 - function measureCharInner(cm, prepared, ch, bias) {
2686 - var place = nodeAndOffsetInLineMap(prepared.map, ch, bias);
2687 - var node = place.node, start = place.start, end = place.end, collapse = place.collapse;
2688 -
2689 - var rect;
2690 - if (node.nodeType == 3) { // If it is a text node, use a range to retrieve the coordinates.
2691 - for (var i = 0; i < 4; i++) { // Retry a maximum of 4 times when nonsense rectangles are returned
2692 - while (start && isExtendingChar(prepared.line.text.charAt(place.coverStart + start))) --start;
2693 - while (place.coverStart + end < place.coverEnd && isExtendingChar(prepared.line.text.charAt(place.coverStart + end))) ++end;
2694 - if (ie && ie_version < 9 && start == 0 && end == place.coverEnd - place.coverStart) {
2695 - rect = node.parentNode.getBoundingClientRect();
2696 - } else if (ie && cm.options.lineWrapping) {
2697 - var rects = range(node, start, end).getClientRects();
2698 - if (rects.length)
2699 - rect = rects[bias == "right" ? rects.length - 1 : 0];
2700 - else
2701 - rect = nullRect;
2702 - } else {
2703 - rect = range(node, start, end).getBoundingClientRect() || nullRect;
2704 - }
2705 - if (rect.left || rect.right || start == 0) break;
2706 - end = start;
2707 - start = start - 1;
2708 - collapse = "right";
2709 - }
2710 - if (ie && ie_version < 11) rect = maybeUpdateRectForZooming(cm.display.measure, rect);
2711 - } else { // If it is a widget, simply get the box for the whole widget.
2712 - if (start > 0) collapse = bias = "right";
2713 - var rects;
2714 - if (cm.options.lineWrapping && (rects = node.getClientRects()).length > 1)
2715 - rect = rects[bias == "right" ? rects.length - 1 : 0];
2716 - else
2717 - rect = node.getBoundingClientRect();
2718 - }
2719 - if (ie && ie_version < 9 && !start && (!rect || !rect.left && !rect.right)) {
2720 - var rSpan = node.parentNode.getClientRects()[0];
2721 - if (rSpan)
2722 - rect = {left: rSpan.left, right: rSpan.left + charWidth(cm.display), top: rSpan.top, bottom: rSpan.bottom};
2723 - else
2724 - rect = nullRect;
2725 - }
2726 -
2727 - var rtop = rect.top - prepared.rect.top, rbot = rect.bottom - prepared.rect.top;
2728 - var mid = (rtop + rbot) / 2;
2729 - var heights = prepared.view.measure.heights;
2730 - for (var i = 0; i < heights.length - 1; i++)
2731 - if (mid < heights[i]) break;
2732 - var top = i ? heights[i - 1] : 0, bot = heights[i];
2733 - var result = {left: (collapse == "right" ? rect.right : rect.left) - prepared.rect.left,
2734 - right: (collapse == "left" ? rect.left : rect.right) - prepared.rect.left,
2735 - top: top, bottom: bot};
2736 - if (!rect.left && !rect.right) result.bogus = true;
2737 - if (!cm.options.singleCursorHeightPerLine) { result.rtop = rtop; result.rbottom = rbot; }
2738 -
2739 - return result;
2740 - }
2741 -
2742 - // Work around problem with bounding client rects on ranges being
2743 - // returned incorrectly when zoomed on IE10 and below.
2744 - function maybeUpdateRectForZooming(measure, rect) {
2745 - if (!window.screen || screen.logicalXDPI == null ||
2746 - screen.logicalXDPI == screen.deviceXDPI || !hasBadZoomedRects(measure))
2747 - return rect;
2748 - var scaleX = screen.logicalXDPI / screen.deviceXDPI;
2749 - var scaleY = screen.logicalYDPI / screen.deviceYDPI;
2750 - return {left: rect.left * scaleX, right: rect.right * scaleX,
2751 - top: rect.top * scaleY, bottom: rect.bottom * scaleY};
2752 - }
2753 -
2754 - function clearLineMeasurementCacheFor(lineView) {
2755 - if (lineView.measure) {
2756 - lineView.measure.cache = {};
2757 - lineView.measure.heights = null;
2758 - if (lineView.rest) for (var i = 0; i < lineView.rest.length; i++)
2759 - lineView.measure.caches[i] = {};
2760 - }
2761 - }
2762 -
2763 - function clearLineMeasurementCache(cm) {
2764 - cm.display.externalMeasure = null;
2765 - removeChildren(cm.display.lineMeasure);
2766 - for (var i = 0; i < cm.display.view.length; i++)
2767 - clearLineMeasurementCacheFor(cm.display.view[i]);
2768 - }
2769 -
2770 - function clearCaches(cm) {
2771 - clearLineMeasurementCache(cm);
2772 - cm.display.cachedCharWidth = cm.display.cachedTextHeight = cm.display.cachedPaddingH = null;
2773 - if (!cm.options.lineWrapping) cm.display.maxLineChanged = true;
2774 - cm.display.lineNumChars = null;
2775 - }
2776 -
2777 - function pageScrollX() { return window.pageXOffset || (document.documentElement || document.body).scrollLeft; }
2778 - function pageScrollY() { return window.pageYOffset || (document.documentElement || document.body).scrollTop; }
2779 -
2780 - // Converts a {top, bottom, left, right} box from line-local
2781 - // coordinates into another coordinate system. Context may be one of
2782 - // "line", "div" (display.lineDiv), "local"/null (editor), "window",
2783 - // or "page".
2784 - function intoCoordSystem(cm, lineObj, rect, context) {
2785 - if (lineObj.widgets) for (var i = 0; i < lineObj.widgets.length; ++i) if (lineObj.widgets[i].above) {
2786 - var size = widgetHeight(lineObj.widgets[i]);
2787 - rect.top += size; rect.bottom += size;
2788 - }
2789 - if (context == "line") return rect;
2790 - if (!context) context = "local";
2791 - var yOff = heightAtLine(lineObj);
2792 - if (context == "local") yOff += paddingTop(cm.display);
2793 - else yOff -= cm.display.viewOffset;
2794 - if (context == "page" || context == "window") {
2795 - var lOff = cm.display.lineSpace.getBoundingClientRect();
2796 - yOff += lOff.top + (context == "window" ? 0 : pageScrollY());
2797 - var xOff = lOff.left + (context == "window" ? 0 : pageScrollX());
2798 - rect.left += xOff; rect.right += xOff;
2799 - }
2800 - rect.top += yOff; rect.bottom += yOff;
2801 - return rect;
2802 - }
2803 -
2804 - // Coverts a box from "div" coords to another coordinate system.
2805 - // Context may be "window", "page", "div", or "local"/null.
2806 - function fromCoordSystem(cm, coords, context) {
2807 - if (context == "div") return coords;
2808 - var left = coords.left, top = coords.top;
2809 - // First move into "page" coordinate system
2810 - if (context == "page") {
2811 - left -= pageScrollX();
2812 - top -= pageScrollY();
2813 - } else if (context == "local" || !context) {
2814 - var localBox = cm.display.sizer.getBoundingClientRect();
2815 - left += localBox.left;
2816 - top += localBox.top;
2817 - }
2818 -
2819 - var lineSpaceBox = cm.display.lineSpace.getBoundingClientRect();
2820 - return {left: left - lineSpaceBox.left, top: top - lineSpaceBox.top};
2821 - }
2822 -
2823 - function charCoords(cm, pos, context, lineObj, bias) {
2824 - if (!lineObj) lineObj = getLine(cm.doc, pos.line);
2825 - return intoCoordSystem(cm, lineObj, measureChar(cm, lineObj, pos.ch, bias), context);
2826 - }
2827 -
2828 - // Returns a box for a given cursor position, which may have an
2829 - // 'other' property containing the position of the secondary cursor
2830 - // on a bidi boundary.
2831 - function cursorCoords(cm, pos, context, lineObj, preparedMeasure, varHeight) {
2832 - lineObj = lineObj || getLine(cm.doc, pos.line);
2833 - if (!preparedMeasure) preparedMeasure = prepareMeasureForLine(cm, lineObj);
2834 - function get(ch, right) {
2835 - var m = measureCharPrepared(cm, preparedMeasure, ch, right ? "right" : "left", varHeight);
2836 - if (right) m.left = m.right; else m.right = m.left;
2837 - return intoCoordSystem(cm, lineObj, m, context);
2838 - }
2839 - function getBidi(ch, partPos) {
2840 - var part = order[partPos], right = part.level % 2;
2841 - if (ch == bidiLeft(part) && partPos && part.level < order[partPos - 1].level) {
2842 - part = order[--partPos];
2843 - ch = bidiRight(part) - (part.level % 2 ? 0 : 1);
2844 - right = true;
2845 - } else if (ch == bidiRight(part) && partPos < order.length - 1 && part.level < order[partPos + 1].level) {
2846 - part = order[++partPos];
2847 - ch = bidiLeft(part) - part.level % 2;
2848 - right = false;
2849 - }
2850 - if (right && ch == part.to && ch > part.from) return get(ch - 1);
2851 - return get(ch, right);
2852 - }
2853 - var order = getOrder(lineObj), ch = pos.ch;
2854 - if (!order) return get(ch);
2855 - var partPos = getBidiPartAt(order, ch);
2856 - var val = getBidi(ch, partPos);
2857 - if (bidiOther != null) val.other = getBidi(ch, bidiOther);
2858 - return val;
2859 - }
2860 -
2861 - // Used to cheaply estimate the coordinates for a position. Used for
2862 - // intermediate scroll updates.
2863 - function estimateCoords(cm, pos) {
2864 - var left = 0, pos = clipPos(cm.doc, pos);
2865 - if (!cm.options.lineWrapping) left = charWidth(cm.display) * pos.ch;
2866 - var lineObj = getLine(cm.doc, pos.line);
2867 - var top = heightAtLine(lineObj) + paddingTop(cm.display);
2868 - return {left: left, right: left, top: top, bottom: top + lineObj.height};
2869 - }
2870 -
2871 - // Positions returned by coordsChar contain some extra information.
2872 - // xRel is the relative x position of the input coordinates compared
2873 - // to the found position (so xRel > 0 means the coordinates are to
2874 - // the right of the character position, for example). When outside
2875 - // is true, that means the coordinates lie outside the line's
2876 - // vertical range.
2877 - function PosWithInfo(line, ch, outside, xRel) {
2878 - var pos = Pos(line, ch);
2879 - pos.xRel = xRel;
2880 - if (outside) pos.outside = true;
2881 - return pos;
2882 - }
2883 -
2884 - // Compute the character position closest to the given coordinates.
2885 - // Input must be lineSpace-local ("div" coordinate system).
2886 - function coordsChar(cm, x, y) {
2887 - var doc = cm.doc;
2888 - y += cm.display.viewOffset;
2889 - if (y < 0) return PosWithInfo(doc.first, 0, true, -1);
2890 - var lineN = lineAtHeight(doc, y), last = doc.first + doc.size - 1;
2891 - if (lineN > last)
2892 - return PosWithInfo(doc.first + doc.size - 1, getLine(doc, last).text.length, true, 1);
2893 - if (x < 0) x = 0;
2894 -
2895 - var lineObj = getLine(doc, lineN);
2896 - for (;;) {
2897 - var found = coordsCharInner(cm, lineObj, lineN, x, y);
2898 - var merged = collapsedSpanAtEnd(lineObj);
2899 - var mergedPos = merged && merged.find(0, true);
2900 - if (merged && (found.ch > mergedPos.from.ch || found.ch == mergedPos.from.ch && found.xRel > 0))
2901 - lineN = lineNo(lineObj = mergedPos.to.line);
2902 - else
2903 - return found;
2904 - }
2905 - }
2906 -
2907 - function coordsCharInner(cm, lineObj, lineNo, x, y) {
2908 - var innerOff = y - heightAtLine(lineObj);
2909 - var wrongLine = false, adjust = 2 * cm.display.wrapper.clientWidth;
2910 - var preparedMeasure = prepareMeasureForLine(cm, lineObj);
2911 -
2912 - function getX(ch) {
2913 - var sp = cursorCoords(cm, Pos(lineNo, ch), "line", lineObj, preparedMeasure);
2914 - wrongLine = true;
2915 - if (innerOff > sp.bottom) return sp.left - adjust;
2916 - else if (innerOff < sp.top) return sp.left + adjust;
2917 - else wrongLine = false;
2918 - return sp.left;
2919 - }
2920 -
2921 - var bidi = getOrder(lineObj), dist = lineObj.text.length;
2922 - var from = lineLeft(lineObj), to = lineRight(lineObj);
2923 - var fromX = getX(from), fromOutside = wrongLine, toX = getX(to), toOutside = wrongLine;
2924 -
2925 - if (x > toX) return PosWithInfo(lineNo, to, toOutside, 1);
2926 - // Do a binary search between these bounds.
2927 - for (;;) {
2928 - if (bidi ? to == from || to == moveVisually(lineObj, from, 1) : to - from <= 1) {
2929 - var ch = x < fromX || x - fromX <= toX - x ? from : to;
2930 - var xDiff = x - (ch == from ? fromX : toX);
2931 - while (isExtendingChar(lineObj.text.charAt(ch))) ++ch;
2932 - var pos = PosWithInfo(lineNo, ch, ch == from ? fromOutside : toOutside,
2933 - xDiff < -1 ? -1 : xDiff > 1 ? 1 : 0);
2934 - return pos;
2935 - }
2936 - var step = Math.ceil(dist / 2), middle = from + step;
2937 - if (bidi) {
2938 - middle = from;
2939 - for (var i = 0; i < step; ++i) middle = moveVisually(lineObj, middle, 1);
2940 - }
2941 - var middleX = getX(middle);
2942 - if (middleX > x) {to = middle; toX = middleX; if (toOutside = wrongLine) toX += 1000; dist = step;}
2943 - else {from = middle; fromX = middleX; fromOutside = wrongLine; dist -= step;}
2944 - }
2945 - }
2946 -
2947 - var measureText;
2948 - // Compute the default text height.
2949 - function textHeight(display) {
2950 - if (display.cachedTextHeight != null) return display.cachedTextHeight;
2951 - if (measureText == null) {
2952 - measureText = elt("pre");
2953 - // Measure a bunch of lines, for browsers that compute
2954 - // fractional heights.
2955 - for (var i = 0; i < 49; ++i) {
2956 - measureText.appendChild(document.createTextNode("x"));
2957 - measureText.appendChild(elt("br"));
2958 - }
2959 - measureText.appendChild(document.createTextNode("x"));
2960 - }
2961 - removeChildrenAndAdd(display.measure, measureText);
2962 - var height = measureText.offsetHeight / 50;
2963 - if (height > 3) display.cachedTextHeight = height;
2964 - removeChildren(display.measure);
2965 - return height || 1;
2966 - }
2967 -
2968 - // Compute the default character width.
2969 - function charWidth(display) {
2970 - if (display.cachedCharWidth != null) return display.cachedCharWidth;
2971 - var anchor = elt("span", "xxxxxxxxxx");
2972 - var pre = elt("pre", [anchor]);
2973 - removeChildrenAndAdd(display.measure, pre);
2974 - var rect = anchor.getBoundingClientRect(), width = (rect.right - rect.left) / 10;
2975 - if (width > 2) display.cachedCharWidth = width;
2976 - return width || 10;
2977 - }
2978 -
2979 - // OPERATIONS
2980 -
2981 - // Operations are used to wrap a series of changes to the editor
2982 - // state in such a way that each change won't have to update the
2983 - // cursor and display (which would be awkward, slow, and
2984 - // error-prone). Instead, display updates are batched and then all
2985 - // combined and executed at once.
2986 -
2987 - var operationGroup = null;
2988 -
2989 - var nextOpId = 0;
2990 - // Start a new operation.
2991 - function startOperation(cm) {
2992 - cm.curOp = {
2993 - cm: cm,
2994 - viewChanged: false, // Flag that indicates that lines might need to be redrawn
2995 - startHeight: cm.doc.height, // Used to detect need to update scrollbar
2996 - forceUpdate: false, // Used to force a redraw
2997 - updateInput: null, // Whether to reset the input textarea
2998 - typing: false, // Whether this reset should be careful to leave existing text (for compositing)
2999 - changeObjs: null, // Accumulated changes, for firing change events
3000 - cursorActivityHandlers: null, // Set of handlers to fire cursorActivity on
3001 - cursorActivityCalled: 0, // Tracks which cursorActivity handlers have been called already
3002 - selectionChanged: false, // Whether the selection needs to be redrawn
3003 - updateMaxLine: false, // Set when the widest line needs to be determined anew
3004 - scrollLeft: null, scrollTop: null, // Intermediate scroll position, not pushed to DOM yet
3005 - scrollToPos: null, // Used to scroll to a specific position
3006 - focus: false,
3007 - id: ++nextOpId // Unique ID
3008 - };
3009 - if (operationGroup) {
3010 - operationGroup.ops.push(cm.curOp);
3011 - } else {
3012 - cm.curOp.ownsGroup = operationGroup = {
3013 - ops: [cm.curOp],
3014 - delayedCallbacks: []
3015 - };
3016 - }
3017 - }
3018 -
3019 - function fireCallbacksForOps(group) {
3020 - // Calls delayed callbacks and cursorActivity handlers until no
3021 - // new ones appear
3022 - var callbacks = group.delayedCallbacks, i = 0;
3023 - do {
3024 - for (; i < callbacks.length; i++)
3025 - callbacks[i].call(null);
3026 - for (var j = 0; j < group.ops.length; j++) {
3027 - var op = group.ops[j];
3028 - if (op.cursorActivityHandlers)
3029 - while (op.cursorActivityCalled < op.cursorActivityHandlers.length)
3030 - op.cursorActivityHandlers[op.cursorActivityCalled++].call(null, op.cm);
3031 - }
3032 - } while (i < callbacks.length);
3033 - }
3034 -
3035 - // Finish an operation, updating the display and signalling delayed events
3036 - function endOperation(cm) {
3037 - var op = cm.curOp, group = op.ownsGroup;
3038 - if (!group) return;
3039 -
3040 - try { fireCallbacksForOps(group); }
3041 - finally {
3042 - operationGroup = null;
3043 - for (var i = 0; i < group.ops.length; i++)
3044 - group.ops[i].cm.curOp = null;
3045 - endOperations(group);
3046 - }
3047 - }
3048 -
3049 - // The DOM updates done when an operation finishes are batched so
3050 - // that the minimum number of relayouts are required.
3051 - function endOperations(group) {
3052 - var ops = group.ops;
3053 - for (var i = 0; i < ops.length; i++) // Read DOM
3054 - endOperation_R1(ops[i]);
3055 - for (var i = 0; i < ops.length; i++) // Write DOM (maybe)
3056 - endOperation_W1(ops[i]);
3057 - for (var i = 0; i < ops.length; i++) // Read DOM
3058 - endOperation_R2(ops[i]);
3059 - for (var i = 0; i < ops.length; i++) // Write DOM (maybe)
3060 - endOperation_W2(ops[i]);
3061 - for (var i = 0; i < ops.length; i++) // Read DOM
3062 - endOperation_finish(ops[i]);
3063 - }
3064 -
3065 - function endOperation_R1(op) {
3066 - var cm = op.cm, display = cm.display;
3067 - maybeClipScrollbars(cm);
3068 - if (op.updateMaxLine) findMaxLine(cm);
3069 -
3070 - op.mustUpdate = op.viewChanged || op.forceUpdate || op.scrollTop != null ||
3071 - op.scrollToPos && (op.scrollToPos.from.line < display.viewFrom ||
3072 - op.scrollToPos.to.line >= display.viewTo) ||
3073 - display.maxLineChanged && cm.options.lineWrapping;
3074 - op.update = op.mustUpdate &&
3075 - new DisplayUpdate(cm, op.mustUpdate && {top: op.scrollTop, ensure: op.scrollToPos}, op.forceUpdate);
3076 - }
3077 -
3078 - function endOperation_W1(op) {
3079 - op.updatedDisplay = op.mustUpdate && updateDisplayIfNeeded(op.cm, op.update);
3080 - }
3081 -
3082 - function endOperation_R2(op) {
3083 - var cm = op.cm, display = cm.display;
3084 - if (op.updatedDisplay) updateHeightsInViewport(cm);
3085 -
3086 - op.barMeasure = measureForScrollbars(cm);
3087 -
3088 - // If the max line changed since it was last measured, measure it,
3089 - // and ensure the document's width matches it.
3090 - // updateDisplay_W2 will use these properties to do the actual resizing
3091 - if (display.maxLineChanged && !cm.options.lineWrapping) {
3092 - op.adjustWidthTo = measureChar(cm, display.maxLine, display.maxLine.text.length).left + 3;
3093 - cm.display.sizerWidth = op.adjustWidthTo;
3094 - op.barMeasure.scrollWidth =
3095 - Math.max(display.scroller.clientWidth, display.sizer.offsetLeft + op.adjustWidthTo + scrollGap(cm) + cm.display.barWidth);
3096 - op.maxScrollLeft = Math.max(0, display.sizer.offsetLeft + op.adjustWidthTo - displayWidth(cm));
3097 - }
3098 -
3099 - if (op.updatedDisplay || op.selectionChanged)
3100 - op.preparedSelection = display.input.prepareSelection(op.focus);
3101 - }
3102 -
3103 - function endOperation_W2(op) {
3104 - var cm = op.cm;
3105 -
3106 - if (op.adjustWidthTo != null) {
3107 - cm.display.sizer.style.minWidth = op.adjustWidthTo + "px";
3108 - if (op.maxScrollLeft < cm.doc.scrollLeft)
3109 - setScrollLeft(cm, Math.min(cm.display.scroller.scrollLeft, op.maxScrollLeft), true);
3110 - cm.display.maxLineChanged = false;
3111 - }
3112 -
3113 - var takeFocus = op.focus && op.focus == activeElt() && (!document.hasFocus || document.hasFocus())
3114 - if (op.preparedSelection)
3115 - cm.display.input.showSelection(op.preparedSelection, takeFocus);
3116 - if (op.updatedDisplay || op.startHeight != cm.doc.height)
3117 - updateScrollbars(cm, op.barMeasure);
3118 - if (op.updatedDisplay)
3119 - setDocumentHeight(cm, op.barMeasure);
3120 -
3121 - if (op.selectionChanged) restartBlink(cm);
3122 -
3123 - if (cm.state.focused && op.updateInput)
3124 - cm.display.input.reset(op.typing);
3125 - if (takeFocus) ensureFocus(op.cm);
3126 - }
3127 -
3128 - function endOperation_finish(op) {
3129 - var cm = op.cm, display = cm.display, doc = cm.doc;
3130 -
3131 - if (op.updatedDisplay) postUpdateDisplay(cm, op.update);
3132 -
3133 - // Abort mouse wheel delta measurement, when scrolling explicitly
3134 - if (display.wheelStartX != null && (op.scrollTop != null || op.scrollLeft != null || op.scrollToPos))
3135 - display.wheelStartX = display.wheelStartY = null;
3136 -
3137 - // Propagate the scroll position to the actual DOM scroller
3138 - if (op.scrollTop != null && (display.scroller.scrollTop != op.scrollTop || op.forceScroll)) {
3139 - doc.scrollTop = Math.max(0, Math.min(display.scroller.scrollHeight - display.scroller.clientHeight, op.scrollTop));
3140 - display.scrollbars.setScrollTop(doc.scrollTop);
3141 - display.scroller.scrollTop = doc.scrollTop;
3142 - }
3143 - if (op.scrollLeft != null && (display.scroller.scrollLeft != op.scrollLeft || op.forceScroll)) {
3144 - doc.scrollLeft = Math.max(0, Math.min(display.scroller.scrollWidth - display.scroller.clientWidth, op.scrollLeft));
3145 - display.scrollbars.setScrollLeft(doc.scrollLeft);
3146 - display.scroller.scrollLeft = doc.scrollLeft;
3147 - alignHorizontally(cm);
3148 - }
3149 - // If we need to scroll a specific position into view, do so.
3150 - if (op.scrollToPos) {
3151 - var coords = scrollPosIntoView(cm, clipPos(doc, op.scrollToPos.from),
3152 - clipPos(doc, op.scrollToPos.to), op.scrollToPos.margin);
3153 - if (op.scrollToPos.isCursor && cm.state.focused) maybeScrollWindow(cm, coords);
3154 - }
3155 -
3156 - // Fire events for markers that are hidden/unidden by editing or
3157 - // undoing
3158 - var hidden = op.maybeHiddenMarkers, unhidden = op.maybeUnhiddenMarkers;
3159 - if (hidden) for (var i = 0; i < hidden.length; ++i)
3160 - if (!hidden[i].lines.length) signal(hidden[i], "hide");
3161 - if (unhidden) for (var i = 0; i < unhidden.length; ++i)
3162 - if (unhidden[i].lines.length) signal(unhidden[i], "unhide");
3163 -
3164 - if (display.wrapper.offsetHeight)
3165 - doc.scrollTop = cm.display.scroller.scrollTop;
3166 -
3167 - // Fire change events, and delayed event handlers
3168 - if (op.changeObjs)
3169 - signal(cm, "changes", cm, op.changeObjs);
3170 - if (op.update)
3171 - op.update.finish();
3172 - }
3173 -
3174 - // Run the given function in an operation
3175 - function runInOp(cm, f) {
3176 - if (cm.curOp) return f();
3177 - startOperation(cm);
3178 - try { return f(); }
3179 - finally { endOperation(cm); }
3180 - }
3181 - // Wraps a function in an operation. Returns the wrapped function.
3182 - function operation(cm, f) {
3183 - return function() {
3184 - if (cm.curOp) return f.apply(cm, arguments);
3185 - startOperation(cm);
3186 - try { return f.apply(cm, arguments); }
3187 - finally { endOperation(cm); }
3188 - };
3189 - }
3190 - // Used to add methods to editor and doc instances, wrapping them in
3191 - // operations.
3192 - function methodOp(f) {
3193 - return function() {
3194 - if (this.curOp) return f.apply(this, arguments);
3195 - startOperation(this);
3196 - try { return f.apply(this, arguments); }
3197 - finally { endOperation(this); }
3198 - };
3199 - }
3200 - function docMethodOp(f) {
3201 - return function() {
3202 - var cm = this.cm;
3203 - if (!cm || cm.curOp) return f.apply(this, arguments);
3204 - startOperation(cm);
3205 - try { return f.apply(this, arguments); }
3206 - finally { endOperation(cm); }
3207 - };
3208 - }
3209 -
3210 - // VIEW TRACKING
3211 -
3212 - // These objects are used to represent the visible (currently drawn)
3213 - // part of the document. A LineView may correspond to multiple
3214 - // logical lines, if those are connected by collapsed ranges.
3215 - function LineView(doc, line, lineN) {
3216 - // The starting line
3217 - this.line = line;
3218 - // Continuing lines, if any
3219 - this.rest = visualLineContinued(line);
3220 - // Number of logical lines in this visual line
3221 - this.size = this.rest ? lineNo(lst(this.rest)) - lineN + 1 : 1;
3222 - this.node = this.text = null;
3223 - this.hidden = lineIsHidden(doc, line);
3224 - }
3225 -
3226 - // Create a range of LineView objects for the given lines.
3227 - function buildViewArray(cm, from, to) {
3228 - var array = [], nextPos;
3229 - for (var pos = from; pos < to; pos = nextPos) {
3230 - var view = new LineView(cm.doc, getLine(cm.doc, pos), pos);
3231 - nextPos = pos + view.size;
3232 - array.push(view);
3233 - }
3234 - return array;
3235 - }
3236 -
3237 - // Updates the display.view data structure for a given change to the
3238 - // document. From and to are in pre-change coordinates. Lendiff is
3239 - // the amount of lines added or subtracted by the change. This is
3240 - // used for changes that span multiple lines, or change the way
3241 - // lines are divided into visual lines. regLineChange (below)
3242 - // registers single-line changes.
3243 - function regChange(cm, from, to, lendiff) {
3244 - if (from == null) from = cm.doc.first;
3245 - if (to == null) to = cm.doc.first + cm.doc.size;
3246 - if (!lendiff) lendiff = 0;
3247 -
3248 - var display = cm.display;
3249 - if (lendiff && to < display.viewTo &&
3250 - (display.updateLineNumbers == null || display.updateLineNumbers > from))
3251 - display.updateLineNumbers = from;
3252 -
3253 - cm.curOp.viewChanged = true;
3254 -
3255 - if (from >= display.viewTo) { // Change after
3256 - if (sawCollapsedSpans && visualLineNo(cm.doc, from) < display.viewTo)
3257 - resetView(cm);
3258 - } else if (to <= display.viewFrom) { // Change before
3259 - if (sawCollapsedSpans && visualLineEndNo(cm.doc, to + lendiff) > display.viewFrom) {
3260 - resetView(cm);
3261 - } else {
3262 - display.viewFrom += lendiff;
3263 - display.viewTo += lendiff;
3264 - }
3265 - } else if (from <= display.viewFrom && to >= display.viewTo) { // Full overlap
3266 - resetView(cm);
3267 - } else if (from <= display.viewFrom) { // Top overlap
3268 - var cut = viewCuttingPoint(cm, to, to + lendiff, 1);
3269 - if (cut) {
3270 - display.view = display.view.slice(cut.index);
3271 - display.viewFrom = cut.lineN;
3272 - display.viewTo += lendiff;
3273 - } else {
3274 - resetView(cm);
3275 - }
3276 - } else if (to >= display.viewTo) { // Bottom overlap
3277 - var cut = viewCuttingPoint(cm, from, from, -1);
3278 - if (cut) {
3279 - display.view = display.view.slice(0, cut.index);
3280 - display.viewTo = cut.lineN;
3281 - } else {
3282 - resetView(cm);
3283 - }
3284 - } else { // Gap in the middle
3285 - var cutTop = viewCuttingPoint(cm, from, from, -1);
3286 - var cutBot = viewCuttingPoint(cm, to, to + lendiff, 1);
3287 - if (cutTop && cutBot) {
3288 - display.view = display.view.slice(0, cutTop.index)
3289 - .concat(buildViewArray(cm, cutTop.lineN, cutBot.lineN))
3290 - .concat(display.view.slice(cutBot.index));
3291 - display.viewTo += lendiff;
3292 - } else {
3293 - resetView(cm);
3294 - }
3295 - }
3296 -
3297 - var ext = display.externalMeasured;
3298 - if (ext) {
3299 - if (to < ext.lineN)
3300 - ext.lineN += lendiff;
3301 - else if (from < ext.lineN + ext.size)
3302 - display.externalMeasured = null;
3303 - }
3304 - }
3305 -
3306 - // Register a change to a single line. Type must be one of "text",
3307 - // "gutter", "class", "widget"
3308 - function regLineChange(cm, line, type) {
3309 - cm.curOp.viewChanged = true;
3310 - var display = cm.display, ext = cm.display.externalMeasured;
3311 - if (ext && line >= ext.lineN && line < ext.lineN + ext.size)
3312 - display.externalMeasured = null;
3313 -
3314 - if (line < display.viewFrom || line >= display.viewTo) return;
3315 - var lineView = display.view[findViewIndex(cm, line)];
3316 - if (lineView.node == null) return;
3317 - var arr = lineView.changes || (lineView.changes = []);
3318 - if (indexOf(arr, type) == -1) arr.push(type);
3319 - }
3320 -
3321 - // Clear the view.
3322 - function resetView(cm) {
3323 - cm.display.viewFrom = cm.display.viewTo = cm.doc.first;
3324 - cm.display.view = [];
3325 - cm.display.viewOffset = 0;
3326 - }
3327 -
3328 - // Find the view element corresponding to a given line. Return null
3329 - // when the line isn't visible.
3330 - function findViewIndex(cm, n) {
3331 - if (n >= cm.display.viewTo) return null;
3332 - n -= cm.display.viewFrom;
3333 - if (n < 0) return null;
3334 - var view = cm.display.view;
3335 - for (var i = 0; i < view.length; i++) {
3336 - n -= view[i].size;
3337 - if (n < 0) return i;
3338 - }
3339 - }
3340 -
3341 - function viewCuttingPoint(cm, oldN, newN, dir) {
3342 - var index = findViewIndex(cm, oldN), diff, view = cm.display.view;
3343 - if (!sawCollapsedSpans || newN == cm.doc.first + cm.doc.size)
3344 - return {index: index, lineN: newN};
3345 - for (var i = 0, n = cm.display.viewFrom; i < index; i++)
3346 - n += view[i].size;
3347 - if (n != oldN) {
3348 - if (dir > 0) {
3349 - if (index == view.length - 1) return null;
3350 - diff = (n + view[index].size) - oldN;
3351 - index++;
3352 - } else {
3353 - diff = n - oldN;
3354 - }
3355 - oldN += diff; newN += diff;
3356 - }
3357 - while (visualLineNo(cm.doc, newN) != newN) {
3358 - if (index == (dir < 0 ? 0 : view.length - 1)) return null;
3359 - newN += dir * view[index - (dir < 0 ? 1 : 0)].size;
3360 - index += dir;
3361 - }
3362 - return {index: index, lineN: newN};
3363 - }
3364 -
3365 - // Force the view to cover a given range, adding empty view element
3366 - // or clipping off existing ones as needed.
3367 - function adjustView(cm, from, to) {
3368 - var display = cm.display, view = display.view;
3369 - if (view.length == 0 || from >= display.viewTo || to <= display.viewFrom) {
3370 - display.view = buildViewArray(cm, from, to);
3371 - display.viewFrom = from;
3372 - } else {
3373 - if (display.viewFrom > from)
3374 - display.view = buildViewArray(cm, from, display.viewFrom).concat(display.view);
3375 - else if (display.viewFrom < from)
3376 - display.view = display.view.slice(findViewIndex(cm, from));
3377 - display.viewFrom = from;
3378 - if (display.viewTo < to)
3379 - display.view = display.view.concat(buildViewArray(cm, display.viewTo, to));
3380 - else if (display.viewTo > to)
3381 - display.view = display.view.slice(0, findViewIndex(cm, to));
3382 - }
3383 - display.viewTo = to;
3384 - }
3385 -
3386 - // Count the number of lines in the view whose DOM representation is
3387 - // out of date (or nonexistent).
3388 - function countDirtyView(cm) {
3389 - var view = cm.display.view, dirty = 0;
3390 - for (var i = 0; i < view.length; i++) {
3391 - var lineView = view[i];
3392 - if (!lineView.hidden && (!lineView.node || lineView.changes)) ++dirty;
3393 - }
3394 - return dirty;
3395 - }
3396 -
3397 - // EVENT HANDLERS
3398 -
3399 - // Attach the necessary event handlers when initializing the editor
3400 - function registerEventHandlers(cm) {
3401 - var d = cm.display;
3402 - on(d.scroller, "mousedown", operation(cm, onMouseDown));
3403 - // Older IE's will not fire a second mousedown for a double click
3404 - if (ie && ie_version < 11)
3405 - on(d.scroller, "dblclick", operation(cm, function(e) {
3406 - if (signalDOMEvent(cm, e)) return;
3407 - var pos = posFromMouse(cm, e);
3408 - if (!pos || clickInGutter(cm, e) || eventInWidget(cm.display, e)) return;
3409 - e_preventDefault(e);
3410 - var word = cm.findWordAt(pos);
3411 - extendSelection(cm.doc, word.anchor, word.head);
3412 - }));
3413 - else
3414 - on(d.scroller, "dblclick", function(e) { signalDOMEvent(cm, e) || e_preventDefault(e); });
3415 - // Some browsers fire contextmenu *after* opening the menu, at
3416 - // which point we can't mess with it anymore. Context menu is
3417 - // handled in onMouseDown for these browsers.
3418 - if (!captureRightClick) on(d.scroller, "contextmenu", function(e) {onContextMenu(cm, e);});
3419 -
3420 - // Used to suppress mouse event handling when a touch happens
3421 - var touchFinished, prevTouch = {end: 0};
3422 - function finishTouch() {
3423 - if (d.activeTouch) {
3424 - touchFinished = setTimeout(function() {d.activeTouch = null;}, 1000);
3425 - prevTouch = d.activeTouch;
3426 - prevTouch.end = +new Date;
3427 - }
3428 - };
3429 - function isMouseLikeTouchEvent(e) {
3430 - if (e.touches.length != 1) return false;
3431 - var touch = e.touches[0];
3432 - return touch.radiusX <= 1 && touch.radiusY <= 1;
3433 - }
3434 - function farAway(touch, other) {
3435 - if (other.left == null) return true;
3436 - var dx = other.left - touch.left, dy = other.top - touch.top;
3437 - return dx * dx + dy * dy > 20 * 20;
3438 - }
3439 - on(d.scroller, "touchstart", function(e) {
3440 - if (!signalDOMEvent(cm, e) && !isMouseLikeTouchEvent(e)) {
3441 - clearTimeout(touchFinished);
3442 - var now = +new Date;
3443 - d.activeTouch = {start: now, moved: false,
3444 - prev: now - prevTouch.end <= 300 ? prevTouch : null};
3445 - if (e.touches.length == 1) {
3446 - d.activeTouch.left = e.touches[0].pageX;
3447 - d.activeTouch.top = e.touches[0].pageY;
3448 - }
3449 - }
3450 - });
3451 - on(d.scroller, "touchmove", function() {
3452 - if (d.activeTouch) d.activeTouch.moved = true;
3453 - });
3454 - on(d.scroller, "touchend", function(e) {
3455 - var touch = d.activeTouch;
3456 - if (touch && !eventInWidget(d, e) && touch.left != null &&
3457 - !touch.moved && new Date - touch.start < 300) {
3458 - var pos = cm.coordsChar(d.activeTouch, "page"), range;
3459 - if (!touch.prev || farAway(touch, touch.prev)) // Single tap
3460 - range = new Range(pos, pos);
3461 - else if (!touch.prev.prev || farAway(touch, touch.prev.prev)) // Double tap
3462 - range = cm.findWordAt(pos);
3463 - else // Triple tap
3464 - range = new Range(Pos(pos.line, 0), clipPos(cm.doc, Pos(pos.line + 1, 0)));
3465 - cm.setSelection(range.anchor, range.head);
3466 - cm.focus();
3467 - e_preventDefault(e);
3468 - }
3469 - finishTouch();
3470 - });
3471 - on(d.scroller, "touchcancel", finishTouch);
3472 -
3473 - // Sync scrolling between fake scrollbars and real scrollable
3474 - // area, ensure viewport is updated when scrolling.
3475 - on(d.scroller, "scroll", function() {
3476 - if (d.scroller.clientHeight) {
3477 - setScrollTop(cm, d.scroller.scrollTop);
3478 - setScrollLeft(cm, d.scroller.scrollLeft, true);
3479 - signal(cm, "scroll", cm);
3480 - }
3481 - });
3482 -
3483 - // Listen to wheel events in order to try and update the viewport on time.
3484 - on(d.scroller, "mousewheel", function(e){onScrollWheel(cm, e);});
3485 - on(d.scroller, "DOMMouseScroll", function(e){onScrollWheel(cm, e);});
3486 -
3487 - // Prevent wrapper from ever scrolling
3488 - on(d.wrapper, "scroll", function() { d.wrapper.scrollTop = d.wrapper.scrollLeft = 0; });
3489 -
3490 - d.dragFunctions = {
3491 - enter: function(e) {if (!signalDOMEvent(cm, e)) e_stop(e);},
3492 - over: function(e) {if (!signalDOMEvent(cm, e)) { onDragOver(cm, e); e_stop(e); }},
3493 - start: function(e){onDragStart(cm, e);},
3494 - drop: operation(cm, onDrop),
3495 - leave: function(e) {if (!signalDOMEvent(cm, e)) { clearDragCursor(cm); }}
3496 - };
3497 -
3498 - var inp = d.input.getField();
3499 - on(inp, "keyup", function(e) { onKeyUp.call(cm, e); });
3500 - on(inp, "keydown", operation(cm, onKeyDown));
3501 - on(inp, "keypress", operation(cm, onKeyPress));
3502 - on(inp, "focus", bind(onFocus, cm));
3503 - on(inp, "blur", bind(onBlur, cm));
3504 - }
3505 -
3506 - function dragDropChanged(cm, value, old) {
3507 - var wasOn = old && old != CodeMirror.Init;
3508 - if (!value != !wasOn) {
3509 - var funcs = cm.display.dragFunctions;
3510 - var toggle = value ? on : off;
3511 - toggle(cm.display.scroller, "dragstart", funcs.start);
3512 - toggle(cm.display.scroller, "dragenter", funcs.enter);
3513 - toggle(cm.display.scroller, "dragover", funcs.over);
3514 - toggle(cm.display.scroller, "dragleave", funcs.leave);
3515 - toggle(cm.display.scroller, "drop", funcs.drop);
3516 - }
3517 - }
3518 -
3519 - // Called when the window resizes
3520 - function onResize(cm) {
3521 - var d = cm.display;
3522 - if (d.lastWrapHeight == d.wrapper.clientHeight && d.lastWrapWidth == d.wrapper.clientWidth)
3523 - return;
3524 - // Might be a text scaling operation, clear size caches.
3525 - d.cachedCharWidth = d.cachedTextHeight = d.cachedPaddingH = null;
3526 - d.scrollbarsClipped = false;
3527 - cm.setSize();
3528 - }
3529 -
3530 - // MOUSE EVENTS
3531 -
3532 - // Return true when the given mouse event happened in a widget
3533 - function eventInWidget(display, e) {
3534 - for (var n = e_target(e); n != display.wrapper; n = n.parentNode) {
3535 - if (!n || (n.nodeType == 1 && n.getAttribute("cm-ignore-events") == "true") ||
3536 - (n.parentNode == display.sizer && n != display.mover))
3537 - return true;
3538 - }
3539 - }
3540 -
3541 - // Given a mouse event, find the corresponding position. If liberal
3542 - // is false, it checks whether a gutter or scrollbar was clicked,
3543 - // and returns null if it was. forRect is used by rectangular
3544 - // selections, and tries to estimate a character position even for
3545 - // coordinates beyond the right of the text.
3546 - function posFromMouse(cm, e, liberal, forRect) {
3547 - var display = cm.display;
3548 - if (!liberal && e_target(e).getAttribute("cm-not-content") == "true") return null;
3549 -
3550 - var x, y, space = display.lineSpace.getBoundingClientRect();
3551 - // Fails unpredictably on IE[67] when mouse is dragged around quickly.
3552 - try { x = e.clientX - space.left; y = e.clientY - space.top; }
3553 - catch (e) { return null; }
3554 - var coords = coordsChar(cm, x, y), line;
3555 - if (forRect && coords.xRel == 1 && (line = getLine(cm.doc, coords.line).text).length == coords.ch) {
3556 - var colDiff = countColumn(line, line.length, cm.options.tabSize) - line.length;
3557 - coords = Pos(coords.line, Math.max(0, Math.round((x - paddingH(cm.display).left) / charWidth(cm.display)) - colDiff));
3558 - }
3559 - return coords;
3560 - }
3561 -
3562 - // A mouse down can be a single click, double click, triple click,
3563 - // start of selection drag, start of text drag, new cursor
3564 - // (ctrl-click), rectangle drag (alt-drag), or xwin
3565 - // middle-click-paste. Or it might be a click on something we should
3566 - // not interfere with, such as a scrollbar or widget.
3567 - function onMouseDown(e) {
3568 - var cm = this, display = cm.display;
3569 - if (signalDOMEvent(cm, e) || display.activeTouch && display.input.supportsTouch()) return;
3570 - display.shift = e.shiftKey;
3571 -
3572 - if (eventInWidget(display, e)) {
3573 - if (!webkit) {
3574 - // Briefly turn off draggability, to allow widgets to do
3575 - // normal dragging things.
3576 - display.scroller.draggable = false;
3577 - setTimeout(function(){display.scroller.draggable = true;}, 100);
3578 - }
3579 - return;
3580 - }
3581 - if (clickInGutter(cm, e)) return;
3582 - var start = posFromMouse(cm, e);
3583 - window.focus();
3584 -
3585 - switch (e_button(e)) {
3586 - case 1:
3587 - // #3261: make sure, that we're not starting a second selection
3588 - if (cm.state.selectingText)
3589 - cm.state.selectingText(e);
3590 - else if (start)
3591 - leftButtonDown(cm, e, start);
3592 - else if (e_target(e) == display.scroller)
3593 - e_preventDefault(e);
3594 - break;
3595 - case 2:
3596 - if (webkit) cm.state.lastMiddleDown = +new Date;
3597 - if (start) extendSelection(cm.doc, start);
3598 - setTimeout(function() {display.input.focus();}, 20);
3599 - e_preventDefault(e);
3600 - break;
3601 - case 3:
3602 - if (captureRightClick) onContextMenu(cm, e);
3603 - else delayBlurEvent(cm);
3604 - break;
3605 - }
3606 - }
3607 -
3608 - var lastClick, lastDoubleClick;
3609 - function leftButtonDown(cm, e, start) {
3610 - if (ie) setTimeout(bind(ensureFocus, cm), 0);
3611 - else cm.curOp.focus = activeElt();
3612 -
3613 - var now = +new Date, type;
3614 - if (lastDoubleClick && lastDoubleClick.time > now - 400 && cmp(lastDoubleClick.pos, start) == 0) {
3615 - type = "triple";
3616 - } else if (lastClick && lastClick.time > now - 400 && cmp(lastClick.pos, start) == 0) {
3617 - type = "double";
3618 - lastDoubleClick = {time: now, pos: start};
3619 - } else {
3620 - type = "single";
3621 - lastClick = {time: now, pos: start};
3622 - }
3623 -
3624 - var sel = cm.doc.sel, modifier = mac ? e.metaKey : e.ctrlKey, contained;
3625 - if (cm.options.dragDrop && dragAndDrop && !cm.isReadOnly() &&
3626 - type == "single" && (contained = sel.contains(start)) > -1 &&
3627 - (cmp((contained = sel.ranges[contained]).from(), start) < 0 || start.xRel > 0) &&
3628 - (cmp(contained.to(), start) > 0 || start.xRel < 0))
3629 - leftButtonStartDrag(cm, e, start, modifier);
3630 - else
3631 - leftButtonSelect(cm, e, start, type, modifier);
3632 - }
3633 -
3634 - // Start a text drag. When it ends, see if any dragging actually
3635 - // happen, and treat as a click if it didn't.
3636 - function leftButtonStartDrag(cm, e, start, modifier) {
3637 - var display = cm.display, startTime = +new Date;
3638 - var dragEnd = operation(cm, function(e2) {
3639 - if (webkit) display.scroller.draggable = false;
3640 - cm.state.draggingText = false;
3641 - off(document, "mouseup", dragEnd);
3642 - off(display.scroller, "drop", dragEnd);
3643 - if (Math.abs(e.clientX - e2.clientX) + Math.abs(e.clientY - e2.clientY) < 10) {
3644 - e_preventDefault(e2);
3645 - if (!modifier && +new Date - 200 < startTime)
3646 - extendSelection(cm.doc, start);
3647 - // Work around unexplainable focus problem in IE9 (#2127) and Chrome (#3081)
3648 - if (webkit || ie && ie_version == 9)
3649 - setTimeout(function() {document.body.focus(); display.input.focus();}, 20);
3650 - else
3651 - display.input.focus();
3652 - }
3653 - });
3654 - // Let the drag handler handle this.
3655 - if (webkit) display.scroller.draggable = true;
3656 - cm.state.draggingText = dragEnd;
3657 - // IE's approach to draggable
3658 - if (display.scroller.dragDrop) display.scroller.dragDrop();
3659 - on(document, "mouseup", dragEnd);
3660 - on(display.scroller, "drop", dragEnd);
3661 - }
3662 -
3663 - // Normal selection, as opposed to text dragging.
3664 - function leftButtonSelect(cm, e, start, type, addNew) {
3665 - var display = cm.display, doc = cm.doc;
3666 - e_preventDefault(e);
3667 -
3668 - var ourRange, ourIndex, startSel = doc.sel, ranges = startSel.ranges;
3669 - if (addNew && !e.shiftKey) {
3670 - ourIndex = doc.sel.contains(start);
3671 - if (ourIndex > -1)
3672 - ourRange = ranges[ourIndex];
3673 - else
3674 - ourRange = new Range(start, start);
3675 - } else {
3676 - ourRange = doc.sel.primary();
3677 - ourIndex = doc.sel.primIndex;
3678 - }
3679 -
3680 - if (chromeOS ? e.shiftKey && e.metaKey : e.altKey) {
3681 - type = "rect";
3682 - if (!addNew) ourRange = new Range(start, start);
3683 - start = posFromMouse(cm, e, true, true);
3684 - ourIndex = -1;
3685 - } else if (type == "double") {
3686 - var word = cm.findWordAt(start);
3687 - if (cm.display.shift || doc.extend)
3688 - ourRange = extendRange(doc, ourRange, word.anchor, word.head);
3689 - else
3690 - ourRange = word;
3691 - } else if (type == "triple") {
3692 - var line = new Range(Pos(start.line, 0), clipPos(doc, Pos(start.line + 1, 0)));
3693 - if (cm.display.shift || doc.extend)
3694 - ourRange = extendRange(doc, ourRange, line.anchor, line.head);
3695 - else
3696 - ourRange = line;
3697 - } else {
3698 - ourRange = extendRange(doc, ourRange, start);
3699 - }
3700 -
3701 - if (!addNew) {
3702 - ourIndex = 0;
3703 - setSelection(doc, new Selection([ourRange], 0), sel_mouse);
3704 - startSel = doc.sel;
3705 - } else if (ourIndex == -1) {
3706 - ourIndex = ranges.length;
3707 - setSelection(doc, normalizeSelection(ranges.concat([ourRange]), ourIndex),
3708 - {scroll: false, origin: "*mouse"});
3709 - } else if (ranges.length > 1 && ranges[ourIndex].empty() && type == "single" && !e.shiftKey) {
3710 - setSelection(doc, normalizeSelection(ranges.slice(0, ourIndex).concat(ranges.slice(ourIndex + 1)), 0),
3711 - {scroll: false, origin: "*mouse"});
3712 - startSel = doc.sel;
3713 - } else {
3714 - replaceOneSelection(doc, ourIndex, ourRange, sel_mouse);
3715 - }
3716 -
3717 - var lastPos = start;
3718 - function extendTo(pos) {
3719 - if (cmp(lastPos, pos) == 0) return;
3720 - lastPos = pos;
3721 -
3722 - if (type == "rect") {
3723 - var ranges = [], tabSize = cm.options.tabSize;
3724 - var startCol = countColumn(getLine(doc, start.line).text, start.ch, tabSize);
3725 - var posCol = countColumn(getLine(doc, pos.line).text, pos.ch, tabSize);
3726 - var left = Math.min(startCol, posCol), right = Math.max(startCol, posCol);
3727 - for (var line = Math.min(start.line, pos.line), end = Math.min(cm.lastLine(), Math.max(start.line, pos.line));
3728 - line <= end; line++) {
3729 - var text = getLine(doc, line).text, leftPos = findColumn(text, left, tabSize);
3730 - if (left == right)
3731 - ranges.push(new Range(Pos(line, leftPos), Pos(line, leftPos)));
3732 - else if (text.length > leftPos)
3733 - ranges.push(new Range(Pos(line, leftPos), Pos(line, findColumn(text, right, tabSize))));
3734 - }
3735 - if (!ranges.length) ranges.push(new Range(start, start));
3736 - setSelection(doc, normalizeSelection(startSel.ranges.slice(0, ourIndex).concat(ranges), ourIndex),
3737 - {origin: "*mouse", scroll: false});
3738 - cm.scrollIntoView(pos);
3739 - } else {
3740 - var oldRange = ourRange;
3741 - var anchor = oldRange.anchor, head = pos;
3742 - if (type != "single") {
3743 - if (type == "double")
3744 - var range = cm.findWordAt(pos);
3745 - else
3746 - var range = new Range(Pos(pos.line, 0), clipPos(doc, Pos(pos.line + 1, 0)));
3747 - if (cmp(range.anchor, anchor) > 0) {
3748 - head = range.head;
3749 - anchor = minPos(oldRange.from(), range.anchor);
3750 - } else {
3751 - head = range.anchor;
3752 - anchor = maxPos(oldRange.to(), range.head);
3753 - }
3754 - }
3755 - var ranges = startSel.ranges.slice(0);
3756 - ranges[ourIndex] = new Range(clipPos(doc, anchor), head);
3757 - setSelection(doc, normalizeSelection(ranges, ourIndex), sel_mouse);
3758 - }
3759 - }
3760 -
3761 - var editorSize = display.wrapper.getBoundingClientRect();
3762 - // Used to ensure timeout re-tries don't fire when another extend
3763 - // happened in the meantime (clearTimeout isn't reliable -- at
3764 - // least on Chrome, the timeouts still happen even when cleared,
3765 - // if the clear happens after their scheduled firing time).
3766 - var counter = 0;
3767 -
3768 - function extend(e) {
3769 - var curCount = ++counter;
3770 - var cur = posFromMouse(cm, e, true, type == "rect");
3771 - if (!cur) return;
3772 - if (cmp(cur, lastPos) != 0) {
3773 - cm.curOp.focus = activeElt();
3774 - extendTo(cur);
3775 - var visible = visibleLines(display, doc);
3776 - if (cur.line >= visible.to || cur.line < visible.from)
3777 - setTimeout(operation(cm, function(){if (counter == curCount) extend(e);}), 150);
3778 - } else {
3779 - var outside = e.clientY < editorSize.top ? -20 : e.clientY > editorSize.bottom ? 20 : 0;
3780 - if (outside) setTimeout(operation(cm, function() {
3781 - if (counter != curCount) return;
3782 - display.scroller.scrollTop += outside;
3783 - extend(e);
3784 - }), 50);
3785 - }
3786 - }
3787 -
3788 - function done(e) {
3789 - cm.state.selectingText = false;
3790 - counter = Infinity;
3791 - e_preventDefault(e);
3792 - display.input.focus();
3793 - off(document, "mousemove", move);
3794 - off(document, "mouseup", up);
3795 - doc.history.lastSelOrigin = null;
3796 - }
3797 -
3798 - var move = operation(cm, function(e) {
3799 - if (!e_button(e)) done(e);
3800 - else extend(e);
3801 - });
3802 - var up = operation(cm, done);
3803 - cm.state.selectingText = up;
3804 - on(document, "mousemove", move);
3805 - on(document, "mouseup", up);
3806 - }
3807 -
3808 - // Determines whether an event happened in the gutter, and fires the
3809 - // handlers for the corresponding event.
3810 - function gutterEvent(cm, e, type, prevent) {
3811 - try { var mX = e.clientX, mY = e.clientY; }
3812 - catch(e) { return false; }
3813 - if (mX >= Math.floor(cm.display.gutters.getBoundingClientRect().right)) return false;
3814 - if (prevent) e_preventDefault(e);
3815 -
3816 - var display = cm.display;
3817 - var lineBox = display.lineDiv.getBoundingClientRect();
3818 -
3819 - if (mY > lineBox.bottom || !hasHandler(cm, type)) return e_defaultPrevented(e);
3820 - mY -= lineBox.top - display.viewOffset;
3821 -
3822 - for (var i = 0; i < cm.options.gutters.length; ++i) {
3823 - var g = display.gutters.childNodes[i];
3824 - if (g && g.getBoundingClientRect().right >= mX) {
3825 - var line = lineAtHeight(cm.doc, mY);
3826 - var gutter = cm.options.gutters[i];
3827 - signal(cm, type, cm, line, gutter, e);
3828 - return e_defaultPrevented(e);
3829 - }
3830 - }
3831 - }
3832 -
3833 - function clickInGutter(cm, e) {
3834 - return gutterEvent(cm, e, "gutterClick", true);
3835 - }
3836 -
3837 - // Kludge to work around strange IE behavior where it'll sometimes
3838 - // re-fire a series of drag-related events right after the drop (#1551)
3839 - var lastDrop = 0;
3840 -
3841 - function onDrop(e) {
3842 - var cm = this;
3843 - clearDragCursor(cm);
3844 - if (signalDOMEvent(cm, e) || eventInWidget(cm.display, e))
3845 - return;
3846 - e_preventDefault(e);
3847 - if (ie) lastDrop = +new Date;
3848 - var pos = posFromMouse(cm, e, true), files = e.dataTransfer.files;
3849 - if (!pos || cm.isReadOnly()) return;
3850 - // Might be a file drop, in which case we simply extract the text
3851 - // and insert it.
3852 - if (files && files.length && window.FileReader && window.File) {
3853 - var n = files.length, text = Array(n), read = 0;
3854 - var loadFile = function(file, i) {
3855 - if (cm.options.allowDropFileTypes &&
3856 - indexOf(cm.options.allowDropFileTypes, file.type) == -1)
3857 - return;
3858 -
3859 - var reader = new FileReader;
3860 - reader.onload = operation(cm, function() {
3861 - var content = reader.result;
3862 - if (/[\x00-\x08\x0e-\x1f]{2}/.test(content)) content = "";
3863 - text[i] = content;
3864 - if (++read == n) {
3865 - pos = clipPos(cm.doc, pos);
3866 - var change = {from: pos, to: pos,
3867 - text: cm.doc.splitLines(text.join(cm.doc.lineSeparator())),
3868 - origin: "paste"};
3869 - makeChange(cm.doc, change);
3870 - setSelectionReplaceHistory(cm.doc, simpleSelection(pos, changeEnd(change)));
3871 - }
3872 - });
3873 - reader.readAsText(file);
3874 - };
3875 - for (var i = 0; i < n; ++i) loadFile(files[i], i);
3876 - } else { // Normal drop
3877 - // Don't do a replace if the drop happened inside of the selected text.
3878 - if (cm.state.draggingText && cm.doc.sel.contains(pos) > -1) {
3879 - cm.state.draggingText(e);
3880 - // Ensure the editor is re-focused
3881 - setTimeout(function() {cm.display.input.focus();}, 20);
3882 - return;
3883 - }
3884 - try {
3885 - var text = e.dataTransfer.getData("Text");
3886 - if (text) {
3887 - if (cm.state.draggingText && !(mac ? e.altKey : e.ctrlKey))
3888 - var selected = cm.listSelections();
3889 - setSelectionNoUndo(cm.doc, simpleSelection(pos, pos));
3890 - if (selected) for (var i = 0; i < selected.length; ++i)
3891 - replaceRange(cm.doc, "", selected[i].anchor, selected[i].head, "drag");
3892 - cm.replaceSelection(text, "around", "paste");
3893 - cm.display.input.focus();
3894 - }
3895 - }
3896 - catch(e){}
3897 - }
3898 - }
3899 -
3900 - function onDragStart(cm, e) {
3901 - if (ie && (!cm.state.draggingText || +new Date - lastDrop < 100)) { e_stop(e); return; }
3902 - if (signalDOMEvent(cm, e) || eventInWidget(cm.display, e)) return;
3903 -
3904 - e.dataTransfer.setData("Text", cm.getSelection());
3905 - e.dataTransfer.effectAllowed = "copyMove"
3906 -
3907 - // Use dummy image instead of default browsers image.
3908 - // Recent Safari (~6.0.2) have a tendency to segfault when this happens, so we don't do it there.
3909 - if (e.dataTransfer.setDragImage && !safari) {
3910 - var img = elt("img", null, null, "position: fixed; left: 0; top: 0;");
3911 - img.src = "data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==";
3912 - if (presto) {
3913 - img.width = img.height = 1;
3914 - cm.display.wrapper.appendChild(img);
3915 - // Force a relayout, or Opera won't use our image for some obscure reason
3916 - img._top = img.offsetTop;
3917 - }
3918 - e.dataTransfer.setDragImage(img, 0, 0);
3919 - if (presto) img.parentNode.removeChild(img);
3920 - }
3921 - }
3922 -
3923 - function onDragOver(cm, e) {
3924 - var pos = posFromMouse(cm, e);
3925 - if (!pos) return;
3926 - var frag = document.createDocumentFragment();
3927 - drawSelectionCursor(cm, pos, frag);
3928 - if (!cm.display.dragCursor) {
3929 - cm.display.dragCursor = elt("div", null, "CodeMirror-cursors CodeMirror-dragcursors");
3930 - cm.display.lineSpace.insertBefore(cm.display.dragCursor, cm.display.cursorDiv);
3931 - }
3932 - removeChildrenAndAdd(cm.display.dragCursor, frag);
3933 - }
3934 -
3935 - function clearDragCursor(cm) {
3936 - if (cm.display.dragCursor) {
3937 - cm.display.lineSpace.removeChild(cm.display.dragCursor);
3938 - cm.display.dragCursor = null;
3939 - }
3940 - }
3941 -
3942 - // SCROLL EVENTS
3943 -
3944 - // Sync the scrollable area and scrollbars, ensure the viewport
3945 - // covers the visible area.
3946 - function setScrollTop(cm, val) {
3947 - if (Math.abs(cm.doc.scrollTop - val) < 2) return;
3948 - cm.doc.scrollTop = val;
3949 - if (!gecko) updateDisplaySimple(cm, {top: val});
3950 - if (cm.display.scroller.scrollTop != val) cm.display.scroller.scrollTop = val;
3951 - cm.display.scrollbars.setScrollTop(val);
3952 - if (gecko) updateDisplaySimple(cm);
3953 - startWorker(cm, 100);
3954 - }
3955 - // Sync scroller and scrollbar, ensure the gutter elements are
3956 - // aligned.
3957 - function setScrollLeft(cm, val, isScroller) {
3958 - if (isScroller ? val == cm.doc.scrollLeft : Math.abs(cm.doc.scrollLeft - val) < 2) return;
3959 - val = Math.min(val, cm.display.scroller.scrollWidth - cm.display.scroller.clientWidth);
3960 - cm.doc.scrollLeft = val;
3961 - alignHorizontally(cm);
3962 - if (cm.display.scroller.scrollLeft != val) cm.display.scroller.scrollLeft = val;
3963 - cm.display.scrollbars.setScrollLeft(val);
3964 - }
3965 -
3966 - // Since the delta values reported on mouse wheel events are
3967 - // unstandardized between browsers and even browser versions, and
3968 - // generally horribly unpredictable, this code starts by measuring
3969 - // the scroll effect that the first few mouse wheel events have,
3970 - // and, from that, detects the way it can convert deltas to pixel
3971 - // offsets afterwards.
3972 - //
3973 - // The reason we want to know the amount a wheel event will scroll
3974 - // is that it gives us a chance to update the display before the
3975 - // actual scrolling happens, reducing flickering.
3976 -
3977 - var wheelSamples = 0, wheelPixelsPerUnit = null;
3978 - // Fill in a browser-detected starting value on browsers where we
3979 - // know one. These don't have to be accurate -- the result of them
3980 - // being wrong would just be a slight flicker on the first wheel
3981 - // scroll (if it is large enough).
3982 - if (ie) wheelPixelsPerUnit = -.53;
3983 - else if (gecko) wheelPixelsPerUnit = 15;
3984 - else if (chrome) wheelPixelsPerUnit = -.7;
3985 - else if (safari) wheelPixelsPerUnit = -1/3;
3986 -
3987 - var wheelEventDelta = function(e) {
3988 - var dx = e.wheelDeltaX, dy = e.wheelDeltaY;
3989 - if (dx == null && e.detail && e.axis == e.HORIZONTAL_AXIS) dx = e.detail;
3990 - if (dy == null && e.detail && e.axis == e.VERTICAL_AXIS) dy = e.detail;
3991 - else if (dy == null) dy = e.wheelDelta;
3992 - return {x: dx, y: dy};
3993 - };
3994 - CodeMirror.wheelEventPixels = function(e) {
3995 - var delta = wheelEventDelta(e);
3996 - delta.x *= wheelPixelsPerUnit;
3997 - delta.y *= wheelPixelsPerUnit;
3998 - return delta;
3999 - };
4000 -
4001 - function onScrollWheel(cm, e) {
4002 - var delta = wheelEventDelta(e), dx = delta.x, dy = delta.y;
4003 -
4004 - var display = cm.display, scroll = display.scroller;
4005 - // Quit if there's nothing to scroll here
4006 - var canScrollX = scroll.scrollWidth > scroll.clientWidth;
4007 - var canScrollY = scroll.scrollHeight > scroll.clientHeight;
4008 - if (!(dx && canScrollX || dy && canScrollY)) return;
4009 -
4010 - // Webkit browsers on OS X abort momentum scrolls when the target
4011 - // of the scroll event is removed from the scrollable element.
4012 - // This hack (see related code in patchDisplay) makes sure the
4013 - // element is kept around.
4014 - if (dy && mac && webkit) {
4015 - outer: for (var cur = e.target, view = display.view; cur != scroll; cur = cur.parentNode) {
4016 - for (var i = 0; i < view.length; i++) {
4017 - if (view[i].node == cur) {
4018 - cm.display.currentWheelTarget = cur;
4019 - break outer;
4020 - }
4021 - }
4022 - }
4023 - }
4024 -
4025 - // On some browsers, horizontal scrolling will cause redraws to
4026 - // happen before the gutter has been realigned, causing it to
4027 - // wriggle around in a most unseemly way. When we have an
4028 - // estimated pixels/delta value, we just handle horizontal
4029 - // scrolling entirely here. It'll be slightly off from native, but
4030 - // better than glitching out.
4031 - if (dx && !gecko && !presto && wheelPixelsPerUnit != null) {
4032 - if (dy && canScrollY)
4033 - setScrollTop(cm, Math.max(0, Math.min(scroll.scrollTop + dy * wheelPixelsPerUnit, scroll.scrollHeight - scroll.clientHeight)));
4034 - setScrollLeft(cm, Math.max(0, Math.min(scroll.scrollLeft + dx * wheelPixelsPerUnit, scroll.scrollWidth - scroll.clientWidth)));
4035 - // Only prevent default scrolling if vertical scrolling is
4036 - // actually possible. Otherwise, it causes vertical scroll
4037 - // jitter on OSX trackpads when deltaX is small and deltaY
4038 - // is large (issue #3579)
4039 - if (!dy || (dy && canScrollY))
4040 - e_preventDefault(e);
4041 - display.wheelStartX = null; // Abort measurement, if in progress
4042 - return;
4043 - }
4044 -
4045 - // 'Project' the visible viewport to cover the area that is being
4046 - // scrolled into view (if we know enough to estimate it).
4047 - if (dy && wheelPixelsPerUnit != null) {
4048 - var pixels = dy * wheelPixelsPerUnit;
4049 - var top = cm.doc.scrollTop, bot = top + display.wrapper.clientHeight;
4050 - if (pixels < 0) top = Math.max(0, top + pixels - 50);
4051 - else bot = Math.min(cm.doc.height, bot + pixels + 50);
4052 - updateDisplaySimple(cm, {top: top, bottom: bot});
4053 - }
4054 -
4055 - if (wheelSamples < 20) {
4056 - if (display.wheelStartX == null) {
4057 - display.wheelStartX = scroll.scrollLeft; display.wheelStartY = scroll.scrollTop;
4058 - display.wheelDX = dx; display.wheelDY = dy;
4059 - setTimeout(function() {
4060 - if (display.wheelStartX == null) return;
4061 - var movedX = scroll.scrollLeft - display.wheelStartX;
4062 - var movedY = scroll.scrollTop - display.wheelStartY;
4063 - var sample = (movedY && display.wheelDY && movedY / display.wheelDY) ||
4064 - (movedX && display.wheelDX && movedX / display.wheelDX);
4065 - display.wheelStartX = display.wheelStartY = null;
4066 - if (!sample) return;
4067 - wheelPixelsPerUnit = (wheelPixelsPerUnit * wheelSamples + sample) / (wheelSamples + 1);
4068 - ++wheelSamples;
4069 - }, 200);
4070 - } else {
4071 - display.wheelDX += dx; display.wheelDY += dy;
4072 - }
4073 - }
4074 - }
4075 -
4076 - // KEY EVENTS
4077 -
4078 - // Run a handler that was bound to a key.
4079 - function doHandleBinding(cm, bound, dropShift) {
4080 - if (typeof bound == "string") {
4081 - bound = commands[bound];
4082 - if (!bound) return false;
4083 - }
4084 - // Ensure previous input has been read, so that the handler sees a
4085 - // consistent view of the document
4086 - cm.display.input.ensurePolled();
4087 - var prevShift = cm.display.shift, done = false;
4088 - try {
4089 - if (cm.isReadOnly()) cm.state.suppressEdits = true;
4090 - if (dropShift) cm.display.shift = false;
4091 - done = bound(cm) != Pass;
4092 - } finally {
4093 - cm.display.shift = prevShift;
4094 - cm.state.suppressEdits = false;
4095 - }
4096 - return done;
4097 - }
4098 -
4099 - function lookupKeyForEditor(cm, name, handle) {
4100 - for (var i = 0; i < cm.state.keyMaps.length; i++) {
4101 - var result = lookupKey(name, cm.state.keyMaps[i], handle, cm);
4102 - if (result) return result;
4103 - }
4104 - return (cm.options.extraKeys && lookupKey(name, cm.options.extraKeys, handle, cm))
4105 - || lookupKey(name, cm.options.keyMap, handle, cm);
4106 - }
4107 -
4108 - var stopSeq = new Delayed;
4109 - function dispatchKey(cm, name, e, handle) {
4110 - var seq = cm.state.keySeq;
4111 - if (seq) {
4112 - if (isModifierKey(name)) return "handled";
4113 - stopSeq.set(50, function() {
4114 - if (cm.state.keySeq == seq) {
4115 - cm.state.keySeq = null;
4116 - cm.display.input.reset();
4117 - }
4118 - });
4119 - name = seq + " " + name;
4120 - }
4121 - var result = lookupKeyForEditor(cm, name, handle);
4122 -
4123 - if (result == "multi")
4124 - cm.state.keySeq = name;
4125 - if (result == "handled")
4126 - signalLater(cm, "keyHandled", cm, name, e);
4127 -
4128 - if (result == "handled" || result == "multi") {
4129 - e_preventDefault(e);
4130 - restartBlink(cm);
4131 - }
4132 -
4133 - if (seq && !result && /\'$/.test(name)) {
4134 - e_preventDefault(e);
4135 - return true;
4136 - }
4137 - return !!result;
4138 - }
4139 -
4140 - // Handle a key from the keydown event.
4141 - function handleKeyBinding(cm, e) {
4142 - var name = keyName(e, true);
4143 - if (!name) return false;
4144 -
4145 - if (e.shiftKey && !cm.state.keySeq) {
4146 - // First try to resolve full name (including 'Shift-'). Failing
4147 - // that, see if there is a cursor-motion command (starting with
4148 - // 'go') bound to the keyname without 'Shift-'.
4149 - return dispatchKey(cm, "Shift-" + name, e, function(b) {return doHandleBinding(cm, b, true);})
4150 - || dispatchKey(cm, name, e, function(b) {
4151 - if (typeof b == "string" ? /^go[A-Z]/.test(b) : b.motion)
4152 - return doHandleBinding(cm, b);
4153 - });
4154 - } else {
4155 - return dispatchKey(cm, name, e, function(b) { return doHandleBinding(cm, b); });
4156 - }
4157 - }
4158 -
4159 - // Handle a key from the keypress event
4160 - function handleCharBinding(cm, e, ch) {
4161 - return dispatchKey(cm, "'" + ch + "'", e,
4162 - function(b) { return doHandleBinding(cm, b, true); });
4163 - }
4164 -
4165 - var lastStoppedKey = null;
4166 - function onKeyDown(e) {
4167 - var cm = this;
4168 - cm.curOp.focus = activeElt();
4169 - if (signalDOMEvent(cm, e)) return;
4170 - // IE does strange things with escape.
4171 - if (ie && ie_version < 11 && e.keyCode == 27) e.returnValue = false;
4172 - var code = e.keyCode;
4173 - cm.display.shift = code == 16 || e.shiftKey;
4174 - var handled = handleKeyBinding(cm, e);
4175 - if (presto) {
4176 - lastStoppedKey = handled ? code : null;
4177 - // Opera has no cut event... we try to at least catch the key combo
4178 - if (!handled && code == 88 && !hasCopyEvent && (mac ? e.metaKey : e.ctrlKey))
4179 - cm.replaceSelection("", null, "cut");
4180 - }
4181 -
4182 - // Turn mouse into crosshair when Alt is held on Mac.
4183 - if (code == 18 && !/\bCodeMirror-crosshair\b/.test(cm.display.lineDiv.className))
4184 - showCrossHair(cm);
4185 - }
4186 -
4187 - function showCrossHair(cm) {
4188 - var lineDiv = cm.display.lineDiv;
4189 - addClass(lineDiv, "CodeMirror-crosshair");
4190 -
4191 - function up(e) {
4192 - if (e.keyCode == 18 || !e.altKey) {
4193 - rmClass(lineDiv, "CodeMirror-crosshair");
4194 - off(document, "keyup", up);
4195 - off(document, "mouseover", up);
4196 - }
4197 - }
4198 - on(document, "keyup", up);
4199 - on(document, "mouseover", up);
4200 - }
4201 -
4202 - function onKeyUp(e) {
4203 - if (e.keyCode == 16) this.doc.sel.shift = false;
4204 - signalDOMEvent(this, e);
4205 - }
4206 -
4207 - function onKeyPress(e) {
4208 - var cm = this;
4209 - if (eventInWidget(cm.display, e) || signalDOMEvent(cm, e) || e.ctrlKey && !e.altKey || mac && e.metaKey) return;
4210 - var keyCode = e.keyCode, charCode = e.charCode;
4211 - if (presto && keyCode == lastStoppedKey) {lastStoppedKey = null; e_preventDefault(e); return;}
4212 - if ((presto && (!e.which || e.which < 10)) && handleKeyBinding(cm, e)) return;
4213 - var ch = String.fromCharCode(charCode == null ? keyCode : charCode);
4214 - if (handleCharBinding(cm, e, ch)) return;
4215 - cm.display.input.onKeyPress(e);
4216 - }
4217 -
4218 - // FOCUS/BLUR EVENTS
4219 -
4220 - function delayBlurEvent(cm) {
4221 - cm.state.delayingBlurEvent = true;
4222 - setTimeout(function() {
4223 - if (cm.state.delayingBlurEvent) {
4224 - cm.state.delayingBlurEvent = false;
4225 - onBlur(cm);
4226 - }
4227 - }, 100);
4228 - }
4229 -
4230 - function onFocus(cm) {
4231 - if (cm.state.delayingBlurEvent) cm.state.delayingBlurEvent = false;
4232 -
4233 - if (cm.options.readOnly == "nocursor") return;
4234 - if (!cm.state.focused) {
4235 - signal(cm, "focus", cm);
4236 - cm.state.focused = true;
4237 - addClass(cm.display.wrapper, "CodeMirror-focused");
4238 - // This test prevents this from firing when a context
4239 - // menu is closed (since the input reset would kill the
4240 - // select-all detection hack)
4241 - if (!cm.curOp && cm.display.selForContextMenu != cm.doc.sel) {
4242 - cm.display.input.reset();
4243 - if (webkit) setTimeout(function() { cm.display.input.reset(true); }, 20); // Issue #1730
4244 - }
4245 - cm.display.input.receivedFocus();
4246 - }
4247 - restartBlink(cm);
4248 - }
4249 - function onBlur(cm) {
4250 - if (cm.state.delayingBlurEvent) return;
4251 -
4252 - if (cm.state.focused) {
4253 - signal(cm, "blur", cm);
4254 - cm.state.focused = false;
4255 - rmClass(cm.display.wrapper, "CodeMirror-focused");
4256 - }
4257 - clearInterval(cm.display.blinker);
4258 - setTimeout(function() {if (!cm.state.focused) cm.display.shift = false;}, 150);
4259 - }
4260 -
4261 - // CONTEXT MENU HANDLING
4262 -
4263 - // To make the context menu work, we need to briefly unhide the
4264 - // textarea (making it as unobtrusive as possible) to let the
4265 - // right-click take effect on it.
4266 - function onContextMenu(cm, e) {
4267 - if (eventInWidget(cm.display, e) || contextMenuInGutter(cm, e)) return;
4268 - if (signalDOMEvent(cm, e, "contextmenu")) return;
4269 - cm.display.input.onContextMenu(e);
4270 - }
4271 -
4272 - function contextMenuInGutter(cm, e) {
4273 - if (!hasHandler(cm, "gutterContextMenu")) return false;
4274 - return gutterEvent(cm, e, "gutterContextMenu", false);
4275 - }
4276 -
4277 - // UPDATING
4278 -
4279 - // Compute the position of the end of a change (its 'to' property
4280 - // refers to the pre-change end).
4281 - var changeEnd = CodeMirror.changeEnd = function(change) {
4282 - if (!change.text) return change.to;
4283 - return Pos(change.from.line + change.text.length - 1,
4284 - lst(change.text).length + (change.text.length == 1 ? change.from.ch : 0));
4285 - };
4286 -
4287 - // Adjust a position to refer to the post-change position of the
4288 - // same text, or the end of the change if the change covers it.
4289 - function adjustForChange(pos, change) {
4290 - if (cmp(pos, change.from) < 0) return pos;
4291 - if (cmp(pos, change.to) <= 0) return changeEnd(change);
4292 -
4293 - var line = pos.line + change.text.length - (change.to.line - change.from.line) - 1, ch = pos.ch;
4294 - if (pos.line == change.to.line) ch += changeEnd(change).ch - change.to.ch;
4295 - return Pos(line, ch);
4296 - }
4297 -
4298 - function computeSelAfterChange(doc, change) {
4299 - var out = [];
4300 - for (var i = 0; i < doc.sel.ranges.length; i++) {
4301 - var range = doc.sel.ranges[i];
4302 - out.push(new Range(adjustForChange(range.anchor, change),
4303 - adjustForChange(range.head, change)));
4304 - }
4305 - return normalizeSelection(out, doc.sel.primIndex);
4306 - }
4307 -
4308 - function offsetPos(pos, old, nw) {
4309 - if (pos.line == old.line)
4310 - return Pos(nw.line, pos.ch - old.ch + nw.ch);
4311 - else
4312 - return Pos(nw.line + (pos.line - old.line), pos.ch);
4313 - }
4314 -
4315 - // Used by replaceSelections to allow moving the selection to the
4316 - // start or around the replaced test. Hint may be "start" or "around".
4317 - function computeReplacedSel(doc, changes, hint) {
4318 - var out = [];
4319 - var oldPrev = Pos(doc.first, 0), newPrev = oldPrev;
4320 - for (var i = 0; i < changes.length; i++) {
4321 - var change = changes[i];
4322 - var from = offsetPos(change.from, oldPrev, newPrev);
4323 - var to = offsetPos(changeEnd(change), oldPrev, newPrev);
4324 - oldPrev = change.to;
4325 - newPrev = to;
4326 - if (hint == "around") {
4327 - var range = doc.sel.ranges[i], inv = cmp(range.head, range.anchor) < 0;
4328 - out[i] = new Range(inv ? to : from, inv ? from : to);
4329 - } else {
4330 - out[i] = new Range(from, from);
4331 - }
4332 - }
4333 - return new Selection(out, doc.sel.primIndex);
4334 - }
4335 -
4336 - // Allow "beforeChange" event handlers to influence a change
4337 - function filterChange(doc, change, update) {
4338 - var obj = {
4339 - canceled: false,
4340 - from: change.from,
4341 - to: change.to,
4342 - text: change.text,
4343 - origin: change.origin,
4344 - cancel: function() { this.canceled = true; }
4345 - };
4346 - if (update) obj.update = function(from, to, text, origin) {
4347 - if (from) this.from = clipPos(doc, from);
4348 - if (to) this.to = clipPos(doc, to);
4349 - if (text) this.text = text;
4350 - if (origin !== undefined) this.origin = origin;
4351 - };
4352 - signal(doc, "beforeChange", doc, obj);
4353 - if (doc.cm) signal(doc.cm, "beforeChange", doc.cm, obj);
4354 -
4355 - if (obj.canceled) return null;
4356 - return {from: obj.from, to: obj.to, text: obj.text, origin: obj.origin};
4357 - }
4358 -
4359 - // Apply a change to a document, and add it to the document's
4360 - // history, and propagating it to all linked documents.
4361 - function makeChange(doc, change, ignoreReadOnly) {
4362 - if (doc.cm) {
4363 - if (!doc.cm.curOp) return operation(doc.cm, makeChange)(doc, change, ignoreReadOnly);
4364 - if (doc.cm.state.suppressEdits) return;
4365 - }
4366 -
4367 - if (hasHandler(doc, "beforeChange") || doc.cm && hasHandler(doc.cm, "beforeChange")) {
4368 - change = filterChange(doc, change, true);
4369 - if (!change) return;
4370 - }
4371 -
4372 - // Possibly split or suppress the update based on the presence
4373 - // of read-only spans in its range.
4374 - var split = sawReadOnlySpans && !ignoreReadOnly && removeReadOnlyRanges(doc, change.from, change.to);
4375 - if (split) {
4376 - for (var i = split.length - 1; i >= 0; --i)
4377 - makeChangeInner(doc, {from: split[i].from, to: split[i].to, text: i ? [""] : change.text});
4378 - } else {
4379 - makeChangeInner(doc, change);
4380 - }
4381 - }
4382 -
4383 - function makeChangeInner(doc, change) {
4384 - if (change.text.length == 1 && change.text[0] == "" && cmp(change.from, change.to) == 0) return;
4385 - var selAfter = computeSelAfterChange(doc, change);
4386 - addChangeToHistory(doc, change, selAfter, doc.cm ? doc.cm.curOp.id : NaN);
4387 -
4388 - makeChangeSingleDoc(doc, change, selAfter, stretchSpansOverChange(doc, change));
4389 - var rebased = [];
4390 -
4391 - linkedDocs(doc, function(doc, sharedHist) {
4392 - if (!sharedHist && indexOf(rebased, doc.history) == -1) {
4393 - rebaseHist(doc.history, change);
4394 - rebased.push(doc.history);
4395 - }
4396 - makeChangeSingleDoc(doc, change, null, stretchSpansOverChange(doc, change));
4397 - });
4398 - }
4399 -
4400 - // Revert a change stored in a document's history.
4401 - function makeChangeFromHistory(doc, type, allowSelectionOnly) {
4402 - if (doc.cm && doc.cm.state.suppressEdits) return;
4403 -
4404 - var hist = doc.history, event, selAfter = doc.sel;
4405 - var source = type == "undo" ? hist.done : hist.undone, dest = type == "undo" ? hist.undone : hist.done;
4406 -
4407 - // Verify that there is a useable event (so that ctrl-z won't
4408 - // needlessly clear selection events)
4409 - for (var i = 0; i < source.length; i++) {
4410 - event = source[i];
4411 - if (allowSelectionOnly ? event.ranges && !event.equals(doc.sel) : !event.ranges)
4412 - break;
4413 - }
4414 - if (i == source.length) return;
4415 - hist.lastOrigin = hist.lastSelOrigin = null;
4416 -
4417 - for (;;) {
4418 - event = source.pop();
4419 - if (event.ranges) {
4420 - pushSelectionToHistory(event, dest);
4421 - if (allowSelectionOnly && !event.equals(doc.sel)) {
4422 - setSelection(doc, event, {clearRedo: false});
4423 - return;
4424 - }
4425 - selAfter = event;
4426 - }
4427 - else break;
4428 - }
4429 -
4430 - // Build up a reverse change object to add to the opposite history
4431 - // stack (redo when undoing, and vice versa).
4432 - var antiChanges = [];
4433 - pushSelectionToHistory(selAfter, dest);
4434 - dest.push({changes: antiChanges, generation: hist.generation});
4435 - hist.generation = event.generation || ++hist.maxGeneration;
4436 -
4437 - var filter = hasHandler(doc, "beforeChange") || doc.cm && hasHandler(doc.cm, "beforeChange");
4438 -
4439 - for (var i = event.changes.length - 1; i >= 0; --i) {
4440 - var change = event.changes[i];
4441 - change.origin = type;
4442 - if (filter && !filterChange(doc, change, false)) {
4443 - source.length = 0;
4444 - return;
4445 - }
4446 -
4447 - antiChanges.push(historyChangeFromChange(doc, change));
4448 -
4449 - var after = i ? computeSelAfterChange(doc, change) : lst(source);
4450 - makeChangeSingleDoc(doc, change, after, mergeOldSpans(doc, change));
4451 - if (!i && doc.cm) doc.cm.scrollIntoView({from: change.from, to: changeEnd(change)});
4452 - var rebased = [];
4453 -
4454 - // Propagate to the linked documents
4455 - linkedDocs(doc, function(doc, sharedHist) {
4456 - if (!sharedHist && indexOf(rebased, doc.history) == -1) {
4457 - rebaseHist(doc.history, change);
4458 - rebased.push(doc.history);
4459 - }
4460 - makeChangeSingleDoc(doc, change, null, mergeOldSpans(doc, change));
4461 - });
4462 - }
4463 - }
4464 -
4465 - // Sub-views need their line numbers shifted when text is added
4466 - // above or below them in the parent document.
4467 - function shiftDoc(doc, distance) {
4468 - if (distance == 0) return;
4469 - doc.first += distance;
4470 - doc.sel = new Selection(map(doc.sel.ranges, function(range) {
4471 - return new Range(Pos(range.anchor.line + distance, range.anchor.ch),
4472 - Pos(range.head.line + distance, range.head.ch));
4473 - }), doc.sel.primIndex);
4474 - if (doc.cm) {
4475 - regChange(doc.cm, doc.first, doc.first - distance, distance);
4476 - for (var d = doc.cm.display, l = d.viewFrom; l < d.viewTo; l++)
4477 - regLineChange(doc.cm, l, "gutter");
4478 - }
4479 - }
4480 -
4481 - // More lower-level change function, handling only a single document
4482 - // (not linked ones).
4483 - function makeChangeSingleDoc(doc, change, selAfter, spans) {
4484 - if (doc.cm && !doc.cm.curOp)
4485 - return operation(doc.cm, makeChangeSingleDoc)(doc, change, selAfter, spans);
4486 -
4487 - if (change.to.line < doc.first) {
4488 - shiftDoc(doc, change.text.length - 1 - (change.to.line - change.from.line));
4489 - return;
4490 - }
4491 - if (change.from.line > doc.lastLine()) return;
4492 -
4493 - // Clip the change to the size of this doc
4494 - if (change.from.line < doc.first) {
4495 - var shift = change.text.length - 1 - (doc.first - change.from.line);
4496 - shiftDoc(doc, shift);
4497 - change = {from: Pos(doc.first, 0), to: Pos(change.to.line + shift, change.to.ch),
4498 - text: [lst(change.text)], origin: change.origin};
4499 - }
4500 - var last = doc.lastLine();
4501 - if (change.to.line > last) {
4502 - change = {from: change.from, to: Pos(last, getLine(doc, last).text.length),
4503 - text: [change.text[0]], origin: change.origin};
4504 - }
4505 -
4506 - change.removed = getBetween(doc, change.from, change.to);
4507 -
4508 - if (!selAfter) selAfter = computeSelAfterChange(doc, change);
4509 - if (doc.cm) makeChangeSingleDocInEditor(doc.cm, change, spans);
4510 - else updateDoc(doc, change, spans);
4511 - setSelectionNoUndo(doc, selAfter, sel_dontScroll);
4512 - }
4513 -
4514 - // Handle the interaction of a change to a document with the editor
4515 - // that this document is part of.
4516 - function makeChangeSingleDocInEditor(cm, change, spans) {
4517 - var doc = cm.doc, display = cm.display, from = change.from, to = change.to;
4518 -
4519 - var recomputeMaxLength = false, checkWidthStart = from.line;
4520 - if (!cm.options.lineWrapping) {
4521 - checkWidthStart = lineNo(visualLine(getLine(doc, from.line)));
4522 - doc.iter(checkWidthStart, to.line + 1, function(line) {
4523 - if (line == display.maxLine) {
4524 - recomputeMaxLength = true;
4525 - return true;
4526 - }
4527 - });
4528 - }
4529 -
4530 - if (doc.sel.contains(change.from, change.to) > -1)
4531 - signalCursorActivity(cm);
4532 -
4533 - updateDoc(doc, change, spans, estimateHeight(cm));
4534 -
4535 - if (!cm.options.lineWrapping) {
4536 - doc.iter(checkWidthStart, from.line + change.text.length, function(line) {
4537 - var len = lineLength(line);
4538 - if (len > display.maxLineLength) {
4539 - display.maxLine = line;
4540 - display.maxLineLength = len;
4541 - display.maxLineChanged = true;
4542 - recomputeMaxLength = false;
4543 - }
4544 - });
4545 - if (recomputeMaxLength) cm.curOp.updateMaxLine = true;
4546 - }
4547 -
4548 - // Adjust frontier, schedule worker
4549 - doc.frontier = Math.min(doc.frontier, from.line);
4550 - startWorker(cm, 400);
4551 -
4552 - var lendiff = change.text.length - (to.line - from.line) - 1;
4553 - // Remember that these lines changed, for updating the display
4554 - if (change.full)
4555 - regChange(cm);
4556 - else if (from.line == to.line && change.text.length == 1 && !isWholeLineUpdate(cm.doc, change))
4557 - regLineChange(cm, from.line, "text");
4558 - else
4559 - regChange(cm, from.line, to.line + 1, lendiff);
4560 -
4561 - var changesHandler = hasHandler(cm, "changes"), changeHandler = hasHandler(cm, "change");
4562 - if (changeHandler || changesHandler) {
4563 - var obj = {
4564 - from: from, to: to,
4565 - text: change.text,
4566 - removed: change.removed,
4567 - origin: change.origin
4568 - };
4569 - if (changeHandler) signalLater(cm, "change", cm, obj);
4570 - if (changesHandler) (cm.curOp.changeObjs || (cm.curOp.changeObjs = [])).push(obj);
4571 - }
4572 - cm.display.selForContextMenu = null;
4573 - }
4574 -
4575 - function replaceRange(doc, code, from, to, origin) {
4576 - if (!to) to = from;
4577 - if (cmp(to, from) < 0) { var tmp = to; to = from; from = tmp; }
4578 - if (typeof code == "string") code = doc.splitLines(code);
4579 - makeChange(doc, {from: from, to: to, text: code, origin: origin});
4580 - }
4581 -
4582 - // SCROLLING THINGS INTO VIEW
4583 -
4584 - // If an editor sits on the top or bottom of the window, partially
4585 - // scrolled out of view, this ensures that the cursor is visible.
4586 - function maybeScrollWindow(cm, coords) {
4587 - if (signalDOMEvent(cm, "scrollCursorIntoView")) return;
4588 -
4589 - var display = cm.display, box = display.sizer.getBoundingClientRect(), doScroll = null;
4590 - if (coords.top + box.top < 0) doScroll = true;
4591 - else if (coords.bottom + box.top > (window.innerHeight || document.documentElement.clientHeight)) doScroll = false;
4592 - if (doScroll != null && !phantom) {
4593 - var scrollNode = elt("div", "\u200b", null, "position: absolute; top: " +
4594 - (coords.top - display.viewOffset - paddingTop(cm.display)) + "px; height: " +
4595 - (coords.bottom - coords.top + scrollGap(cm) + display.barHeight) + "px; left: " +
4596 - coords.left + "px; width: 2px;");
4597 - cm.display.lineSpace.appendChild(scrollNode);
4598 - scrollNode.scrollIntoView(doScroll);
4599 - cm.display.lineSpace.removeChild(scrollNode);
4600 - }
4601 - }
4602 -
4603 - // Scroll a given position into view (immediately), verifying that
4604 - // it actually became visible (as line heights are accurately
4605 - // measured, the position of something may 'drift' during drawing).
4606 - function scrollPosIntoView(cm, pos, end, margin) {
4607 - if (margin == null) margin = 0;
4608 - for (var limit = 0; limit < 5; limit++) {
4609 - var changed = false, coords = cursorCoords(cm, pos);
4610 - var endCoords = !end || end == pos ? coords : cursorCoords(cm, end);
4611 - var scrollPos = calculateScrollPos(cm, Math.min(coords.left, endCoords.left),
4612 - Math.min(coords.top, endCoords.top) - margin,
4613 - Math.max(coords.left, endCoords.left),
4614 - Math.max(coords.bottom, endCoords.bottom) + margin);
4615 - var startTop = cm.doc.scrollTop, startLeft = cm.doc.scrollLeft;
4616 - if (scrollPos.scrollTop != null) {
4617 - setScrollTop(cm, scrollPos.scrollTop);
4618 - if (Math.abs(cm.doc.scrollTop - startTop) > 1) changed = true;
4619 - }
4620 - if (scrollPos.scrollLeft != null) {
4621 - setScrollLeft(cm, scrollPos.scrollLeft);
4622 - if (Math.abs(cm.doc.scrollLeft - startLeft) > 1) changed = true;
4623 - }
4624 - if (!changed) break;
4625 - }
4626 - return coords;
4627 - }
4628 -
4629 - // Scroll a given set of coordinates into view (immediately).
4630 - function scrollIntoView(cm, x1, y1, x2, y2) {
4631 - var scrollPos = calculateScrollPos(cm, x1, y1, x2, y2);
4632 - if (scrollPos.scrollTop != null) setScrollTop(cm, scrollPos.scrollTop);
4633 - if (scrollPos.scrollLeft != null) setScrollLeft(cm, scrollPos.scrollLeft);
4634 - }
4635 -
4636 - // Calculate a new scroll position needed to scroll the given
4637 - // rectangle into view. Returns an object with scrollTop and
4638 - // scrollLeft properties. When these are undefined, the
4639 - // vertical/horizontal position does not need to be adjusted.
4640 - function calculateScrollPos(cm, x1, y1, x2, y2) {
4641 - var display = cm.display, snapMargin = textHeight(cm.display);
4642 - if (y1 < 0) y1 = 0;
4643 - var screentop = cm.curOp && cm.curOp.scrollTop != null ? cm.curOp.scrollTop : display.scroller.scrollTop;
4644 - var screen = displayHeight(cm), result = {};
4645 - if (y2 - y1 > screen) y2 = y1 + screen;
4646 - var docBottom = cm.doc.height + paddingVert(display);
4647 - var atTop = y1 < snapMargin, atBottom = y2 > docBottom - snapMargin;
4648 - if (y1 < screentop) {
4649 - result.scrollTop = atTop ? 0 : y1;
4650 - } else if (y2 > screentop + screen) {
4651 - var newTop = Math.min(y1, (atBottom ? docBottom : y2) - screen);
4652 - if (newTop != screentop) result.scrollTop = newTop;
4653 - }
4654 -
4655 - var screenleft = cm.curOp && cm.curOp.scrollLeft != null ? cm.curOp.scrollLeft : display.scroller.scrollLeft;
4656 - var screenw = displayWidth(cm) - (cm.options.fixedGutter ? display.gutters.offsetWidth : 0);
4657 - var tooWide = x2 - x1 > screenw;
4658 - if (tooWide) x2 = x1 + screenw;
4659 - if (x1 < 10)
4660 - result.scrollLeft = 0;
4661 - else if (x1 < screenleft)
4662 - result.scrollLeft = Math.max(0, x1 - (tooWide ? 0 : 10));
4663 - else if (x2 > screenw + screenleft - 3)
4664 - result.scrollLeft = x2 + (tooWide ? 0 : 10) - screenw;
4665 - return result;
4666 - }
4667 -
4668 - // Store a relative adjustment to the scroll position in the current
4669 - // operation (to be applied when the operation finishes).
4670 - function addToScrollPos(cm, left, top) {
4671 - if (left != null || top != null) resolveScrollToPos(cm);
4672 - if (left != null)
4673 - cm.curOp.scrollLeft = (cm.curOp.scrollLeft == null ? cm.doc.scrollLeft : cm.curOp.scrollLeft) + left;
4674 - if (top != null)
4675 - cm.curOp.scrollTop = (cm.curOp.scrollTop == null ? cm.doc.scrollTop : cm.curOp.scrollTop) + top;
4676 - }
4677 -
4678 - // Make sure that at the end of the operation the current cursor is
4679 - // shown.
4680 - function ensureCursorVisible(cm) {
4681 - resolveScrollToPos(cm);
4682 - var cur = cm.getCursor(), from = cur, to = cur;
4683 - if (!cm.options.lineWrapping) {
4684 - from = cur.ch ? Pos(cur.line, cur.ch - 1) : cur;
4685 - to = Pos(cur.line, cur.ch + 1);
4686 - }
4687 - cm.curOp.scrollToPos = {from: from, to: to, margin: cm.options.cursorScrollMargin, isCursor: true};
4688 - }
4689 -
4690 - // When an operation has its scrollToPos property set, and another
4691 - // scroll action is applied before the end of the operation, this
4692 - // 'simulates' scrolling that position into view in a cheap way, so
4693 - // that the effect of intermediate scroll commands is not ignored.
4694 - function resolveScrollToPos(cm) {
4695 - var range = cm.curOp.scrollToPos;
4696 - if (range) {
4697 - cm.curOp.scrollToPos = null;
4698 - var from = estimateCoords(cm, range.from), to = estimateCoords(cm, range.to);
4699 - var sPos = calculateScrollPos(cm, Math.min(from.left, to.left),
4700 - Math.min(from.top, to.top) - range.margin,
4701 - Math.max(from.right, to.right),
4702 - Math.max(from.bottom, to.bottom) + range.margin);
4703 - cm.scrollTo(sPos.scrollLeft, sPos.scrollTop);
4704 - }
4705 - }
4706 -
4707 - // API UTILITIES
4708 -
4709 - // Indent the given line. The how parameter can be "smart",
4710 - // "add"/null, "subtract", or "prev". When aggressive is false
4711 - // (typically set to true for forced single-line indents), empty
4712 - // lines are not indented, and places where the mode returns Pass
4713 - // are left alone.
4714 - function indentLine(cm, n, how, aggressive) {
4715 - var doc = cm.doc, state;
4716 - if (how == null) how = "add";
4717 - if (how == "smart") {
4718 - // Fall back to "prev" when the mode doesn't have an indentation
4719 - // method.
4720 - if (!doc.mode.indent) how = "prev";
4721 - else state = getStateBefore(cm, n);
4722 - }
4723 -
4724 - var tabSize = cm.options.tabSize;
4725 - var line = getLine(doc, n), curSpace = countColumn(line.text, null, tabSize);
4726 - if (line.stateAfter) line.stateAfter = null;
4727 - var curSpaceString = line.text.match(/^\s*/)[0], indentation;
4728 - if (!aggressive && !/\S/.test(line.text)) {
4729 - indentation = 0;
4730 - how = "not";
4731 - } else if (how == "smart") {
4732 - indentation = doc.mode.indent(state, line.text.slice(curSpaceString.length), line.text);
4733 - if (indentation == Pass || indentation > 150) {
4734 - if (!aggressive) return;
4735 - how = "prev";
4736 - }
4737 - }
4738 - if (how == "prev") {
4739 - if (n > doc.first) indentation = countColumn(getLine(doc, n-1).text, null, tabSize);
4740 - else indentation = 0;
4741 - } else if (how == "add") {
4742 - indentation = curSpace + cm.options.indentUnit;
4743 - } else if (how == "subtract") {
4744 - indentation = curSpace - cm.options.indentUnit;
4745 - } else if (typeof how == "number") {
4746 - indentation = curSpace + how;
4747 - }
4748 - indentation = Math.max(0, indentation);
4749 -
4750 - var indentString = "", pos = 0;
4751 - if (cm.options.indentWithTabs)
4752 - for (var i = Math.floor(indentation / tabSize); i; --i) {pos += tabSize; indentString += "\t";}
4753 - if (pos < indentation) indentString += spaceStr(indentation - pos);
4754 -
4755 - if (indentString != curSpaceString) {
4756 - replaceRange(doc, indentString, Pos(n, 0), Pos(n, curSpaceString.length), "+input");
4757 - line.stateAfter = null;
4758 - return true;
4759 - } else {
4760 - // Ensure that, if the cursor was in the whitespace at the start
4761 - // of the line, it is moved to the end of that space.
4762 - for (var i = 0; i < doc.sel.ranges.length; i++) {
4763 - var range = doc.sel.ranges[i];
4764 - if (range.head.line == n && range.head.ch < curSpaceString.length) {
4765 - var pos = Pos(n, curSpaceString.length);
4766 - replaceOneSelection(doc, i, new Range(pos, pos));
4767 - break;
4768 - }
4769 - }
4770 - }
4771 - }
4772 -
4773 - // Utility for applying a change to a line by handle or number,
4774 - // returning the number and optionally registering the line as
4775 - // changed.
4776 - function changeLine(doc, handle, changeType, op) {
4777 - var no = handle, line = handle;
4778 - if (typeof handle == "number") line = getLine(doc, clipLine(doc, handle));
4779 - else no = lineNo(handle);
4780 - if (no == null) return null;
4781 - if (op(line, no) && doc.cm) regLineChange(doc.cm, no, changeType);
4782 - return line;
4783 - }
4784 -
4785 - // Helper for deleting text near the selection(s), used to implement
4786 - // backspace, delete, and similar functionality.
4787 - function deleteNearSelection(cm, compute) {
4788 - var ranges = cm.doc.sel.ranges, kill = [];
4789 - // Build up a set of ranges to kill first, merging overlapping
4790 - // ranges.
4791 - for (var i = 0; i < ranges.length; i++) {
4792 - var toKill = compute(ranges[i]);
4793 - while (kill.length && cmp(toKill.from, lst(kill).to) <= 0) {
4794 - var replaced = kill.pop();
4795 - if (cmp(replaced.from, toKill.from) < 0) {
4796 - toKill.from = replaced.from;
4797 - break;
4798 - }
4799 - }
4800 - kill.push(toKill);
4801 - }
4802 - // Next, remove those actual ranges.
4803 - runInOp(cm, function() {
4804 - for (var i = kill.length - 1; i >= 0; i--)
4805 - replaceRange(cm.doc, "", kill[i].from, kill[i].to, "+delete");
4806 - ensureCursorVisible(cm);
4807 - });
4808 - }
4809 -
4810 - // Used for horizontal relative motion. Dir is -1 or 1 (left or
4811 - // right), unit can be "char", "column" (like char, but doesn't
4812 - // cross line boundaries), "word" (across next word), or "group" (to
4813 - // the start of next group of word or non-word-non-whitespace
4814 - // chars). The visually param controls whether, in right-to-left
4815 - // text, direction 1 means to move towards the next index in the
4816 - // string, or towards the character to the right of the current
4817 - // position. The resulting position will have a hitSide=true
4818 - // property if it reached the end of the document.
4819 - function findPosH(doc, pos, dir, unit, visually) {
4820 - var line = pos.line, ch = pos.ch, origDir = dir;
4821 - var lineObj = getLine(doc, line);
4822 - function findNextLine() {
4823 - var l = line + dir;
4824 - if (l < doc.first || l >= doc.first + doc.size) return false
4825 - line = l;
4826 - return lineObj = getLine(doc, l);
4827 - }
4828 - function moveOnce(boundToLine) {
4829 - var next = (visually ? moveVisually : moveLogically)(lineObj, ch, dir, true);
4830 - if (next == null) {
4831 - if (!boundToLine && findNextLine()) {
4832 - if (visually) ch = (dir < 0 ? lineRight : lineLeft)(lineObj);
4833 - else ch = dir < 0 ? lineObj.text.length : 0;
4834 - } else return false
4835 - } else ch = next;
4836 - return true;
4837 - }
4838 -
4839 - if (unit == "char") {
4840 - moveOnce()
4841 - } else if (unit == "column") {
4842 - moveOnce(true)
4843 - } else if (unit == "word" || unit == "group") {
4844 - var sawType = null, group = unit == "group";
4845 - var helper = doc.cm && doc.cm.getHelper(pos, "wordChars");
4846 - for (var first = true;; first = false) {
4847 - if (dir < 0 && !moveOnce(!first)) break;
4848 - var cur = lineObj.text.charAt(ch) || "\n";
4849 - var type = isWordChar(cur, helper) ? "w"
4850 - : group && cur == "\n" ? "n"
4851 - : !group || /\s/.test(cur) ? null
4852 - : "p";
4853 - if (group && !first && !type) type = "s";
4854 - if (sawType && sawType != type) {
4855 - if (dir < 0) {dir = 1; moveOnce();}
4856 - break;
4857 - }
4858 -
4859 - if (type) sawType = type;
4860 - if (dir > 0 && !moveOnce(!first)) break;
4861 - }
4862 - }
4863 - var result = skipAtomic(doc, Pos(line, ch), pos, origDir, true);
4864 - if (!cmp(pos, result)) result.hitSide = true;
4865 - return result;
4866 - }
4867 -
4868 - // For relative vertical movement. Dir may be -1 or 1. Unit can be
4869 - // "page" or "line". The resulting position will have a hitSide=true
4870 - // property if it reached the end of the document.
4871 - function findPosV(cm, pos, dir, unit) {
4872 - var doc = cm.doc, x = pos.left, y;
4873 - if (unit == "page") {
4874 - var pageSize = Math.min(cm.display.wrapper.clientHeight, window.innerHeight || document.documentElement.clientHeight);
4875 - y = pos.top + dir * (pageSize - (dir < 0 ? 1.5 : .5) * textHeight(cm.display));
4876 - } else if (unit == "line") {
4877 - y = dir > 0 ? pos.bottom + 3 : pos.top - 3;
4878 - }
4879 - for (;;) {
4880 - var target = coordsChar(cm, x, y);
4881 - if (!target.outside) break;
4882 - if (dir < 0 ? y <= 0 : y >= doc.height) { target.hitSide = true; break; }
4883 - y += dir * 5;
4884 - }
4885 - return target;
4886 - }
4887 -
4888 - // EDITOR METHODS
4889 -
4890 - // The publicly visible API. Note that methodOp(f) means
4891 - // 'wrap f in an operation, performed on its `this` parameter'.
4892 -
4893 - // This is not the complete set of editor methods. Most of the
4894 - // methods defined on the Doc type are also injected into
4895 - // CodeMirror.prototype, for backwards compatibility and
4896 - // convenience.
4897 -
4898 - CodeMirror.prototype = {
4899 - constructor: CodeMirror,
4900 - focus: function(){window.focus(); this.display.input.focus();},
4901 -
4902 - setOption: function(option, value) {
4903 - var options = this.options, old = options[option];
4904 - if (options[option] == value && option != "mode") return;
4905 - options[option] = value;
4906 - if (optionHandlers.hasOwnProperty(option))
4907 - operation(this, optionHandlers[option])(this, value, old);
4908 - },
4909 -
4910 - getOption: function(option) {return this.options[option];},
4911 - getDoc: function() {return this.doc;},
4912 -
4913 - addKeyMap: function(map, bottom) {
4914 - this.state.keyMaps[bottom ? "push" : "unshift"](getKeyMap(map));
4915 - },
4916 - removeKeyMap: function(map) {
4917 - var maps = this.state.keyMaps;
4918 - for (var i = 0; i < maps.length; ++i)
4919 - if (maps[i] == map || maps[i].name == map) {
4920 - maps.splice(i, 1);
4921 - return true;
4922 - }
4923 - },
4924 -
4925 - addOverlay: methodOp(function(spec, options) {
4926 - var mode = spec.token ? spec : CodeMirror.getMode(this.options, spec);
4927 - if (mode.startState) throw new Error("Overlays may not be stateful.");
4928 - this.state.overlays.push({mode: mode, modeSpec: spec, opaque: options && options.opaque});
4929 - this.state.modeGen++;
4930 - regChange(this);
4931 - }),
4932 - removeOverlay: methodOp(function(spec) {
4933 - var overlays = this.state.overlays;
4934 - for (var i = 0; i < overlays.length; ++i) {
4935 - var cur = overlays[i].modeSpec;
4936 - if (cur == spec || typeof spec == "string" && cur.name == spec) {
4937 - overlays.splice(i, 1);
4938 - this.state.modeGen++;
4939 - regChange(this);
4940 - return;
4941 - }
4942 - }
4943 - }),
4944 -
4945 - indentLine: methodOp(function(n, dir, aggressive) {
4946 - if (typeof dir != "string" && typeof dir != "number") {
4947 - if (dir == null) dir = this.options.smartIndent ? "smart" : "prev";
4948 - else dir = dir ? "add" : "subtract";
4949 - }
4950 - if (isLine(this.doc, n)) indentLine(this, n, dir, aggressive);
4951 - }),
4952 - indentSelection: methodOp(function(how) {
4953 - var ranges = this.doc.sel.ranges, end = -1;
4954 - for (var i = 0; i < ranges.length; i++) {
4955 - var range = ranges[i];
4956 - if (!range.empty()) {
4957 - var from = range.from(), to = range.to();
4958 - var start = Math.max(end, from.line);
4959 - end = Math.min(this.lastLine(), to.line - (to.ch ? 0 : 1)) + 1;
4960 - for (var j = start; j < end; ++j)
4961 - indentLine(this, j, how);
4962 - var newRanges = this.doc.sel.ranges;
4963 - if (from.ch == 0 && ranges.length == newRanges.length && newRanges[i].from().ch > 0)
4964 - replaceOneSelection(this.doc, i, new Range(from, newRanges[i].to()), sel_dontScroll);
4965 - } else if (range.head.line > end) {
4966 - indentLine(this, range.head.line, how, true);
4967 - end = range.head.line;
4968 - if (i == this.doc.sel.primIndex) ensureCursorVisible(this);
4969 - }
4970 - }
4971 - }),
4972 -
4973 - // Fetch the parser token for a given character. Useful for hacks
4974 - // that want to inspect the mode state (say, for completion).
4975 - getTokenAt: function(pos, precise) {
4976 - return takeToken(this, pos, precise);
4977 - },
4978 -
4979 - getLineTokens: function(line, precise) {
4980 - return takeToken(this, Pos(line), precise, true);
4981 - },
4982 -
4983 - getTokenTypeAt: function(pos) {
4984 - pos = clipPos(this.doc, pos);
4985 - var styles = getLineStyles(this, getLine(this.doc, pos.line));
4986 - var before = 0, after = (styles.length - 1) / 2, ch = pos.ch;
4987 - var type;
4988 - if (ch == 0) type = styles[2];
4989 - else for (;;) {
4990 - var mid = (before + after) >> 1;
4991 - if ((mid ? styles[mid * 2 - 1] : 0) >= ch) after = mid;
4992 - else if (styles[mid * 2 + 1] < ch) before = mid + 1;
4993 - else { type = styles[mid * 2 + 2]; break; }
4994 - }
4995 - var cut = type ? type.indexOf("cm-overlay ") : -1;
4996 - return cut < 0 ? type : cut == 0 ? null : type.slice(0, cut - 1);
4997 - },
4998 -
4999 - getModeAt: function(pos) {

This file is too large to show in full.

docs/js/es5-sham.min.js deleted
-2
@@ -1,2 +0,0 @@
1 -(function(definition){if(typeof define=="function"){define(definition)}else if(typeof YUI=="function"){YUI.add("es5-sham",definition)}else{definition()}})(function(){var call=Function.prototype.call;var prototypeOfObject=Object.prototype;var owns=call.bind(prototypeOfObject.hasOwnProperty);var defineGetter;var defineSetter;var lookupGetter;var lookupSetter;var supportsAccessors;if(supportsAccessors=owns(prototypeOfObject,"__defineGetter__")){defineGetter=call.bind(prototypeOfObject.__defineGetter__);defineSetter=call.bind(prototypeOfObject.__defineSetter__);lookupGetter=call.bind(prototypeOfObject.__lookupGetter__);lookupSetter=call.bind(prototypeOfObject.__lookupSetter__)}if(!Object.getPrototypeOf){Object.getPrototypeOf=function getPrototypeOf(object){return object.__proto__||(object.constructor?object.constructor.prototype:prototypeOfObject)}}function doesGetOwnPropertyDescriptorWork(object){try{object.sentinel=0;return Object.getOwnPropertyDescriptor(object,"sentinel").value===0}catch(exception){}}if(Object.defineProperty){var getOwnPropertyDescriptorWorksOnObject=doesGetOwnPropertyDescriptorWork({});var getOwnPropertyDescriptorWorksOnDom=typeof document=="undefined"||doesGetOwnPropertyDescriptorWork(document.createElement("div"));if(!getOwnPropertyDescriptorWorksOnDom||!getOwnPropertyDescriptorWorksOnObject){var getOwnPropertyDescriptorFallback=Object.getOwnPropertyDescriptor}}if(!Object.getOwnPropertyDescriptor||getOwnPropertyDescriptorFallback){var ERR_NON_OBJECT="Object.getOwnPropertyDescriptor called on a non-object: ";Object.getOwnPropertyDescriptor=function getOwnPropertyDescriptor(object,property){if(typeof object!="object"&&typeof object!="function"||object===null){throw new TypeError(ERR_NON_OBJECT+object)}if(getOwnPropertyDescriptorFallback){try{return getOwnPropertyDescriptorFallback.call(Object,object,property)}catch(exception){}}if(!owns(object,property)){return}var descriptor={enumerable:true,configurable:true};if(supportsAccessors){var prototype=object.__proto__;object.__proto__=prototypeOfObject;var getter=lookupGetter(object,property);var setter=lookupSetter(object,property);object.__proto__=prototype;if(getter||setter){if(getter){descriptor.get=getter}if(setter){descriptor.set=setter}return descriptor}}descriptor.value=object[property];descriptor.writable=true;return descriptor}}if(!Object.getOwnPropertyNames){Object.getOwnPropertyNames=function getOwnPropertyNames(object){return Object.keys(object)}}if(!Object.create){var createEmpty;var supportsProto=Object.prototype.__proto__===null;if(supportsProto||typeof document=="undefined"){createEmpty=function(){return{__proto__:null}}}else{createEmpty=function(){var iframe=document.createElement("iframe");var parent=document.body||document.documentElement;iframe.style.display="none";parent.appendChild(iframe);iframe.src="javascript:";var empty=iframe.contentWindow.Object.prototype;parent.removeChild(iframe);iframe=null;delete empty.constructor;delete empty.hasOwnProperty;delete empty.propertyIsEnumerable;delete empty.isPrototypeOf;delete empty.toLocaleString;delete empty.toString;delete empty.valueOf;empty.__proto__=null;function Empty(){}Empty.prototype=empty;createEmpty=function(){return new Empty};return new Empty}}Object.create=function create(prototype,properties){var object;function Type(){}if(prototype===null){object=createEmpty()}else{if(typeof prototype!=="object"&&typeof prototype!=="function"){throw new TypeError("Object prototype may only be an Object or null")}Type.prototype=prototype;object=new Type;object.__proto__=prototype}if(properties!==void 0){Object.defineProperties(object,properties)}return object}}function doesDefinePropertyWork(object){try{Object.defineProperty(object,"sentinel",{});return"sentinel"in object}catch(exception){}}if(Object.defineProperty){var definePropertyWorksOnObject=doesDefinePropertyWork({});var definePropertyWorksOnDom=typeof document=="undefined"||doesDefinePropertyWork(document.createElement("div"));if(!definePropertyWorksOnObject||!definePropertyWorksOnDom){var definePropertyFallback=Object.defineProperty,definePropertiesFallback=Object.defineProperties}}if(!Object.defineProperty||definePropertyFallback){var ERR_NON_OBJECT_DESCRIPTOR="Property description must be an object: ";var ERR_NON_OBJECT_TARGET="Object.defineProperty called on non-object: ";var ERR_ACCESSORS_NOT_SUPPORTED="getters & setters can not be defined "+"on this javascript engine";Object.defineProperty=function defineProperty(object,property,descriptor){if(typeof object!="object"&&typeof object!="function"||object===null){throw new TypeError(ERR_NON_OBJECT_TARGET+object)}if(typeof descriptor!="object"&&typeof descriptor!="function"||descriptor===null){throw new TypeError(ERR_NON_OBJECT_DESCRIPTOR+descriptor)}if(definePropertyFallback){try{return definePropertyFallback.call(Object,object,property,descriptor)}catch(exception){}}if(owns(descriptor,"value")){if(supportsAccessors&&(lookupGetter(object,property)||lookupSetter(object,property))){var prototype=object.__proto__;object.__proto__=prototypeOfObject;delete object[property];object[property]=descriptor.value;object.__proto__=prototype}else{object[property]=descriptor.value}}else{if(!supportsAccessors){throw new TypeError(ERR_ACCESSORS_NOT_SUPPORTED)}if(owns(descriptor,"get")){defineGetter(object,property,descriptor.get)}if(owns(descriptor,"set")){defineSetter(object,property,descriptor.set)}}return object}}if(!Object.defineProperties||definePropertiesFallback){Object.defineProperties=function defineProperties(object,properties){if(definePropertiesFallback){try{return definePropertiesFallback.call(Object,object,properties)}catch(exception){}}for(var property in properties){if(owns(properties,property)&&property!="__proto__"){Object.defineProperty(object,property,properties[property])}}return object}}if(!Object.seal){Object.seal=function seal(object){return object}}if(!Object.freeze){Object.freeze=function freeze(object){return object}}try{Object.freeze(function(){})}catch(exception){Object.freeze=function freeze(freezeObject){return function freeze(object){if(typeof object=="function"){return object}else{return freezeObject(object)}}}(Object.freeze)}if(!Object.preventExtensions){Object.preventExtensions=function preventExtensions(object){return object}}if(!Object.isSealed){Object.isSealed=function isSealed(object){return false}}if(!Object.isFrozen){Object.isFrozen=function isFrozen(object){return false}}if(!Object.isExtensible){Object.isExtensible=function isExtensible(object){if(Object(object)!==object){throw new TypeError}var name="";while(owns(object,name)){name+="?"}object[name]=true;var returnValue=owns(object,name);delete object[name];return returnValue}}});
2 -//# sourceMappingURL=es5-sham.map
\ No newline at end of file
docs/js/es5-shim.min.js deleted
-2
@@ -1,2 +0,0 @@
1 -(function(definition){if(typeof define=="function"){define(definition)}else if(typeof YUI=="function"){YUI.add("es5",definition)}else{definition()}})(function(){if(parseInt("08")!==8){parseInt=function(origParseInt){var hexRegex=/^0[xX]/;return function parseIntES5(str,radix){str=String(str).trim();if(!+radix){radix=hexRegex.test(str)?16:10}return origParseInt(str,radix)}}(parseInt)}function Empty(){}if(!Function.prototype.bind){Function.prototype.bind=function bind(that){var target=this;if(typeof target!="function"){throw new TypeError("Function.prototype.bind called on incompatible "+target)}var args=_Array_slice_.call(arguments,1);var binder=function(){if(this instanceof bound){var result=target.apply(this,args.concat(_Array_slice_.call(arguments)));if(Object(result)===result){return result}return this}else{return target.apply(that,args.concat(_Array_slice_.call(arguments)))}};var boundLength=Math.max(0,target.length-args.length);var boundArgs=[];for(var i=0;i<boundLength;i++){boundArgs.push("$"+i)}var bound=Function("binder","return function("+boundArgs.join(",")+"){return binder.apply(this,arguments)}")(binder);if(target.prototype){Empty.prototype=target.prototype;bound.prototype=new Empty;Empty.prototype=null}return bound}}var call=Function.prototype.call;var prototypeOfArray=Array.prototype;var prototypeOfObject=Object.prototype;var _Array_slice_=prototypeOfArray.slice;var _toString=call.bind(prototypeOfObject.toString);var owns=call.bind(prototypeOfObject.hasOwnProperty);var defineGetter;var defineSetter;var lookupGetter;var lookupSetter;var supportsAccessors;if(supportsAccessors=owns(prototypeOfObject,"__defineGetter__")){defineGetter=call.bind(prototypeOfObject.__defineGetter__);defineSetter=call.bind(prototypeOfObject.__defineSetter__);lookupGetter=call.bind(prototypeOfObject.__lookupGetter__);lookupSetter=call.bind(prototypeOfObject.__lookupSetter__)}if([1,2].splice(0).length!=2){var array_splice=Array.prototype.splice;var array_push=Array.prototype.push;var array_unshift=Array.prototype.unshift;if(function(){function makeArray(l){var a=[];while(l--){a.unshift(l)}return a}var array=[],lengthBefore;array.splice.bind(array,0,0).apply(null,makeArray(20));array.splice.bind(array,0,0).apply(null,makeArray(26));lengthBefore=array.length;array.splice(5,0,"XXX");if(lengthBefore+1==array.length){return true}}()){Array.prototype.splice=function(start,deleteCount){if(!arguments.length){return[]}else{return array_splice.apply(this,[start===void 0?0:start,deleteCount===void 0?this.length-start:deleteCount].concat(_Array_slice_.call(arguments,2)))}}}else{Array.prototype.splice=function(start,deleteCount){var result,args=_Array_slice_.call(arguments,2),addElementsCount=args.length;if(!arguments.length){return[]}if(start===void 0){start=0}if(deleteCount===void 0){deleteCount=this.length-start}if(addElementsCount>0){if(deleteCount<=0){if(start==this.length){array_push.apply(this,args);return[]}if(start==0){array_unshift.apply(this,args);return[]}}result=_Array_slice_.call(this,start,start+deleteCount);args.push.apply(args,_Array_slice_.call(this,start+deleteCount,this.length));args.unshift.apply(args,_Array_slice_.call(this,0,start));args.unshift(0,this.length);array_splice.apply(this,args);return result}return array_splice.call(this,start,deleteCount)}}}if([].unshift(0)!=1){var array_unshift=Array.prototype.unshift;Array.prototype.unshift=function(){array_unshift.apply(this,arguments);return this.length}}if(!Array.isArray){Array.isArray=function isArray(obj){return _toString(obj)=="[object Array]"}}var boxedString=Object("a"),splitString=boxedString[0]!="a"||!(0 in boxedString);var boxedForEach=true;if(Array.prototype.forEach){Array.prototype.forEach.call("foo",function(item,i,obj){if(typeof obj!=="object")boxedForEach=false})}if(!Array.prototype.forEach||!boxedForEach){Array.prototype.forEach=function forEach(fun){var object=toObject(this),self=splitString&&_toString(this)=="[object String]"?this.split(""):object,thisp=arguments[1],i=-1,length=self.length>>>0;if(_toString(fun)!="[object Function]"){throw new TypeError}while(++i<length){if(i in self){fun.call(thisp,self[i],i,object)}}}}if(!Array.prototype.map){Array.prototype.map=function map(fun){var object=toObject(this),self=splitString&&_toString(this)=="[object String]"?this.split(""):object,length=self.length>>>0,result=Array(length),thisp=arguments[1];if(_toString(fun)!="[object Function]"){throw new TypeError(fun+" is not a function")}for(var i=0;i<length;i++){if(i in self)result[i]=fun.call(thisp,self[i],i,object)}return result}}if(!Array.prototype.filter){Array.prototype.filter=function filter(fun){var object=toObject(this),self=splitString&&_toString(this)=="[object String]"?this.split(""):object,length=self.length>>>0,result=[],value,thisp=arguments[1];if(_toString(fun)!="[object Function]"){throw new TypeError(fun+" is not a function")}for(var i=0;i<length;i++){if(i in self){value=self[i];if(fun.call(thisp,value,i,object)){result.push(value)}}}return result}}if(!Array.prototype.every){Array.prototype.every=function every(fun){var object=toObject(this),self=splitString&&_toString(this)=="[object String]"?this.split(""):object,length=self.length>>>0,thisp=arguments[1];if(_toString(fun)!="[object Function]"){throw new TypeError(fun+" is not a function")}for(var i=0;i<length;i++){if(i in self&&!fun.call(thisp,self[i],i,object)){return false}}return true}}if(!Array.prototype.some){Array.prototype.some=function some(fun){var object=toObject(this),self=splitString&&_toString(this)=="[object String]"?this.split(""):object,length=self.length>>>0,thisp=arguments[1];if(_toString(fun)!="[object Function]"){throw new TypeError(fun+" is not a function")}for(var i=0;i<length;i++){if(i in self&&fun.call(thisp,self[i],i,object)){return true}}return false}}if(!Array.prototype.reduce){Array.prototype.reduce=function reduce(fun){var object=toObject(this),self=splitString&&_toString(this)=="[object String]"?this.split(""):object,length=self.length>>>0;if(_toString(fun)!="[object Function]"){throw new TypeError(fun+" is not a function")}if(!length&&arguments.length==1){throw new TypeError("reduce of empty array with no initial value")}var i=0;var result;if(arguments.length>=2){result=arguments[1]}else{do{if(i in self){result=self[i++];break}if(++i>=length){throw new TypeError("reduce of empty array with no initial value")}}while(true)}for(;i<length;i++){if(i in self){result=fun.call(void 0,result,self[i],i,object)}}return result}}if(!Array.prototype.reduceRight){Array.prototype.reduceRight=function reduceRight(fun){var object=toObject(this),self=splitString&&_toString(this)=="[object String]"?this.split(""):object,length=self.length>>>0;if(_toString(fun)!="[object Function]"){throw new TypeError(fun+" is not a function")}if(!length&&arguments.length==1){throw new TypeError("reduceRight of empty array with no initial value")}var result,i=length-1;if(arguments.length>=2){result=arguments[1]}else{do{if(i in self){result=self[i--];break}if(--i<0){throw new TypeError("reduceRight of empty array with no initial value")}}while(true)}if(i<0){return result}do{if(i in this){result=fun.call(void 0,result,self[i],i,object)}}while(i--);return result}}if(!Array.prototype.indexOf||[0,1].indexOf(1,2)!=-1){Array.prototype.indexOf=function indexOf(sought){var self=splitString&&_toString(this)=="[object String]"?this.split(""):toObject(this),length=self.length>>>0;if(!length){return-1}var i=0;if(arguments.length>1){i=toInteger(arguments[1])}i=i>=0?i:Math.max(0,length+i);for(;i<length;i++){if(i in self&&self[i]===sought){return i}}return-1}}if(!Array.prototype.lastIndexOf||[0,1].lastIndexOf(0,-3)!=-1){Array.prototype.lastIndexOf=function lastIndexOf(sought){var self=splitString&&_toString(this)=="[object String]"?this.split(""):toObject(this),length=self.length>>>0;if(!length){return-1}var i=length-1;if(arguments.length>1){i=Math.min(i,toInteger(arguments[1]))}i=i>=0?i:length-Math.abs(i);for(;i>=0;i--){if(i in self&&sought===self[i]){return i}}return-1}}if(!Object.keys){var hasDontEnumBug=true,dontEnums=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],dontEnumsLength=dontEnums.length;for(var key in{toString:null}){hasDontEnumBug=false}Object.keys=function keys(object){if(typeof object!="object"&&typeof object!="function"||object===null){throw new TypeError("Object.keys called on a non-object")}var keys=[];for(var name in object){if(owns(object,name)){keys.push(name)}}if(hasDontEnumBug){for(var i=0,ii=dontEnumsLength;i<ii;i++){var dontEnum=dontEnums[i];if(owns(object,dontEnum)){keys.push(dontEnum)}}}return keys}}var negativeDate=-621987552e5,negativeYearString="-000001";if(!Date.prototype.toISOString||new Date(negativeDate).toISOString().indexOf(negativeYearString)===-1){Date.prototype.toISOString=function toISOString(){var result,length,value,year,month;if(!isFinite(this)){throw new RangeError("Date.prototype.toISOString called on non-finite value.")}year=this.getUTCFullYear();month=this.getUTCMonth();year+=Math.floor(month/12);month=(month%12+12)%12;result=[month+1,this.getUTCDate(),this.getUTCHours(),this.getUTCMinutes(),this.getUTCSeconds()];year=(year<0?"-":year>9999?"+":"")+("00000"+Math.abs(year)).slice(0<=year&&year<=9999?-4:-6);length=result.length;while(length--){value=result[length];if(value<10){result[length]="0"+value}}return year+"-"+result.slice(0,2).join("-")+"T"+result.slice(2).join(":")+"."+("000"+this.getUTCMilliseconds()).slice(-3)+"Z"}}var dateToJSONIsSupported=false;try{dateToJSONIsSupported=Date.prototype.toJSON&&new Date(NaN).toJSON()===null&&new Date(negativeDate).toJSON().indexOf(negativeYearString)!==-1&&Date.prototype.toJSON.call({toISOString:function(){return true}})}catch(e){}if(!dateToJSONIsSupported){Date.prototype.toJSON=function toJSON(key){var o=Object(this),tv=toPrimitive(o),toISO;if(typeof tv==="number"&&!isFinite(tv)){return null}toISO=o.toISOString;if(typeof toISO!="function"){throw new TypeError("toISOString property is not callable")}return toISO.call(o)}}if(!Date.parse||"Date.parse is buggy"){Date=function(NativeDate){function Date(Y,M,D,h,m,s,ms){var length=arguments.length;if(this instanceof NativeDate){var date=length==1&&String(Y)===Y?new NativeDate(Date.parse(Y)):length>=7?new NativeDate(Y,M,D,h,m,s,ms):length>=6?new NativeDate(Y,M,D,h,m,s):length>=5?new NativeDate(Y,M,D,h,m):length>=4?new NativeDate(Y,M,D,h):length>=3?new NativeDate(Y,M,D):length>=2?new NativeDate(Y,M):length>=1?new NativeDate(Y):new NativeDate;date.constructor=Date;return date}return NativeDate.apply(this,arguments)}var isoDateExpression=new RegExp("^"+"(\\d{4}|[+-]\\d{6})"+"(?:-(\\d{2})"+"(?:-(\\d{2})"+"(?:"+"T(\\d{2})"+":(\\d{2})"+"(?:"+":(\\d{2})"+"(?:(\\.\\d{1,}))?"+")?"+"("+"Z|"+"(?:"+"([-+])"+"(\\d{2})"+":(\\d{2})"+")"+")?)?)?)?"+"$");var months=[0,31,59,90,120,151,181,212,243,273,304,334,365];function dayFromMonth(year,month){var t=month>1?1:0;return months[month]+Math.floor((year-1969+t)/4)-Math.floor((year-1901+t)/100)+Math.floor((year-1601+t)/400)+365*(year-1970)}function toUTC(t){return Number(new NativeDate(1970,0,1,0,0,0,t))}for(var key in NativeDate){Date[key]=NativeDate[key]}Date.now=NativeDate.now;Date.UTC=NativeDate.UTC;Date.prototype=NativeDate.prototype;Date.prototype.constructor=Date;Date.parse=function parse(string){var match=isoDateExpression.exec(string);if(match){var year=Number(match[1]),month=Number(match[2]||1)-1,day=Number(match[3]||1)-1,hour=Number(match[4]||0),minute=Number(match[5]||0),second=Number(match[6]||0),millisecond=Math.floor(Number(match[7]||0)*1e3),isLocalTime=Boolean(match[4]&&!match[8]),signOffset=match[9]==="-"?1:-1,hourOffset=Number(match[10]||0),minuteOffset=Number(match[11]||0),result;if(hour<(minute>0||second>0||millisecond>0?24:25)&&minute<60&&second<60&&millisecond<1e3&&month>-1&&month<12&&hourOffset<24&&minuteOffset<60&&day>-1&&day<dayFromMonth(year,month+1)-dayFromMonth(year,month)){result=((dayFromMonth(year,month)+day)*24+hour+hourOffset*signOffset)*60;result=((result+minute+minuteOffset*signOffset)*60+second)*1e3+millisecond;if(isLocalTime){result=toUTC(result)}if(-864e13<=result&&result<=864e13){return result}}return NaN}return NativeDate.parse.apply(this,arguments)};return Date}(Date)}if(!Date.now){Date.now=function now(){return(new Date).getTime()}}if(!Number.prototype.toFixed||8e-5.toFixed(3)!=="0.000"||.9.toFixed(0)==="0"||1.255.toFixed(2)!=="1.25"||0xde0b6b3a7640080.toFixed(0)!=="1000000000000000128"){(function(){var base,size,data,i;base=1e7;size=6;data=[0,0,0,0,0,0];function multiply(n,c){var i=-1;while(++i<size){c+=n*data[i];data[i]=c%base;c=Math.floor(c/base)}}function divide(n){var i=size,c=0;while(--i>=0){c+=data[i];data[i]=Math.floor(c/n);c=c%n*base}}function toString(){var i=size;var s="";while(--i>=0){if(s!==""||i===0||data[i]!==0){var t=String(data[i]);if(s===""){s=t}else{s+="0000000".slice(0,7-t.length)+t}}}return s}function pow(x,n,acc){return n===0?acc:n%2===1?pow(x,n-1,acc*x):pow(x*x,n/2,acc)}function log(x){var n=0;while(x>=4096){n+=12;x/=4096}while(x>=2){n+=1;x/=2}return n}Number.prototype.toFixed=function(fractionDigits){var f,x,s,m,e,z,j,k;f=Number(fractionDigits);f=f!==f?0:Math.floor(f);if(f<0||f>20){throw new RangeError("Number.toFixed called with invalid number of decimals")}x=Number(this);if(x!==x){return"NaN"}if(x<=-1e21||x>=1e21){return String(x)}s="";if(x<0){s="-";x=-x}m="0";if(x>1e-21){e=log(x*pow(2,69,1))-69;z=e<0?x*pow(2,-e,1):x/pow(2,e,1);z*=4503599627370496;e=52-e;if(e>0){multiply(0,z);j=f;while(j>=7){multiply(1e7,0);j-=7}multiply(pow(10,j,1),0);j=e-1;while(j>=23){divide(1<<23);j-=23}divide(1<<j);multiply(1,1);divide(2);m=toString()}else{multiply(0,z);multiply(1<<-e,0);m=toString()+"0.00000000000000000000".slice(2,2+f)}}if(f>0){k=m.length;if(k<=f){m=s+"0.0000000000000000000".slice(0,f-k+2)+m}else{m=s+m.slice(0,k-f)+"."+m.slice(k-f)}}else{m=s+m}return m}})()}var string_split=String.prototype.split;if("ab".split(/(?:ab)*/).length!==2||".".split(/(.?)(.?)/).length!==4||"tesst".split(/(s)*/)[1]==="t"||"".split(/.?/).length||".".split(/()()/).length>1){(function(){var compliantExecNpcg=/()??/.exec("")[1]===void 0;String.prototype.split=function(separator,limit){var string=this;if(separator===void 0&&limit===0)return[];if(Object.prototype.toString.call(separator)!=="[object RegExp]"){return string_split.apply(this,arguments)}var output=[],flags=(separator.ignoreCase?"i":"")+(separator.multiline?"m":"")+(separator.extended?"x":"")+(separator.sticky?"y":""),lastLastIndex=0,separator=new RegExp(separator.source,flags+"g"),separator2,match,lastIndex,lastLength;string+="";if(!compliantExecNpcg){separator2=new RegExp("^"+separator.source+"$(?!\\s)",flags)}limit=limit===void 0?-1>>>0:limit>>>0;while(match=separator.exec(string)){lastIndex=match.index+match[0].length;if(lastIndex>lastLastIndex){output.push(string.slice(lastLastIndex,match.index));if(!compliantExecNpcg&&match.length>1){match[0].replace(separator2,function(){for(var i=1;i<arguments.length-2;i++){if(arguments[i]===void 0){match[i]=void 0}}})}if(match.length>1&&match.index<string.length){Array.prototype.push.apply(output,match.slice(1))}lastLength=match[0].length;lastLastIndex=lastIndex;if(output.length>=limit){break}}if(separator.lastIndex===match.index){separator.lastIndex++}}if(lastLastIndex===string.length){if(lastLength||!separator.test("")){output.push("")}}else{output.push(string.slice(lastLastIndex))}return output.length>limit?output.slice(0,limit):output}})()}else if("0".split(void 0,0).length){String.prototype.split=function(separator,limit){if(separator===void 0&&limit===0)return[];return string_split.apply(this,arguments)}}if("".substr&&"0b".substr(-1)!=="b"){var string_substr=String.prototype.substr;String.prototype.substr=function(start,length){return string_substr.call(this,start<0?(start=this.length+start)<0?0:start:start,length)}}var ws=" \n \f\r \xa0\u1680\u180e\u2000\u2001\u2002\u2003"+"\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\u2028"+"\u2029\ufeff";if(!String.prototype.trim||ws.trim()){ws="["+ws+"]";var trimBeginRegexp=new RegExp("^"+ws+ws+"*"),trimEndRegexp=new RegExp(ws+ws+"*$");String.prototype.trim=function trim(){if(this===void 0||this===null){throw new TypeError("can't convert "+this+" to object")}return String(this).replace(trimBeginRegexp,"").replace(trimEndRegexp,"")}}function toInteger(n){n=+n;if(n!==n){n=0}else if(n!==0&&n!==1/0&&n!==-(1/0)){n=(n>0||-1)*Math.floor(Math.abs(n))}return n}function isPrimitive(input){var type=typeof input;return input===null||type==="undefined"||type==="boolean"||type==="number"||type==="string"}function toPrimitive(input){var val,valueOf,toString;if(isPrimitive(input)){return input}valueOf=input.valueOf;if(typeof valueOf==="function"){val=valueOf.call(input);if(isPrimitive(val)){return val}}toString=input.toString;if(typeof toString==="function"){val=toString.call(input);if(isPrimitive(val)){return val}}throw new TypeError}var toObject=function(o){if(o==null){throw new TypeError("can't convert "+o+" to object")}return Object(o)}});
2 -//# sourceMappingURL=es5-shim.map
\ No newline at end of file
docs/js/html5shiv.min.js deleted
-8
@@ -1,8 +0,0 @@
1 -/*
2 - HTML5 Shiv v3.6.2 | @afarkas @jdalton @jon_neal @rem | MIT/GPL2 Licensed
3 -*/
4 -(function(l,f){function m(){var a=e.elements;return"string"==typeof a?a.split(" "):a}function i(a){var b=n[a[o]];b||(b={},h++,a[o]=h,n[h]=b);return b}function p(a,b,c){b||(b=f);if(g)return b.createElement(a);c||(c=i(b));b=c.cache[a]?c.cache[a].cloneNode():r.test(a)?(c.cache[a]=c.createElem(a)).cloneNode():c.createElem(a);return b.canHaveChildren&&!s.test(a)?c.frag.appendChild(b):b}function t(a,b){if(!b.cache)b.cache={},b.createElem=a.createElement,b.createFrag=a.createDocumentFragment,b.frag=b.createFrag();
5 -a.createElement=function(c){return!e.shivMethods?b.createElem(c):p(c,a,b)};a.createDocumentFragment=Function("h,f","return function(){var n=f.cloneNode(),c=n.createElement;h.shivMethods&&("+m().join().replace(/\w+/g,function(a){b.createElem(a);b.frag.createElement(a);return'c("'+a+'")'})+");return n}")(e,b.frag)}function q(a){a||(a=f);var b=i(a);if(e.shivCSS&&!j&&!b.hasCSS){var c,d=a;c=d.createElement("p");d=d.getElementsByTagName("head")[0]||d.documentElement;c.innerHTML="x<style>article,aside,figcaption,figure,footer,header,hgroup,main,nav,section{display:block}mark{background:#FF0;color:#000}</style>";
6 -c=d.insertBefore(c.lastChild,d.firstChild);b.hasCSS=!!c}g||t(a,b);return a}var k=l.html5||{},s=/^<|^(?:button|map|select|textarea|object|iframe|option|optgroup)$/i,r=/^(?:a|b|code|div|fieldset|h1|h2|h3|h4|h5|h6|i|label|li|ol|p|q|span|strong|style|table|tbody|td|th|tr|ul)$/i,j,o="_html5shiv",h=0,n={},g;(function(){try{var a=f.createElement("a");a.innerHTML="<xyz></xyz>";j="hidden"in a;var b;if(!(b=1==a.childNodes.length)){f.createElement("a");var c=f.createDocumentFragment();b="undefined"==typeof c.cloneNode||
7 -"undefined"==typeof c.createDocumentFragment||"undefined"==typeof c.createElement}g=b}catch(d){g=j=!0}})();var e={elements:k.elements||"abbr article aside audio bdi canvas data datalist details figcaption figure footer header hgroup main mark meter nav output progress section summary time video",version:"3.6.2",shivCSS:!1!==k.shivCSS,supportsUnknownElements:g,shivMethods:!1!==k.shivMethods,type:"default",shivDocument:q,createElement:p,createDocumentFragment:function(a,b){a||(a=f);if(g)return a.createDocumentFragment();
8 -for(var b=b||i(a),c=b.frag.cloneNode(),d=0,e=m(),h=e.length;d<h;d++)c.createElement(e[d]);return c}};l.html5=e;q(f)})(this,document);
docs/js/javascript.js deleted
-746
@@ -1,746 +0,0 @@
1 -// CodeMirror, copyright (c) by Marijn Haverbeke and others
2 -// Distributed under an MIT license: http://codemirror.net/LICENSE
3 -
4 -(function(mod) {
5 - if (typeof exports == "object" && typeof module == "object") // CommonJS
6 - mod(require("../../lib/codemirror"));
7 - else if (typeof define == "function" && define.amd) // AMD
8 - define(["../../lib/codemirror"], mod);
9 - else // Plain browser env
10 - mod(CodeMirror);
11 -})(function(CodeMirror) {
12 -"use strict";
13 -
14 -function expressionAllowed(stream, state, backUp) {
15 - return /^(?:operator|sof|keyword c|case|new|[\[{}\(,;:]|=>)$/.test(state.lastType) ||
16 - (state.lastType == "quasi" && /\{\s*$/.test(stream.string.slice(0, stream.pos - (backUp || 0))))
17 -}
18 -
19 -CodeMirror.defineMode("javascript", function(config, parserConfig) {
20 - var indentUnit = config.indentUnit;
21 - var statementIndent = parserConfig.statementIndent;
22 - var jsonldMode = parserConfig.jsonld;
23 - var jsonMode = parserConfig.json || jsonldMode;
24 - var isTS = parserConfig.typescript;
25 - var wordRE = parserConfig.wordCharacters || /[\w$\xa1-\uffff]/;
26 -
27 - // Tokenizer
28 -
29 - var keywords = function(){
30 - function kw(type) {return {type: type, style: "keyword"};}
31 - var A = kw("keyword a"), B = kw("keyword b"), C = kw("keyword c");
32 - var operator = kw("operator"), atom = {type: "atom", style: "atom"};
33 -
34 - var jsKeywords = {
35 - "if": kw("if"), "while": A, "with": A, "else": B, "do": B, "try": B, "finally": B,
36 - "return": C, "break": C, "continue": C, "new": kw("new"), "delete": C, "throw": C, "debugger": C,
37 - "var": kw("var"), "const": kw("var"), "let": kw("var"),
38 - "function": kw("function"), "catch": kw("catch"),
39 - "for": kw("for"), "switch": kw("switch"), "case": kw("case"), "default": kw("default"),
40 - "in": operator, "typeof": operator, "instanceof": operator,
41 - "true": atom, "false": atom, "null": atom, "undefined": atom, "NaN": atom, "Infinity": atom,
42 - "this": kw("this"), "class": kw("class"), "super": kw("atom"),
43 - "yield": C, "export": kw("export"), "import": kw("import"), "extends": C,
44 - "await": C, "async": kw("async")
45 - };
46 -
47 - // Extend the 'normal' keywords with the TypeScript language extensions
48 - if (isTS) {
49 - var type = {type: "variable", style: "variable-3"};
50 - var tsKeywords = {
51 - // object-like things
52 - "interface": kw("class"),
53 - "implements": C,
54 - "namespace": C,
55 - "module": kw("module"),
56 - "enum": kw("module"),
57 -
58 - // scope modifiers
59 - "public": kw("modifier"),
60 - "private": kw("modifier"),
61 - "protected": kw("modifier"),
62 - "abstract": kw("modifier"),
63 -
64 - // operators
65 - "as": operator,
66 -
67 - // types
68 - "string": type, "number": type, "boolean": type, "any": type
69 - };
70 -
71 - for (var attr in tsKeywords) {
72 - jsKeywords[attr] = tsKeywords[attr];
73 - }
74 - }
75 -
76 - return jsKeywords;
77 - }();
78 -
79 - var isOperatorChar = /[+\-*&%=<>!?|~^]/;
80 - var isJsonldKeyword = /^@(context|id|value|language|type|container|list|set|reverse|index|base|vocab|graph)"/;
81 -
82 - function readRegexp(stream) {
83 - var escaped = false, next, inSet = false;
84 - while ((next = stream.next()) != null) {
85 - if (!escaped) {
86 - if (next == "/" && !inSet) return;
87 - if (next == "[") inSet = true;
88 - else if (inSet && next == "]") inSet = false;
89 - }
90 - escaped = !escaped && next == "\\";
91 - }
92 - }
93 -
94 - // Used as scratch variables to communicate multiple values without
95 - // consing up tons of objects.
96 - var type, content;
97 - function ret(tp, style, cont) {
98 - type = tp; content = cont;
99 - return style;
100 - }
101 - function tokenBase(stream, state) {
102 - var ch = stream.next();
103 - if (ch == '"' || ch == "'") {
104 - state.tokenize = tokenString(ch);
105 - return state.tokenize(stream, state);
106 - } else if (ch == "." && stream.match(/^\d+(?:[eE][+\-]?\d+)?/)) {
107 - return ret("number", "number");
108 - } else if (ch == "." && stream.match("..")) {
109 - return ret("spread", "meta");
110 - } else if (/[\[\]{}\(\),;\:\.]/.test(ch)) {
111 - return ret(ch);
112 - } else if (ch == "=" && stream.eat(">")) {
113 - return ret("=>", "operator");
114 - } else if (ch == "0" && stream.eat(/x/i)) {
115 - stream.eatWhile(/[\da-f]/i);
116 - return ret("number", "number");
117 - } else if (ch == "0" && stream.eat(/o/i)) {
118 - stream.eatWhile(/[0-7]/i);
119 - return ret("number", "number");
120 - } else if (ch == "0" && stream.eat(/b/i)) {
121 - stream.eatWhile(/[01]/i);
122 - return ret("number", "number");
123 - } else if (/\d/.test(ch)) {
124 - stream.match(/^\d*(?:\.\d*)?(?:[eE][+\-]?\d+)?/);
125 - return ret("number", "number");
126 - } else if (ch == "/") {
127 - if (stream.eat("*")) {
128 - state.tokenize = tokenComment;
129 - return tokenComment(stream, state);
130 - } else if (stream.eat("/")) {
131 - stream.skipToEnd();
132 - return ret("comment", "comment");
133 - } else if (expressionAllowed(stream, state, 1)) {
134 - readRegexp(stream);
135 - stream.match(/^\b(([gimyu])(?![gimyu]*\2))+\b/);
136 - return ret("regexp", "string-2");
137 - } else {
138 - stream.eatWhile(isOperatorChar);
139 - return ret("operator", "operator", stream.current());
140 - }
141 - } else if (ch == "`") {
142 - state.tokenize = tokenQuasi;
143 - return tokenQuasi(stream, state);
144 - } else if (ch == "#") {
145 - stream.skipToEnd();
146 - return ret("error", "error");
147 - } else if (isOperatorChar.test(ch)) {
148 - stream.eatWhile(isOperatorChar);
149 - return ret("operator", "operator", stream.current());
150 - } else if (wordRE.test(ch)) {
151 - stream.eatWhile(wordRE);
152 - var word = stream.current(), known = keywords.propertyIsEnumerable(word) && keywords[word];
153 - return (known && state.lastType != ".") ? ret(known.type, known.style, word) :
154 - ret("variable", "variable", word);
155 - }
156 - }
157 -
158 - function tokenString(quote) {
159 - return function(stream, state) {
160 - var escaped = false, next;
161 - if (jsonldMode && stream.peek() == "@" && stream.match(isJsonldKeyword)){
162 - state.tokenize = tokenBase;
163 - return ret("jsonld-keyword", "meta");
164 - }
165 - while ((next = stream.next()) != null) {
166 - if (next == quote && !escaped) break;
167 - escaped = !escaped && next == "\\";
168 - }
169 - if (!escaped) state.tokenize = tokenBase;
170 - return ret("string", "string");
171 - };
172 - }
173 -
174 - function tokenComment(stream, state) {
175 - var maybeEnd = false, ch;
176 - while (ch = stream.next()) {
177 - if (ch == "/" && maybeEnd) {
178 - state.tokenize = tokenBase;
179 - break;
180 - }
181 - maybeEnd = (ch == "*");
182 - }
183 - return ret("comment", "comment");
184 - }
185 -
186 - function tokenQuasi(stream, state) {
187 - var escaped = false, next;
188 - while ((next = stream.next()) != null) {
189 - if (!escaped && (next == "`" || next == "$" && stream.eat("{"))) {
190 - state.tokenize = tokenBase;
191 - break;
192 - }
193 - escaped = !escaped && next == "\\";
194 - }
195 - return ret("quasi", "string-2", stream.current());
196 - }
197 -
198 - var brackets = "([{}])";
199 - // This is a crude lookahead trick to try and notice that we're
200 - // parsing the argument patterns for a fat-arrow function before we
201 - // actually hit the arrow token. It only works if the arrow is on
202 - // the same line as the arguments and there's no strange noise
203 - // (comments) in between. Fallback is to only notice when we hit the
204 - // arrow, and not declare the arguments as locals for the arrow
205 - // body.
206 - function findFatArrow(stream, state) {
207 - if (state.fatArrowAt) state.fatArrowAt = null;
208 - var arrow = stream.string.indexOf("=>", stream.start);
209 - if (arrow < 0) return;
210 -
211 - var depth = 0, sawSomething = false;
212 - for (var pos = arrow - 1; pos >= 0; --pos) {
213 - var ch = stream.string.charAt(pos);
214 - var bracket = brackets.indexOf(ch);
215 - if (bracket >= 0 && bracket < 3) {
216 - if (!depth) { ++pos; break; }
217 - if (--depth == 0) break;
218 - } else if (bracket >= 3 && bracket < 6) {
219 - ++depth;
220 - } else if (wordRE.test(ch)) {
221 - sawSomething = true;
222 - } else if (/["'\/]/.test(ch)) {
223 - return;
224 - } else if (sawSomething && !depth) {
225 - ++pos;
226 - break;
227 - }
228 - }
229 - if (sawSomething && !depth) state.fatArrowAt = pos;
230 - }
231 -
232 - // Parser
233 -
234 - var atomicTypes = {"atom": true, "number": true, "variable": true, "string": true, "regexp": true, "this": true, "jsonld-keyword": true};
235 -
236 - function JSLexical(indented, column, type, align, prev, info) {
237 - this.indented = indented;
238 - this.column = column;
239 - this.type = type;
240 - this.prev = prev;
241 - this.info = info;
242 - if (align != null) this.align = align;
243 - }
244 -
245 - function inScope(state, varname) {
246 - for (var v = state.localVars; v; v = v.next)
247 - if (v.name == varname) return true;
248 - for (var cx = state.context; cx; cx = cx.prev) {
249 - for (var v = cx.vars; v; v = v.next)
250 - if (v.name == varname) return true;
251 - }
252 - }
253 -
254 - function parseJS(state, style, type, content, stream) {
255 - var cc = state.cc;
256 - // Communicate our context to the combinators.
257 - // (Less wasteful than consing up a hundred closures on every call.)
258 - cx.state = state; cx.stream = stream; cx.marked = null, cx.cc = cc; cx.style = style;
259 -
260 - if (!state.lexical.hasOwnProperty("align"))
261 - state.lexical.align = true;
262 -
263 - while(true) {
264 - var combinator = cc.length ? cc.pop() : jsonMode ? expression : statement;
265 - if (combinator(type, content)) {
266 - while(cc.length && cc[cc.length - 1].lex)
267 - cc.pop()();
268 - if (cx.marked) return cx.marked;
269 - if (type == "variable" && inScope(state, content)) return "variable-2";
270 - return style;
271 - }
272 - }
273 - }
274 -
275 - // Combinator utils
276 -
277 - var cx = {state: null, column: null, marked: null, cc: null};
278 - function pass() {
279 - for (var i = arguments.length - 1; i >= 0; i--) cx.cc.push(arguments[i]);
280 - }
281 - function cont() {
282 - pass.apply(null, arguments);
283 - return true;
284 - }
285 - function register(varname) {
286 - function inList(list) {
287 - for (var v = list; v; v = v.next)
288 - if (v.name == varname) return true;
289 - return false;
290 - }
291 - var state = cx.state;
292 - cx.marked = "def";
293 - if (state.context) {
294 - if (inList(state.localVars)) return;
295 - state.localVars = {name: varname, next: state.localVars};
296 - } else {
297 - if (inList(state.globalVars)) return;
298 - if (parserConfig.globalVars)
299 - state.globalVars = {name: varname, next: state.globalVars};
300 - }
301 - }
302 -
303 - // Combinators
304 -
305 - var defaultVars = {name: "this", next: {name: "arguments"}};
306 - function pushcontext() {
307 - cx.state.context = {prev: cx.state.context, vars: cx.state.localVars};
308 - cx.state.localVars = defaultVars;
309 - }
310 - function popcontext() {
311 - cx.state.localVars = cx.state.context.vars;
312 - cx.state.context = cx.state.context.prev;
313 - }
314 - function pushlex(type, info) {
315 - var result = function() {
316 - var state = cx.state, indent = state.indented;
317 - if (state.lexical.type == "stat") indent = state.lexical.indented;
318 - else for (var outer = state.lexical; outer && outer.type == ")" && outer.align; outer = outer.prev)
319 - indent = outer.indented;
320 - state.lexical = new JSLexical(indent, cx.stream.column(), type, null, state.lexical, info);
321 - };
322 - result.lex = true;
323 - return result;
324 - }
325 - function poplex() {
326 - var state = cx.state;
327 - if (state.lexical.prev) {
328 - if (state.lexical.type == ")")
329 - state.indented = state.lexical.indented;
330 - state.lexical = state.lexical.prev;
331 - }
332 - }
333 - poplex.lex = true;
334 -
335 - function expect(wanted) {
336 - function exp(type) {
337 - if (type == wanted) return cont();
338 - else if (wanted == ";") return pass();
339 - else return cont(exp);
340 - };
341 - return exp;
342 - }
343 -
344 - function statement(type, value) {
345 - if (type == "var") return cont(pushlex("vardef", value.length), vardef, expect(";"), poplex);
346 - if (type == "keyword a") return cont(pushlex("form"), expression, statement, poplex);
347 - if (type == "keyword b") return cont(pushlex("form"), statement, poplex);
348 - if (type == "{") return cont(pushlex("}"), block, poplex);
349 - if (type == ";") return cont();
350 - if (type == "if") {
351 - if (cx.state.lexical.info == "else" && cx.state.cc[cx.state.cc.length - 1] == poplex)
352 - cx.state.cc.pop()();
353 - return cont(pushlex("form"), expression, statement, poplex, maybeelse);
354 - }
355 - if (type == "function") return cont(functiondef);
356 - if (type == "for") return cont(pushlex("form"), forspec, statement, poplex);
357 - if (type == "variable") return cont(pushlex("stat"), maybelabel);
358 - if (type == "switch") return cont(pushlex("form"), expression, pushlex("}", "switch"), expect("{"),
359 - block, poplex, poplex);
360 - if (type == "case") return cont(expression, expect(":"));
361 - if (type == "default") return cont(expect(":"));
362 - if (type == "catch") return cont(pushlex("form"), pushcontext, expect("("), funarg, expect(")"),
363 - statement, poplex, popcontext);
364 - if (type == "class") return cont(pushlex("form"), className, poplex);
365 - if (type == "export") return cont(pushlex("stat"), afterExport, poplex);
366 - if (type == "import") return cont(pushlex("stat"), afterImport, poplex);
367 - if (type == "module") return cont(pushlex("form"), pattern, pushlex("}"), expect("{"), block, poplex, poplex)
368 - if (type == "async") return cont(statement)
369 - return pass(pushlex("stat"), expression, expect(";"), poplex);
370 - }
371 - function expression(type) {
372 - return expressionInner(type, false);
373 - }
374 - function expressionNoComma(type) {
375 - return expressionInner(type, true);
376 - }
377 - function expressionInner(type, noComma) {
378 - if (cx.state.fatArrowAt == cx.stream.start) {
379 - var body = noComma ? arrowBodyNoComma : arrowBody;
380 - if (type == "(") return cont(pushcontext, pushlex(")"), commasep(pattern, ")"), poplex, expect("=>"), body, popcontext);
381 - else if (type == "variable") return pass(pushcontext, pattern, expect("=>"), body, popcontext);
382 - }
383 -
384 - var maybeop = noComma ? maybeoperatorNoComma : maybeoperatorComma;
385 - if (atomicTypes.hasOwnProperty(type)) return cont(maybeop);
386 - if (type == "function") return cont(functiondef, maybeop);
387 - if (type == "keyword c") return cont(noComma ? maybeexpressionNoComma : maybeexpression);
388 - if (type == "(") return cont(pushlex(")"), maybeexpression, comprehension, expect(")"), poplex, maybeop);
389 - if (type == "operator" || type == "spread") return cont(noComma ? expressionNoComma : expression);
390 - if (type == "[") return cont(pushlex("]"), arrayLiteral, poplex, maybeop);
391 - if (type == "{") return contCommasep(objprop, "}", null, maybeop);
392 - if (type == "quasi") return pass(quasi, maybeop);
393 - if (type == "new") return cont(maybeTarget(noComma));
394 - return cont();
395 - }
396 - function maybeexpression(type) {
397 - if (type.match(/[;\}\)\],]/)) return pass();
398 - return pass(expression);
399 - }
400 - function maybeexpressionNoComma(type) {
401 - if (type.match(/[;\}\)\],]/)) return pass();
402 - return pass(expressionNoComma);
403 - }
404 -
405 - function maybeoperatorComma(type, value) {
406 - if (type == ",") return cont(expression);
407 - return maybeoperatorNoComma(type, value, false);
408 - }
409 - function maybeoperatorNoComma(type, value, noComma) {
410 - var me = noComma == false ? maybeoperatorComma : maybeoperatorNoComma;
411 - var expr = noComma == false ? expression : expressionNoComma;
412 - if (type == "=>") return cont(pushcontext, noComma ? arrowBodyNoComma : arrowBody, popcontext);
413 - if (type == "operator") {
414 - if (/\+\+|--/.test(value)) return cont(me);
415 - if (value == "?") return cont(expression, expect(":"), expr);
416 - return cont(expr);
417 - }
418 - if (type == "quasi") { return pass(quasi, me); }
419 - if (type == ";") return;
420 - if (type == "(") return contCommasep(expressionNoComma, ")", "call", me);
421 - if (type == ".") return cont(property, me);
422 - if (type == "[") return cont(pushlex("]"), maybeexpression, expect("]"), poplex, me);
423 - }
424 - function quasi(type, value) {
425 - if (type != "quasi") return pass();
426 - if (value.slice(value.length - 2) != "${") return cont(quasi);
427 - return cont(expression, continueQuasi);
428 - }
429 - function continueQuasi(type) {
430 - if (type == "}") {
431 - cx.marked = "string-2";
432 - cx.state.tokenize = tokenQuasi;
433 - return cont(quasi);
434 - }
435 - }
436 - function arrowBody(type) {
437 - findFatArrow(cx.stream, cx.state);
438 - return pass(type == "{" ? statement : expression);
439 - }
440 - function arrowBodyNoComma(type) {
441 - findFatArrow(cx.stream, cx.state);
442 - return pass(type == "{" ? statement : expressionNoComma);
443 - }
444 - function maybeTarget(noComma) {
445 - return function(type) {
446 - if (type == ".") return cont(noComma ? targetNoComma : target);
447 - else return pass(noComma ? expressionNoComma : expression);
448 - };
449 - }
450 - function target(_, value) {
451 - if (value == "target") { cx.marked = "keyword"; return cont(maybeoperatorComma); }
452 - }
453 - function targetNoComma(_, value) {
454 - if (value == "target") { cx.marked = "keyword"; return cont(maybeoperatorNoComma); }
455 - }
456 - function maybelabel(type) {
457 - if (type == ":") return cont(poplex, statement);
458 - return pass(maybeoperatorComma, expect(";"), poplex);
459 - }
460 - function property(type) {
461 - if (type == "variable") {cx.marked = "property"; return cont();}
462 - }
463 - function objprop(type, value) {
464 - if (type == "variable" || cx.style == "keyword") {
465 - cx.marked = "property";
466 - if (value == "get" || value == "set") return cont(getterSetter);
467 - return cont(afterprop);
468 - } else if (type == "number" || type == "string") {
469 - cx.marked = jsonldMode ? "property" : (cx.style + " property");
470 - return cont(afterprop);
471 - } else if (type == "jsonld-keyword") {
472 - return cont(afterprop);
473 - } else if (type == "modifier") {
474 - return cont(objprop)
475 - } else if (type == "[") {
476 - return cont(expression, expect("]"), afterprop);
477 - } else if (type == "spread") {
478 - return cont(expression);
479 - }
480 - }
481 - function getterSetter(type) {
482 - if (type != "variable") return pass(afterprop);
483 - cx.marked = "property";
484 - return cont(functiondef);
485 - }
486 - function afterprop(type) {
487 - if (type == ":") return cont(expressionNoComma);
488 - if (type == "(") return pass(functiondef);
489 - }
490 - function commasep(what, end) {
491 - function proceed(type, value) {
492 - if (type == ",") {
493 - var lex = cx.state.lexical;
494 - if (lex.info == "call") lex.pos = (lex.pos || 0) + 1;
495 - return cont(what, proceed);
496 - }
497 - if (type == end || value == end) return cont();
498 - return cont(expect(end));
499 - }
500 - return function(type, value) {
501 - if (type == end || value == end) return cont();
502 - return pass(what, proceed);
503 - };
504 - }
505 - function contCommasep(what, end, info) {
506 - for (var i = 3; i < arguments.length; i++)
507 - cx.cc.push(arguments[i]);
508 - return cont(pushlex(end, info), commasep(what, end), poplex);
509 - }
510 - function block(type) {
511 - if (type == "}") return cont();
512 - return pass(statement, block);
513 - }
514 - function maybetype(type) {
515 - if (isTS && type == ":") return cont(typeexpr);
516 - }
517 - function maybedefault(_, value) {
518 - if (value == "=") return cont(expressionNoComma);
519 - }
520 - function typeexpr(type) {
521 - if (type == "variable") {cx.marked = "variable-3"; return cont(afterType);}
522 - }
523 - function afterType(type, value) {
524 - if (value == "<") return cont(commasep(typeexpr, ">"), afterType)
525 - if (type == "[") return cont(expect("]"), afterType)
526 - }
527 - function vardef() {
528 - return pass(pattern, maybetype, maybeAssign, vardefCont);
529 - }
530 - function pattern(type, value) {
531 - if (type == "modifier") return cont(pattern)
532 - if (type == "variable") { register(value); return cont(); }
533 - if (type == "spread") return cont(pattern);
534 - if (type == "[") return contCommasep(pattern, "]");
535 - if (type == "{") return contCommasep(proppattern, "}");
536 - }
537 - function proppattern(type, value) {
538 - if (type == "variable" && !cx.stream.match(/^\s*:/, false)) {
539 - register(value);
540 - return cont(maybeAssign);
541 - }
542 - if (type == "variable") cx.marked = "property";
543 - if (type == "spread") return cont(pattern);
544 - if (type == "}") return pass();
545 - return cont(expect(":"), pattern, maybeAssign);
546 - }
547 - function maybeAssign(_type, value) {
548 - if (value == "=") return cont(expressionNoComma);
549 - }
550 - function vardefCont(type) {
551 - if (type == ",") return cont(vardef);
552 - }
553 - function maybeelse(type, value) {
554 - if (type == "keyword b" && value == "else") return cont(pushlex("form", "else"), statement, poplex);
555 - }
556 - function forspec(type) {
557 - if (type == "(") return cont(pushlex(")"), forspec1, expect(")"), poplex);
558 - }
559 - function forspec1(type) {
560 - if (type == "var") return cont(vardef, expect(";"), forspec2);
561 - if (type == ";") return cont(forspec2);
562 - if (type == "variable") return cont(formaybeinof);
563 - return pass(expression, expect(";"), forspec2);
564 - }
565 - function formaybeinof(_type, value) {
566 - if (value == "in" || value == "of") { cx.marked = "keyword"; return cont(expression); }
567 - return cont(maybeoperatorComma, forspec2);
568 - }
569 - function forspec2(type, value) {
570 - if (type == ";") return cont(forspec3);
571 - if (value == "in" || value == "of") { cx.marked = "keyword"; return cont(expression); }
572 - return pass(expression, expect(";"), forspec3);
573 - }
574 - function forspec3(type) {
575 - if (type != ")") cont(expression);
576 - }
577 - function functiondef(type, value) {
578 - if (value == "*") {cx.marked = "keyword"; return cont(functiondef);}
579 - if (type == "variable") {register(value); return cont(functiondef);}
580 - if (type == "(") return cont(pushcontext, pushlex(")"), commasep(funarg, ")"), poplex, maybetype, statement, popcontext);
581 - }
582 - function funarg(type) {
583 - if (type == "spread") return cont(funarg);
584 - return pass(pattern, maybetype, maybedefault);
585 - }
586 - function className(type, value) {
587 - if (type == "variable") {register(value); return cont(classNameAfter);}
588 - }
589 - function classNameAfter(type, value) {
590 - if (value == "extends") return cont(expression, classNameAfter);
591 - if (type == "{") return cont(pushlex("}"), classBody, poplex);
592 - }
593 - function classBody(type, value) {
594 - if (type == "variable" || cx.style == "keyword") {
595 - if (value == "static") {
596 - cx.marked = "keyword";
597 - return cont(classBody);
598 - }
599 - cx.marked = "property";
600 - if (value == "get" || value == "set") return cont(classGetterSetter, functiondef, classBody);
601 - return cont(functiondef, classBody);
602 - }
603 - if (value == "*") {
604 - cx.marked = "keyword";
605 - return cont(classBody);
606 - }
607 - if (type == ";") return cont(classBody);
608 - if (type == "}") return cont();
609 - }
610 - function classGetterSetter(type) {
611 - if (type != "variable") return pass();
612 - cx.marked = "property";
613 - return cont();
614 - }
615 - function afterExport(_type, value) {
616 - if (value == "*") { cx.marked = "keyword"; return cont(maybeFrom, expect(";")); }
617 - if (value == "default") { cx.marked = "keyword"; return cont(expression, expect(";")); }
618 - return pass(statement);
619 - }
620 - function afterImport(type) {
621 - if (type == "string") return cont();
622 - return pass(importSpec, maybeFrom);
623 - }
624 - function importSpec(type, value) {
625 - if (type == "{") return contCommasep(importSpec, "}");
626 - if (type == "variable") register(value);
627 - if (value == "*") cx.marked = "keyword";
628 - return cont(maybeAs);
629 - }
630 - function maybeAs(_type, value) {
631 - if (value == "as") { cx.marked = "keyword"; return cont(importSpec); }
632 - }
633 - function maybeFrom(_type, value) {
634 - if (value == "from") { cx.marked = "keyword"; return cont(expression); }
635 - }
636 - function arrayLiteral(type) {
637 - if (type == "]") return cont();
638 - return pass(expressionNoComma, maybeArrayComprehension);
639 - }
640 - function maybeArrayComprehension(type) {
641 - if (type == "for") return pass(comprehension, expect("]"));
642 - if (type == ",") return cont(commasep(maybeexpressionNoComma, "]"));
643 - return pass(commasep(expressionNoComma, "]"));
644 - }
645 - function comprehension(type) {
646 - if (type == "for") return cont(forspec, comprehension);
647 - if (type == "if") return cont(expression, comprehension);
648 - }
649 -
650 - function isContinuedStatement(state, textAfter) {
651 - return state.lastType == "operator" || state.lastType == "," ||
652 - isOperatorChar.test(textAfter.charAt(0)) ||
653 - /[,.]/.test(textAfter.charAt(0));
654 - }
655 -
656 - // Interface
657 -
658 - return {
659 - startState: function(basecolumn) {
660 - var state = {
661 - tokenize: tokenBase,
662 - lastType: "sof",
663 - cc: [],
664 - lexical: new JSLexical((basecolumn || 0) - indentUnit, 0, "block", false),
665 - localVars: parserConfig.localVars,
666 - context: parserConfig.localVars && {vars: parserConfig.localVars},
667 - indented: basecolumn || 0
668 - };
669 - if (parserConfig.globalVars && typeof parserConfig.globalVars == "object")
670 - state.globalVars = parserConfig.globalVars;
671 - return state;
672 - },
673 -
674 - token: function(stream, state) {
675 - if (stream.sol()) {
676 - if (!state.lexical.hasOwnProperty("align"))
677 - state.lexical.align = false;
678 - state.indented = stream.indentation();
679 - findFatArrow(stream, state);
680 - }
681 - if (state.tokenize != tokenComment && stream.eatSpace()) return null;
682 - var style = state.tokenize(stream, state);
683 - if (type == "comment") return style;
684 - state.lastType = type == "operator" && (content == "++" || content == "--") ? "incdec" : type;
685 - return parseJS(state, style, type, content, stream);
686 - },
687 -
688 - indent: function(state, textAfter) {
689 - if (state.tokenize == tokenComment) return CodeMirror.Pass;
690 - if (state.tokenize != tokenBase) return 0;
691 - var firstChar = textAfter && textAfter.charAt(0), lexical = state.lexical;
692 - // Kludge to prevent 'maybelse' from blocking lexical scope pops
693 - if (!/^\s*else\b/.test(textAfter)) for (var i = state.cc.length - 1; i >= 0; --i) {
694 - var c = state.cc[i];
695 - if (c == poplex) lexical = lexical.prev;
696 - else if (c != maybeelse) break;
697 - }
698 - if (lexical.type == "stat" && firstChar == "}") lexical = lexical.prev;
699 - if (statementIndent && lexical.type == ")" && lexical.prev.type == "stat")
700 - lexical = lexical.prev;
701 - var type = lexical.type, closing = firstChar == type;
702 -
703 - if (type == "vardef") return lexical.indented + (state.lastType == "operator" || state.lastType == "," ? lexical.info + 1 : 0);
704 - else if (type == "form" && firstChar == "{") return lexical.indented;
705 - else if (type == "form") return lexical.indented + indentUnit;
706 - else if (type == "stat")
707 - return lexical.indented + (isContinuedStatement(state, textAfter) ? statementIndent || indentUnit : 0);
708 - else if (lexical.info == "switch" && !closing && parserConfig.doubleIndentSwitch != false)
709 - return lexical.indented + (/^(?:case|default)\b/.test(textAfter) ? indentUnit : 2 * indentUnit);
710 - else if (lexical.align) return lexical.column + (closing ? 0 : 1);
711 - else return lexical.indented + (closing ? 0 : indentUnit);
712 - },
713 -
714 - electricInput: /^\s*(?:case .*?:|default:|\{|\})$/,
715 - blockCommentStart: jsonMode ? null : "/*",
716 - blockCommentEnd: jsonMode ? null : "*/",
717 - lineComment: jsonMode ? null : "//",
718 - fold: "brace",
719 - closeBrackets: "()[]{}''\"\"``",
720 -
721 - helperType: jsonMode ? "json" : "javascript",
722 - jsonldMode: jsonldMode,
723 - jsonMode: jsonMode,
724 -
725 - expressionAllowed: expressionAllowed,
726 - skipExpression: function(state) {
727 - var top = state.cc[state.cc.length - 1]
728 - if (top == expression || top == expressionNoComma) state.cc.pop()
729 - }
730 - };
731 -});
732 -
733 -CodeMirror.registerHelper("wordChars", "javascript", /[\w$]/);
734 -
735 -CodeMirror.defineMIME("text/javascript", "javascript");
736 -CodeMirror.defineMIME("text/ecmascript", "javascript");
737 -CodeMirror.defineMIME("application/javascript", "javascript");
738 -CodeMirror.defineMIME("application/x-javascript", "javascript");
739 -CodeMirror.defineMIME("application/ecmascript", "javascript");
740 -CodeMirror.defineMIME("application/json", {name: "javascript", json: true});
741 -CodeMirror.defineMIME("application/x-json", {name: "javascript", json: true});
742 -CodeMirror.defineMIME("application/ld+json", {name: "javascript", jsonld: true});
743 -CodeMirror.defineMIME("text/typescript", { name: "javascript", typescript: true });
744 -CodeMirror.defineMIME("application/typescript", { name: "javascript", typescript: true });
745 -
746 -});
docs/js/jsx.js deleted
-147
@@ -1,147 +0,0 @@
1 -// CodeMirror, copyright (c) by Marijn Haverbeke and others
2 -// Distributed under an MIT license: http://codemirror.net/LICENSE
3 -
4 -(function(mod) {
5 - if (typeof exports == "object" && typeof module == "object") // CommonJS
6 - mod(require("../../lib/codemirror"), require("../xml/xml"), require("../javascript/javascript"))
7 - else if (typeof define == "function" && define.amd) // AMD
8 - define(["../../lib/codemirror", "../xml/xml", "../javascript/javascript"], mod)
9 - else // Plain browser env
10 - mod(CodeMirror)
11 -})(function(CodeMirror) {
12 - "use strict"
13 -
14 - // Depth means the amount of open braces in JS context, in XML
15 - // context 0 means not in tag, 1 means in tag, and 2 means in tag
16 - // and js block comment.
17 - function Context(state, mode, depth, prev) {
18 - this.state = state; this.mode = mode; this.depth = depth; this.prev = prev
19 - }
20 -
21 - function copyContext(context) {
22 - return new Context(CodeMirror.copyState(context.mode, context.state),
23 - context.mode,
24 - context.depth,
25 - context.prev && copyContext(context.prev))
26 - }
27 -
28 - CodeMirror.defineMode("jsx", function(config, modeConfig) {
29 - var xmlMode = CodeMirror.getMode(config, {name: "xml", allowMissing: true, multilineTagIndentPastTag: false})
30 - var jsMode = CodeMirror.getMode(config, modeConfig && modeConfig.base || "javascript")
31 -
32 - function flatXMLIndent(state) {
33 - var tagName = state.tagName
34 - state.tagName = null
35 - var result = xmlMode.indent(state, "")
36 - state.tagName = tagName
37 - return result
38 - }
39 -
40 - function token(stream, state) {
41 - if (state.context.mode == xmlMode)
42 - return xmlToken(stream, state, state.context)
43 - else
44 - return jsToken(stream, state, state.context)
45 - }
46 -
47 - function xmlToken(stream, state, cx) {
48 - if (cx.depth == 2) { // Inside a JS /* */ comment
49 - if (stream.match(/^.*?\*\//)) cx.depth = 1
50 - else stream.skipToEnd()
51 - return "comment"
52 - }
53 -
54 - if (stream.peek() == "{") {
55 - xmlMode.skipAttribute(cx.state)
56 -
57 - var indent = flatXMLIndent(cx.state), xmlContext = cx.state.context
58 - // If JS starts on same line as tag
59 - if (xmlContext && stream.match(/^[^>]*>\s*$/, false)) {
60 - while (xmlContext.prev && !xmlContext.startOfLine)
61 - xmlContext = xmlContext.prev
62 - // If tag starts the line, use XML indentation level
63 - if (xmlContext.startOfLine) indent -= config.indentUnit
64 - // Else use JS indentation level
65 - else if (cx.prev.state.lexical) indent = cx.prev.state.lexical.indented
66 - // Else if inside of tag
67 - } else if (cx.depth == 1) {
68 - indent += config.indentUnit
69 - }
70 -
71 - state.context = new Context(CodeMirror.startState(jsMode, indent),
72 - jsMode, 0, state.context)
73 - return null
74 - }
75 -
76 - if (cx.depth == 1) { // Inside of tag
77 - if (stream.peek() == "<") { // Tag inside of tag
78 - xmlMode.skipAttribute(cx.state)
79 - state.context = new Context(CodeMirror.startState(xmlMode, flatXMLIndent(cx.state)),
80 - xmlMode, 0, state.context)
81 - return null
82 - } else if (stream.match("//")) {
83 - stream.skipToEnd()
84 - return "comment"
85 - } else if (stream.match("/*")) {
86 - cx.depth = 2
87 - return token(stream, state)
88 - }
89 - }
90 -
91 - var style = xmlMode.token(stream, cx.state), cur = stream.current(), stop
92 - if (/\btag\b/.test(style)) {
93 - if (/>$/.test(cur)) {
94 - if (cx.state.context) cx.depth = 0
95 - else state.context = state.context.prev
96 - } else if (/^</.test(cur)) {
97 - cx.depth = 1
98 - }
99 - } else if (!style && (stop = cur.indexOf("{")) > -1) {
100 - stream.backUp(cur.length - stop)
101 - }
102 - return style
103 - }
104 -
105 - function jsToken(stream, state, cx) {
106 - if (stream.peek() == "<" && jsMode.expressionAllowed(stream, cx.state)) {
107 - jsMode.skipExpression(cx.state)
108 - state.context = new Context(CodeMirror.startState(xmlMode, jsMode.indent(cx.state, "")),
109 - xmlMode, 0, state.context)
110 - return null
111 - }
112 -
113 - var style = jsMode.token(stream, cx.state)
114 - if (!style && cx.depth != null) {
115 - var cur = stream.current()
116 - if (cur == "{") {
117 - cx.depth++
118 - } else if (cur == "}") {
119 - if (--cx.depth == 0) state.context = state.context.prev
120 - }
121 - }
122 - return style
123 - }
124 -
125 - return {
126 - startState: function() {
127 - return {context: new Context(CodeMirror.startState(jsMode), jsMode)}
128 - },
129 -
130 - copyState: function(state) {
131 - return {context: copyContext(state.context)}
132 - },
133 -
134 - token: token,
135 -
136 - indent: function(state, textAfter, fullLine) {
137 - return state.context.mode.indent(state.context.state, textAfter, fullLine)
138 - },
139 -
140 - innerMode: function(state) {
141 - return state.context
142 - }
143 - }
144 - }, "xml", "javascript")
145 -
146 - CodeMirror.defineMIME("text/jsx", "jsx")
147 -});
docs/js/react-dom.js deleted
-18227
@@ -1,18227 +0,0 @@
1 - /**
2 - * ReactDOM v15.4.0
3 - */
4 -
5 -;(function(f) {
6 - // CommonJS
7 - if (typeof exports === "object" && typeof module !== "undefined") {
8 - f(require('react'));
9 -
10 - // RequireJS
11 - } else if (typeof define === "function" && define.amd) {
12 - require(['react'], f);
13 -
14 - // <script>
15 - } else {
16 - var g;
17 - if (typeof window !== "undefined") {
18 - g = window;
19 - } else if (typeof global !== "undefined") {
20 - g = global;
21 - } else if (typeof self !== "undefined") {
22 - g = self;
23 - } else {
24 - // works providing we're not in "use strict";
25 - // needed for Java 8 Nashorn
26 - // see https://github.com/facebook/react/issues/3037
27 - g = this;
28 - }
29 - f(g.React)
30 - }
31 -})(function(React) {
32 - (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.ReactDOM = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(_dereq_,module,exports){
33 -/**
34 - * Copyright 2013-present, Facebook, Inc.
35 - * All rights reserved.
36 - *
37 - * This source code is licensed under the BSD-style license found in the
38 - * LICENSE file in the root directory of this source tree. An additional grant
39 - * of patent rights can be found in the PATENTS file in the same directory.
40 - *
41 - */
42 -
43 -'use strict';
44 -
45 -var ARIADOMPropertyConfig = {
46 - Properties: {
47 - // Global States and Properties
48 - 'aria-current': 0, // state
49 - 'aria-details': 0,
50 - 'aria-disabled': 0, // state
51 - 'aria-hidden': 0, // state
52 - 'aria-invalid': 0, // state
53 - 'aria-keyshortcuts': 0,
54 - 'aria-label': 0,
55 - 'aria-roledescription': 0,
56 - // Widget Attributes
57 - 'aria-autocomplete': 0,
58 - 'aria-checked': 0,
59 - 'aria-expanded': 0,
60 - 'aria-haspopup': 0,
61 - 'aria-level': 0,
62 - 'aria-modal': 0,
63 - 'aria-multiline': 0,
64 - 'aria-multiselectable': 0,
65 - 'aria-orientation': 0,
66 - 'aria-placeholder': 0,
67 - 'aria-pressed': 0,
68 - 'aria-readonly': 0,
69 - 'aria-required': 0,
70 - 'aria-selected': 0,
71 - 'aria-sort': 0,
72 - 'aria-valuemax': 0,
73 - 'aria-valuemin': 0,
74 - 'aria-valuenow': 0,
75 - 'aria-valuetext': 0,
76 - // Live Region Attributes
77 - 'aria-atomic': 0,
78 - 'aria-busy': 0,
79 - 'aria-live': 0,
80 - 'aria-relevant': 0,
81 - // Drag-and-Drop Attributes
82 - 'aria-dropeffect': 0,
83 - 'aria-grabbed': 0,
84 - // Relationship Attributes
85 - 'aria-activedescendant': 0,
86 - 'aria-colcount': 0,
87 - 'aria-colindex': 0,
88 - 'aria-colspan': 0,
89 - 'aria-controls': 0,
90 - 'aria-describedby': 0,
91 - 'aria-errormessage': 0,
92 - 'aria-flowto': 0,
93 - 'aria-labelledby': 0,
94 - 'aria-owns': 0,
95 - 'aria-posinset': 0,
96 - 'aria-rowcount': 0,
97 - 'aria-rowindex': 0,
98 - 'aria-rowspan': 0,
99 - 'aria-setsize': 0
100 - },
101 - DOMAttributeNames: {},
102 - DOMPropertyNames: {}
103 -};
104 -
105 -module.exports = ARIADOMPropertyConfig;
106 -},{}],2:[function(_dereq_,module,exports){
107 -/**
108 - * Copyright 2013-present, Facebook, Inc.
109 - * All rights reserved.
110 - *
111 - * This source code is licensed under the BSD-style license found in the
112 - * LICENSE file in the root directory of this source tree. An additional grant
113 - * of patent rights can be found in the PATENTS file in the same directory.
114 - *
115 - */
116 -
117 -'use strict';
118 -
119 -var ReactDOMComponentTree = _dereq_(34);
120 -
121 -var focusNode = _dereq_(144);
122 -
123 -var AutoFocusUtils = {
124 - focusDOMComponent: function () {
125 - focusNode(ReactDOMComponentTree.getNodeFromInstance(this));
126 - }
127 -};
128 -
129 -module.exports = AutoFocusUtils;
130 -},{"144":144,"34":34}],3:[function(_dereq_,module,exports){
131 -/**
132 - * Copyright 2013-present Facebook, Inc.
133 - * All rights reserved.
134 - *
135 - * This source code is licensed under the BSD-style license found in the
136 - * LICENSE file in the root directory of this source tree. An additional grant
137 - * of patent rights can be found in the PATENTS file in the same directory.
138 - *
139 - */
140 -
141 -'use strict';
142 -
143 -var EventPropagators = _dereq_(20);
144 -var ExecutionEnvironment = _dereq_(136);
145 -var FallbackCompositionState = _dereq_(21);
146 -var SyntheticCompositionEvent = _dereq_(89);
147 -var SyntheticInputEvent = _dereq_(93);
148 -
149 -var END_KEYCODES = [9, 13, 27, 32]; // Tab, Return, Esc, Space
150 -var START_KEYCODE = 229;
151 -
152 -var canUseCompositionEvent = ExecutionEnvironment.canUseDOM && 'CompositionEvent' in window;
153 -
154 -var documentMode = null;
155 -if (ExecutionEnvironment.canUseDOM && 'documentMode' in document) {
156 - documentMode = document.documentMode;
157 -}
158 -
159 -// Webkit offers a very useful `textInput` event that can be used to
160 -// directly represent `beforeInput`. The IE `textinput` event is not as
161 -// useful, so we don't use it.
162 -var canUseTextInputEvent = ExecutionEnvironment.canUseDOM && 'TextEvent' in window && !documentMode && !isPresto();
163 -
164 -// In IE9+, we have access to composition events, but the data supplied
165 -// by the native compositionend event may be incorrect. Japanese ideographic
166 -// spaces, for instance (\u3000) are not recorded correctly.
167 -var useFallbackCompositionData = ExecutionEnvironment.canUseDOM && (!canUseCompositionEvent || documentMode && documentMode > 8 && documentMode <= 11);
168 -
169 -/**
170 - * Opera <= 12 includes TextEvent in window, but does not fire
171 - * text input events. Rely on keypress instead.
172 - */
173 -function isPresto() {
174 - var opera = window.opera;
175 - return typeof opera === 'object' && typeof opera.version === 'function' && parseInt(opera.version(), 10) <= 12;
176 -}
177 -
178 -var SPACEBAR_CODE = 32;
179 -var SPACEBAR_CHAR = String.fromCharCode(SPACEBAR_CODE);
180 -
181 -// Events and their corresponding property names.
182 -var eventTypes = {
183 - beforeInput: {
184 - phasedRegistrationNames: {
185 - bubbled: 'onBeforeInput',
186 - captured: 'onBeforeInputCapture'
187 - },
188 - dependencies: ['topCompositionEnd', 'topKeyPress', 'topTextInput', 'topPaste']
189 - },
190 - compositionEnd: {
191 - phasedRegistrationNames: {
192 - bubbled: 'onCompositionEnd',
193 - captured: 'onCompositionEndCapture'
194 - },
195 - dependencies: ['topBlur', 'topCompositionEnd', 'topKeyDown', 'topKeyPress', 'topKeyUp', 'topMouseDown']
196 - },
197 - compositionStart: {
198 - phasedRegistrationNames: {
199 - bubbled: 'onCompositionStart',
200 - captured: 'onCompositionStartCapture'
201 - },
202 - dependencies: ['topBlur', 'topCompositionStart', 'topKeyDown', 'topKeyPress', 'topKeyUp', 'topMouseDown']
203 - },
204 - compositionUpdate: {
205 - phasedRegistrationNames: {
206 - bubbled: 'onCompositionUpdate',
207 - captured: 'onCompositionUpdateCapture'
208 - },
209 - dependencies: ['topBlur', 'topCompositionUpdate', 'topKeyDown', 'topKeyPress', 'topKeyUp', 'topMouseDown']
210 - }
211 -};
212 -
213 -// Track whether we've ever handled a keypress on the space key.
214 -var hasSpaceKeypress = false;
215 -
216 -/**
217 - * Return whether a native keypress event is assumed to be a command.
218 - * This is required because Firefox fires `keypress` events for key commands
219 - * (cut, copy, select-all, etc.) even though no character is inserted.
220 - */
221 -function isKeypressCommand(nativeEvent) {
222 - return (nativeEvent.ctrlKey || nativeEvent.altKey || nativeEvent.metaKey) &&
223 - // ctrlKey && altKey is equivalent to AltGr, and is not a command.
224 - !(nativeEvent.ctrlKey && nativeEvent.altKey);
225 -}
226 -
227 -/**
228 - * Translate native top level events into event types.
229 - *
230 - * @param {string} topLevelType
231 - * @return {object}
232 - */
233 -function getCompositionEventType(topLevelType) {
234 - switch (topLevelType) {
235 - case 'topCompositionStart':
236 - return eventTypes.compositionStart;
237 - case 'topCompositionEnd':
238 - return eventTypes.compositionEnd;
239 - case 'topCompositionUpdate':
240 - return eventTypes.compositionUpdate;
241 - }
242 -}
243 -
244 -/**
245 - * Does our fallback best-guess model think this event signifies that
246 - * composition has begun?
247 - *
248 - * @param {string} topLevelType
249 - * @param {object} nativeEvent
250 - * @return {boolean}
251 - */
252 -function isFallbackCompositionStart(topLevelType, nativeEvent) {
253 - return topLevelType === 'topKeyDown' && nativeEvent.keyCode === START_KEYCODE;
254 -}
255 -
256 -/**
257 - * Does our fallback mode think that this event is the end of composition?
258 - *
259 - * @param {string} topLevelType
260 - * @param {object} nativeEvent
261 - * @return {boolean}
262 - */
263 -function isFallbackCompositionEnd(topLevelType, nativeEvent) {
264 - switch (topLevelType) {
265 - case 'topKeyUp':
266 - // Command keys insert or clear IME input.
267 - return END_KEYCODES.indexOf(nativeEvent.keyCode) !== -1;
268 - case 'topKeyDown':
269 - // Expect IME keyCode on each keydown. If we get any other
270 - // code we must have exited earlier.
271 - return nativeEvent.keyCode !== START_KEYCODE;
272 - case 'topKeyPress':
273 - case 'topMouseDown':
274 - case 'topBlur':
275 - // Events are not possible without cancelling IME.
276 - return true;
277 - default:
278 - return false;
279 - }
280 -}
281 -
282 -/**
283 - * Google Input Tools provides composition data via a CustomEvent,
284 - * with the `data` property populated in the `detail` object. If this
285 - * is available on the event object, use it. If not, this is a plain
286 - * composition event and we have nothing special to extract.
287 - *
288 - * @param {object} nativeEvent
289 - * @return {?string}
290 - */
291 -function getDataFromCustomEvent(nativeEvent) {
292 - var detail = nativeEvent.detail;
293 - if (typeof detail === 'object' && 'data' in detail) {
294 - return detail.data;
295 - }
296 - return null;
297 -}
298 -
299 -// Track the current IME composition fallback object, if any.
300 -var currentComposition = null;
301 -
302 -/**
303 - * @return {?object} A SyntheticCompositionEvent.
304 - */
305 -function extractCompositionEvent(topLevelType, targetInst, nativeEvent, nativeEventTarget) {
306 - var eventType;
307 - var fallbackData;
308 -
309 - if (canUseCompositionEvent) {
310 - eventType = getCompositionEventType(topLevelType);
311 - } else if (!currentComposition) {
312 - if (isFallbackCompositionStart(topLevelType, nativeEvent)) {
313 - eventType = eventTypes.compositionStart;
314 - }
315 - } else if (isFallbackCompositionEnd(topLevelType, nativeEvent)) {
316 - eventType = eventTypes.compositionEnd;
317 - }
318 -
319 - if (!eventType) {
320 - return null;
321 - }
322 -
323 - if (useFallbackCompositionData) {
324 - // The current composition is stored statically and must not be
325 - // overwritten while composition continues.
326 - if (!currentComposition && eventType === eventTypes.compositionStart) {
327 - currentComposition = FallbackCompositionState.getPooled(nativeEventTarget);
328 - } else if (eventType === eventTypes.compositionEnd) {
329 - if (currentComposition) {
330 - fallbackData = currentComposition.getData();
331 - }
332 - }
333 - }
334 -
335 - var event = SyntheticCompositionEvent.getPooled(eventType, targetInst, nativeEvent, nativeEventTarget);
336 -
337 - if (fallbackData) {
338 - // Inject data generated from fallback path into the synthetic event.
339 - // This matches the property of native CompositionEventInterface.
340 - event.data = fallbackData;
341 - } else {
342 - var customData = getDataFromCustomEvent(nativeEvent);
343 - if (customData !== null) {
344 - event.data = customData;
345 - }
346 - }
347 -
348 - EventPropagators.accumulateTwoPhaseDispatches(event);
349 - return event;
350 -}
351 -
352 -/**
353 - * @param {string} topLevelType Record from `EventConstants`.
354 - * @param {object} nativeEvent Native browser event.
355 - * @return {?string} The string corresponding to this `beforeInput` event.
356 - */
357 -function getNativeBeforeInputChars(topLevelType, nativeEvent) {
358 - switch (topLevelType) {
359 - case 'topCompositionEnd':
360 - return getDataFromCustomEvent(nativeEvent);
361 - case 'topKeyPress':
362 - /**
363 - * If native `textInput` events are available, our goal is to make
364 - * use of them. However, there is a special case: the spacebar key.
365 - * In Webkit, preventing default on a spacebar `textInput` event
366 - * cancels character insertion, but it *also* causes the browser
367 - * to fall back to its default spacebar behavior of scrolling the
368 - * page.
369 - *
370 - * Tracking at:
371 - * https://code.google.com/p/chromium/issues/detail?id=355103
372 - *
373 - * To avoid this issue, use the keypress event as if no `textInput`
374 - * event is available.
375 - */
376 - var which = nativeEvent.which;
377 - if (which !== SPACEBAR_CODE) {
378 - return null;
379 - }
380 -
381 - hasSpaceKeypress = true;
382 - return SPACEBAR_CHAR;
383 -
384 - case 'topTextInput':
385 - // Record the characters to be added to the DOM.
386 - var chars = nativeEvent.data;
387 -
388 - // If it's a spacebar character, assume that we have already handled
389 - // it at the keypress level and bail immediately. Android Chrome
390 - // doesn't give us keycodes, so we need to blacklist it.
391 - if (chars === SPACEBAR_CHAR && hasSpaceKeypress) {
392 - return null;
393 - }
394 -
395 - return chars;
396 -
397 - default:
398 - // For other native event types, do nothing.
399 - return null;
400 - }
401 -}
402 -
403 -/**
404 - * For browsers that do not provide the `textInput` event, extract the
405 - * appropriate string to use for SyntheticInputEvent.
406 - *
407 - * @param {string} topLevelType Record from `EventConstants`.
408 - * @param {object} nativeEvent Native browser event.
409 - * @return {?string} The fallback string for this `beforeInput` event.
410 - */
411 -function getFallbackBeforeInputChars(topLevelType, nativeEvent) {
412 - // If we are currently composing (IME) and using a fallback to do so,
413 - // try to extract the composed characters from the fallback object.
414 - // If composition event is available, we extract a string only at
415 - // compositionevent, otherwise extract it at fallback events.
416 - if (currentComposition) {
417 - if (topLevelType === 'topCompositionEnd' || !canUseCompositionEvent && isFallbackCompositionEnd(topLevelType, nativeEvent)) {
418 - var chars = currentComposition.getData();
419 - FallbackCompositionState.release(currentComposition);
420 - currentComposition = null;
421 - return chars;
422 - }
423 - return null;
424 - }
425 -
426 - switch (topLevelType) {
427 - case 'topPaste':
428 - // If a paste event occurs after a keypress, throw out the input
429 - // chars. Paste events should not lead to BeforeInput events.
430 - return null;
431 - case 'topKeyPress':
432 - /**
433 - * As of v27, Firefox may fire keypress events even when no character
434 - * will be inserted. A few possibilities:
435 - *
436 - * - `which` is `0`. Arrow keys, Esc key, etc.
437 - *
438 - * - `which` is the pressed key code, but no char is available.
439 - * Ex: 'AltGr + d` in Polish. There is no modified character for
440 - * this key combination and no character is inserted into the
441 - * document, but FF fires the keypress for char code `100` anyway.
442 - * No `input` event will occur.
443 - *
444 - * - `which` is the pressed key code, but a command combination is
445 - * being used. Ex: `Cmd+C`. No character is inserted, and no
446 - * `input` event will occur.
447 - */
448 - if (nativeEvent.which && !isKeypressCommand(nativeEvent)) {
449 - return String.fromCharCode(nativeEvent.which);
450 - }
451 - return null;
452 - case 'topCompositionEnd':
453 - return useFallbackCompositionData ? null : nativeEvent.data;
454 - default:
455 - return null;
456 - }
457 -}
458 -
459 -/**
460 - * Extract a SyntheticInputEvent for `beforeInput`, based on either native
461 - * `textInput` or fallback behavior.
462 - *
463 - * @return {?object} A SyntheticInputEvent.
464 - */
465 -function extractBeforeInputEvent(topLevelType, targetInst, nativeEvent, nativeEventTarget) {
466 - var chars;
467 -
468 - if (canUseTextInputEvent) {
469 - chars = getNativeBeforeInputChars(topLevelType, nativeEvent);
470 - } else {
471 - chars = getFallbackBeforeInputChars(topLevelType, nativeEvent);
472 - }
473 -
474 - // If no characters are being inserted, no BeforeInput event should
475 - // be fired.
476 - if (!chars) {
477 - return null;
478 - }
479 -
480 - var event = SyntheticInputEvent.getPooled(eventTypes.beforeInput, targetInst, nativeEvent, nativeEventTarget);
481 -
482 - event.data = chars;
483 - EventPropagators.accumulateTwoPhaseDispatches(event);
484 - return event;
485 -}
486 -
487 -/**
488 - * Create an `onBeforeInput` event to match
489 - * http://www.w3.org/TR/2013/WD-DOM-Level-3-Events-20131105/#events-inputevents.
490 - *
491 - * This event plugin is based on the native `textInput` event
492 - * available in Chrome, Safari, Opera, and IE. This event fires after
493 - * `onKeyPress` and `onCompositionEnd`, but before `onInput`.
494 - *
495 - * `beforeInput` is spec'd but not implemented in any browsers, and
496 - * the `input` event does not provide any useful information about what has
497 - * actually been added, contrary to the spec. Thus, `textInput` is the best
498 - * available event to identify the characters that have actually been inserted
499 - * into the target node.
500 - *
501 - * This plugin is also responsible for emitting `composition` events, thus
502 - * allowing us to share composition fallback code for both `beforeInput` and
503 - * `composition` event types.
504 - */
505 -var BeforeInputEventPlugin = {
506 -
507 - eventTypes: eventTypes,
508 -
509 - extractEvents: function (topLevelType, targetInst, nativeEvent, nativeEventTarget) {
510 - return [extractCompositionEvent(topLevelType, targetInst, nativeEvent, nativeEventTarget), extractBeforeInputEvent(topLevelType, targetInst, nativeEvent, nativeEventTarget)];
511 - }
512 -};
513 -
514 -module.exports = BeforeInputEventPlugin;
515 -},{"136":136,"20":20,"21":21,"89":89,"93":93}],4:[function(_dereq_,module,exports){
516 -/**
517 - * Copyright 2013-present, Facebook, Inc.
518 - * All rights reserved.
519 - *
520 - * This source code is licensed under the BSD-style license found in the
521 - * LICENSE file in the root directory of this source tree. An additional grant
522 - * of patent rights can be found in the PATENTS file in the same directory.
523 - *
524 - */
525 -
526 -'use strict';
527 -
528 -/**
529 - * CSS properties which accept numbers but are not in units of "px".
530 - */
531 -
532 -var isUnitlessNumber = {
533 - animationIterationCount: true,
534 - borderImageOutset: true,
535 - borderImageSlice: true,
536 - borderImageWidth: true,
537 - boxFlex: true,
538 - boxFlexGroup: true,
539 - boxOrdinalGroup: true,
540 - columnCount: true,
541 - flex: true,
542 - flexGrow: true,
543 - flexPositive: true,
544 - flexShrink: true,
545 - flexNegative: true,
546 - flexOrder: true,
547 - gridRow: true,
548 - gridColumn: true,
549 - fontWeight: true,
550 - lineClamp: true,
551 - lineHeight: true,
552 - opacity: true,
553 - order: true,
554 - orphans: true,
555 - tabSize: true,
556 - widows: true,
557 - zIndex: true,
558 - zoom: true,
559 -
560 - // SVG-related properties
561 - fillOpacity: true,
562 - floodOpacity: true,
563 - stopOpacity: true,
564 - strokeDasharray: true,
565 - strokeDashoffset: true,
566 - strokeMiterlimit: true,
567 - strokeOpacity: true,
568 - strokeWidth: true
569 -};
570 -
571 -/**
572 - * @param {string} prefix vendor-specific prefix, eg: Webkit
573 - * @param {string} key style name, eg: transitionDuration
574 - * @return {string} style name prefixed with `prefix`, properly camelCased, eg:
575 - * WebkitTransitionDuration
576 - */
577 -function prefixKey(prefix, key) {
578 - return prefix + key.charAt(0).toUpperCase() + key.substring(1);
579 -}
580 -
581 -/**
582 - * Support style names that may come passed in prefixed by adding permutations
583 - * of vendor prefixes.
584 - */
585 -var prefixes = ['Webkit', 'ms', 'Moz', 'O'];
586 -
587 -// Using Object.keys here, or else the vanilla for-in loop makes IE8 go into an
588 -// infinite loop, because it iterates over the newly added props too.
589 -Object.keys(isUnitlessNumber).forEach(function (prop) {
590 - prefixes.forEach(function (prefix) {
591 - isUnitlessNumber[prefixKey(prefix, prop)] = isUnitlessNumber[prop];
592 - });
593 -});
594 -
595 -/**
596 - * Most style properties can be unset by doing .style[prop] = '' but IE8
597 - * doesn't like doing that with shorthand properties so for the properties that
598 - * IE8 breaks on, which are listed here, we instead unset each of the
599 - * individual properties. See http://bugs.jquery.com/ticket/12385.
600 - * The 4-value 'clock' properties like margin, padding, border-width seem to
601 - * behave without any problems. Curiously, list-style works too without any
602 - * special prodding.
603 - */
604 -var shorthandPropertyExpansions = {
605 - background: {
606 - backgroundAttachment: true,
607 - backgroundColor: true,
608 - backgroundImage: true,
609 - backgroundPositionX: true,
610 - backgroundPositionY: true,
611 - backgroundRepeat: true
612 - },
613 - backgroundPosition: {
614 - backgroundPositionX: true,
615 - backgroundPositionY: true
616 - },
617 - border: {
618 - borderWidth: true,
619 - borderStyle: true,
620 - borderColor: true
621 - },
622 - borderBottom: {
623 - borderBottomWidth: true,
624 - borderBottomStyle: true,
625 - borderBottomColor: true
626 - },
627 - borderLeft: {
628 - borderLeftWidth: true,
629 - borderLeftStyle: true,
630 - borderLeftColor: true
631 - },
632 - borderRight: {
633 - borderRightWidth: true,
634 - borderRightStyle: true,
635 - borderRightColor: true
636 - },
637 - borderTop: {
638 - borderTopWidth: true,
639 - borderTopStyle: true,
640 - borderTopColor: true
641 - },
642 - font: {
643 - fontStyle: true,
644 - fontVariant: true,
645 - fontWeight: true,
646 - fontSize: true,
647 - lineHeight: true,
648 - fontFamily: true
649 - },
650 - outline: {
651 - outlineWidth: true,
652 - outlineStyle: true,
653 - outlineColor: true
654 - }
655 -};
656 -
657 -var CSSProperty = {
658 - isUnitlessNumber: isUnitlessNumber,
659 - shorthandPropertyExpansions: shorthandPropertyExpansions
660 -};
661 -
662 -module.exports = CSSProperty;
663 -},{}],5:[function(_dereq_,module,exports){
664 -/**
665 - * Copyright 2013-present, Facebook, Inc.
666 - * All rights reserved.
667 - *
668 - * This source code is licensed under the BSD-style license found in the
669 - * LICENSE file in the root directory of this source tree. An additional grant
670 - * of patent rights can be found in the PATENTS file in the same directory.
671 - *
672 - */
673 -
674 -'use strict';
675 -
676 -var CSSProperty = _dereq_(4);
677 -var ExecutionEnvironment = _dereq_(136);
678 -var ReactInstrumentation = _dereq_(64);
679 -
680 -var camelizeStyleName = _dereq_(138);
681 -var dangerousStyleValue = _dereq_(106);
682 -var hyphenateStyleName = _dereq_(149);
683 -var memoizeStringOnly = _dereq_(153);
684 -var warning = _dereq_(157);
685 -
686 -var processStyleName = memoizeStringOnly(function (styleName) {
687 - return hyphenateStyleName(styleName);
688 -});
689 -
690 -var hasShorthandPropertyBug = false;
691 -var styleFloatAccessor = 'cssFloat';
692 -if (ExecutionEnvironment.canUseDOM) {
693 - var tempStyle = document.createElement('div').style;
694 - try {
695 - // IE8 throws "Invalid argument." if resetting shorthand style properties.
696 - tempStyle.font = '';
697 - } catch (e) {
698 - hasShorthandPropertyBug = true;
699 - }
700 - // IE8 only supports accessing cssFloat (standard) as styleFloat
701 - if (document.documentElement.style.cssFloat === undefined) {
702 - styleFloatAccessor = 'styleFloat';
703 - }
704 -}
705 -
706 -if ("development" !== 'production') {
707 - // 'msTransform' is correct, but the other prefixes should be capitalized
708 - var badVendoredStyleNamePattern = /^(?:webkit|moz|o)[A-Z]/;
709 -
710 - // style values shouldn't contain a semicolon
711 - var badStyleValueWithSemicolonPattern = /;\s*$/;
712 -
713 - var warnedStyleNames = {};
714 - var warnedStyleValues = {};
715 - var warnedForNaNValue = false;
716 -
717 - var warnHyphenatedStyleName = function (name, owner) {
718 - if (warnedStyleNames.hasOwnProperty(name) && warnedStyleNames[name]) {
719 - return;
720 - }
721 -
722 - warnedStyleNames[name] = true;
723 - "development" !== 'production' ? warning(false, 'Unsupported style property %s. Did you mean %s?%s', name, camelizeStyleName(name), checkRenderMessage(owner)) : void 0;
724 - };
725 -
726 - var warnBadVendoredStyleName = function (name, owner) {
727 - if (warnedStyleNames.hasOwnProperty(name) && warnedStyleNames[name]) {
728 - return;
729 - }
730 -
731 - warnedStyleNames[name] = true;
732 - "development" !== '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;
733 - };
734 -
735 - var warnStyleValueWithSemicolon = function (name, value, owner) {
736 - if (warnedStyleValues.hasOwnProperty(value) && warnedStyleValues[value]) {
737 - return;
738 - }
739 -
740 - warnedStyleValues[value] = true;
741 - "development" !== 'production' ? warning(false, 'Style property values shouldn\'t contain a semicolon.%s ' + 'Try "%s: %s" instead.', checkRenderMessage(owner), name, value.replace(badStyleValueWithSemicolonPattern, '')) : void 0;
742 - };
743 -
744 - var warnStyleValueIsNaN = function (name, value, owner) {
745 - if (warnedForNaNValue) {
746 - return;
747 - }
748 -
749 - warnedForNaNValue = true;
750 - "development" !== 'production' ? warning(false, '`NaN` is an invalid value for the `%s` css style property.%s', name, checkRenderMessage(owner)) : void 0;
751 - };
752 -
753 - var checkRenderMessage = function (owner) {
754 - if (owner) {
755 - var name = owner.getName();
756 - if (name) {
757 - return ' Check the render method of `' + name + '`.';
758 - }
759 - }
760 - return '';
761 - };
762 -
763 - /**
764 - * @param {string} name
765 - * @param {*} value
766 - * @param {ReactDOMComponent} component
767 - */
768 - var warnValidStyle = function (name, value, component) {
769 - var owner;
770 - if (component) {
771 - owner = component._currentElement._owner;
772 - }
773 - if (name.indexOf('-') > -1) {
774 - warnHyphenatedStyleName(name, owner);
775 - } else if (badVendoredStyleNamePattern.test(name)) {
776 - warnBadVendoredStyleName(name, owner);
777 - } else if (badStyleValueWithSemicolonPattern.test(value)) {
778 - warnStyleValueWithSemicolon(name, value, owner);
779 - }
780 -
781 - if (typeof value === 'number' && isNaN(value)) {
782 - warnStyleValueIsNaN(name, value, owner);
783 - }
784 - };
785 -}
786 -
787 -/**
788 - * Operations for dealing with CSS properties.
789 - */
790 -var CSSPropertyOperations = {
791 -
792 - /**
793 - * Serializes a mapping of style properties for use as inline styles:
794 - *
795 - * > createMarkupForStyles({width: '200px', height: 0})
796 - * "width:200px;height:0;"
797 - *
798 - * Undefined values are ignored so that declarative programming is easier.
799 - * The result should be HTML-escaped before insertion into the DOM.
800 - *
801 - * @param {object} styles
802 - * @param {ReactDOMComponent} component
803 - * @return {?string}
804 - */
805 - createMarkupForStyles: function (styles, component) {
806 - var serialized = '';
807 - for (var styleName in styles) {
808 - if (!styles.hasOwnProperty(styleName)) {
809 - continue;
810 - }
811 - var styleValue = styles[styleName];
812 - if ("development" !== 'production') {
813 - warnValidStyle(styleName, styleValue, component);
814 - }
815 - if (styleValue != null) {
816 - serialized += processStyleName(styleName) + ':';
817 - serialized += dangerousStyleValue(styleName, styleValue, component) + ';';
818 - }
819 - }
820 - return serialized || null;
821 - },
822 -
823 - /**
824 - * Sets the value for multiple styles on a node. If a value is specified as
825 - * '' (empty string), the corresponding style property will be unset.
826 - *
827 - * @param {DOMElement} node
828 - * @param {object} styles
829 - * @param {ReactDOMComponent} component
830 - */
831 - setValueForStyles: function (node, styles, component) {
832 - if ("development" !== 'production') {
833 - ReactInstrumentation.debugTool.onHostOperation({
834 - instanceID: component._debugID,
835 - type: 'update styles',
836 - payload: styles
837 - });
838 - }
839 -
840 - var style = node.style;
841 - for (var styleName in styles) {
842 - if (!styles.hasOwnProperty(styleName)) {
843 - continue;
844 - }
845 - if ("development" !== 'production') {
846 - warnValidStyle(styleName, styles[styleName], component);
847 - }
848 - var styleValue = dangerousStyleValue(styleName, styles[styleName], component);
849 - if (styleName === 'float' || styleName === 'cssFloat') {
850 - styleName = styleFloatAccessor;
851 - }
852 - if (styleValue) {
853 - style[styleName] = styleValue;
854 - } else {
855 - var expansion = hasShorthandPropertyBug && CSSProperty.shorthandPropertyExpansions[styleName];
856 - if (expansion) {
857 - // Shorthand property that IE8 won't like unsetting, so unset each
858 - // component to placate it
859 - for (var individualStyleName in expansion) {
860 - style[individualStyleName] = '';
861 - }
862 - } else {
863 - style[styleName] = '';
864 - }
865 - }
866 - }
867 - }
868 -
869 -};
870 -
871 -module.exports = CSSPropertyOperations;
872 -},{"106":106,"136":136,"138":138,"149":149,"153":153,"157":157,"4":4,"64":64}],6:[function(_dereq_,module,exports){
873 -/**
874 - * Copyright 2013-present, Facebook, Inc.
875 - * All rights reserved.
876 - *
877 - * This source code is licensed under the BSD-style license found in the
878 - * LICENSE file in the root directory of this source tree. An additional grant
879 - * of patent rights can be found in the PATENTS file in the same directory.
880 - *
881 - *
882 - */
883 -
884 -'use strict';
885 -
886 -var _prodInvariant = _dereq_(125);
887 -
888 -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
889 -
890 -var PooledClass = _dereq_(25);
891 -
892 -var invariant = _dereq_(150);
893 -
894 -/**
895 - * A specialized pseudo-event module to help keep track of components waiting to
896 - * be notified when their DOM representations are available for use.
897 - *
898 - * This implements `PooledClass`, so you should never need to instantiate this.
899 - * Instead, use `CallbackQueue.getPooled()`.
900 - *
901 - * @class ReactMountReady
902 - * @implements PooledClass
903 - * @internal
904 - */
905 -
906 -var CallbackQueue = function () {
907 - function CallbackQueue(arg) {
908 - _classCallCheck(this, CallbackQueue);
909 -
910 - this._callbacks = null;
911 - this._contexts = null;
912 - this._arg = arg;
913 - }
914 -
915 - /**
916 - * Enqueues a callback to be invoked when `notifyAll` is invoked.
917 - *
918 - * @param {function} callback Invoked when `notifyAll` is invoked.
919 - * @param {?object} context Context to call `callback` with.
920 - * @internal
921 - */
922 -
923 -
924 - CallbackQueue.prototype.enqueue = function enqueue(callback, context) {
925 - this._callbacks = this._callbacks || [];
926 - this._callbacks.push(callback);
927 - this._contexts = this._contexts || [];
928 - this._contexts.push(context);
929 - };
930 -
931 - /**
932 - * Invokes all enqueued callbacks and clears the queue. This is invoked after
933 - * the DOM representation of a component has been created or updated.
934 - *
935 - * @internal
936 - */
937 -
938 -
939 - CallbackQueue.prototype.notifyAll = function notifyAll() {
940 - var callbacks = this._callbacks;
941 - var contexts = this._contexts;
942 - var arg = this._arg;
943 - if (callbacks && contexts) {
944 - !(callbacks.length === contexts.length) ? "development" !== 'production' ? invariant(false, 'Mismatched list of contexts in callback queue') : _prodInvariant('24') : void 0;
945 - this._callbacks = null;
946 - this._contexts = null;
947 - for (var i = 0; i < callbacks.length; i++) {
948 - callbacks[i].call(contexts[i], arg);
949 - }
950 - callbacks.length = 0;
951 - contexts.length = 0;
952 - }
953 - };
954 -
955 - CallbackQueue.prototype.checkpoint = function checkpoint() {
956 - return this._callbacks ? this._callbacks.length : 0;
957 - };
958 -
959 - CallbackQueue.prototype.rollback = function rollback(len) {
960 - if (this._callbacks && this._contexts) {
961 - this._callbacks.length = len;
962 - this._contexts.length = len;
963 - }
964 - };
965 -
966 - /**
967 - * Resets the internal queue.
968 - *
969 - * @internal
970 - */
971 -
972 -
973 - CallbackQueue.prototype.reset = function reset() {
974 - this._callbacks = null;
975 - this._contexts = null;
976 - };
977 -
978 - /**
979 - * `PooledClass` looks for this.
980 - */
981 -
982 -
983 - CallbackQueue.prototype.destructor = function destructor() {
984 - this.reset();
985 - };
986 -
987 - return CallbackQueue;
988 -}();
989 -
990 -module.exports = PooledClass.addPoolingTo(CallbackQueue);
991 -},{"125":125,"150":150,"25":25}],7:[function(_dereq_,module,exports){
992 -/**
993 - * Copyright 2013-present, Facebook, Inc.
994 - * All rights reserved.
995 - *
996 - * This source code is licensed under the BSD-style license found in the
997 - * LICENSE file in the root directory of this source tree. An additional grant
998 - * of patent rights can be found in the PATENTS file in the same directory.
999 - *
1000 - */
1001 -
1002 -'use strict';
1003 -
1004 -var EventPluginHub = _dereq_(17);
1005 -var EventPropagators = _dereq_(20);
1006 -var ExecutionEnvironment = _dereq_(136);
1007 -var ReactDOMComponentTree = _dereq_(34);
1008 -var ReactUpdates = _dereq_(82);
1009 -var SyntheticEvent = _dereq_(91);
1010 -
1011 -var getEventTarget = _dereq_(114);
1012 -var isEventSupported = _dereq_(122);
1013 -var isTextInputElement = _dereq_(123);
1014 -
1015 -var eventTypes = {
1016 - change: {
1017 - phasedRegistrationNames: {
1018 - bubbled: 'onChange',
1019 - captured: 'onChangeCapture'
1020 - },
1021 - dependencies: ['topBlur', 'topChange', 'topClick', 'topFocus', 'topInput', 'topKeyDown', 'topKeyUp', 'topSelectionChange']
1022 - }
1023 -};
1024 -
1025 -/**
1026 - * For IE shims
1027 - */
1028 -var activeElement = null;
1029 -var activeElementInst = null;
1030 -var activeElementValue = null;
1031 -var activeElementValueProp = null;
1032 -
1033 -/**
1034 - * SECTION: handle `change` event
1035 - */
1036 -function shouldUseChangeEvent(elem) {
1037 - var nodeName = elem.nodeName && elem.nodeName.toLowerCase();
1038 - return nodeName === 'select' || nodeName === 'input' && elem.type === 'file';
1039 -}
1040 -
1041 -var doesChangeEventBubble = false;
1042 -if (ExecutionEnvironment.canUseDOM) {
1043 - // See `handleChange` comment below
1044 - doesChangeEventBubble = isEventSupported('change') && (!document.documentMode || document.documentMode > 8);
1045 -}
1046 -
1047 -function manualDispatchChangeEvent(nativeEvent) {
1048 - var event = SyntheticEvent.getPooled(eventTypes.change, activeElementInst, nativeEvent, getEventTarget(nativeEvent));
1049 - EventPropagators.accumulateTwoPhaseDispatches(event);
1050 -
1051 - // If change and propertychange bubbled, we'd just bind to it like all the
1052 - // other events and have it go through ReactBrowserEventEmitter. Since it
1053 - // doesn't, we manually listen for the events and so we have to enqueue and
1054 - // process the abstract event manually.
1055 - //
1056 - // Batching is necessary here in order to ensure that all event handlers run
1057 - // before the next rerender (including event handlers attached to ancestor
1058 - // elements instead of directly on the input). Without this, controlled
1059 - // components don't work properly in conjunction with event bubbling because
1060 - // the component is rerendered and the value reverted before all the event
1061 - // handlers can run. See https://github.com/facebook/react/issues/708.
1062 - ReactUpdates.batchedUpdates(runEventInBatch, event);
1063 -}
1064 -
1065 -function runEventInBatch(event) {
1066 - EventPluginHub.enqueueEvents(event);
1067 - EventPluginHub.processEventQueue(false);
1068 -}
1069 -
1070 -function startWatchingForChangeEventIE8(target, targetInst) {
1071 - activeElement = target;
1072 - activeElementInst = targetInst;
1073 - activeElement.attachEvent('onchange', manualDispatchChangeEvent);
1074 -}
1075 -
1076 -function stopWatchingForChangeEventIE8() {
1077 - if (!activeElement) {
1078 - return;
1079 - }
1080 - activeElement.detachEvent('onchange', manualDispatchChangeEvent);
1081 - activeElement = null;
1082 - activeElementInst = null;
1083 -}
1084 -
1085 -function getTargetInstForChangeEvent(topLevelType, targetInst) {
1086 - if (topLevelType === 'topChange') {
1087 - return targetInst;
1088 - }
1089 -}
1090 -function handleEventsForChangeEventIE8(topLevelType, target, targetInst) {
1091 - if (topLevelType === 'topFocus') {
1092 - // stopWatching() should be a noop here but we call it just in case we
1093 - // missed a blur event somehow.
1094 - stopWatchingForChangeEventIE8();
1095 - startWatchingForChangeEventIE8(target, targetInst);
1096 - } else if (topLevelType === 'topBlur') {
1097 - stopWatchingForChangeEventIE8();
1098 - }
1099 -}
1100 -
1101 -/**
1102 - * SECTION: handle `input` event
1103 - */
1104 -var isInputEventSupported = false;
1105 -if (ExecutionEnvironment.canUseDOM) {
1106 - // IE9 claims to support the input event but fails to trigger it when
1107 - // deleting text, so we ignore its input events.
1108 - // IE10+ fire input events to often, such when a placeholder
1109 - // changes or when an input with a placeholder is focused.
1110 - isInputEventSupported = isEventSupported('input') && (!document.documentMode || document.documentMode > 11);
1111 -}
1112 -
1113 -/**
1114 - * (For IE <=11) Replacement getter/setter for the `value` property that gets
1115 - * set on the active element.
1116 - */
1117 -var newValueProp = {
1118 - get: function () {
1119 - return activeElementValueProp.get.call(this);
1120 - },
1121 - set: function (val) {
1122 - // Cast to a string so we can do equality checks.
1123 - activeElementValue = '' + val;
1124 - activeElementValueProp.set.call(this, val);
1125 - }
1126 -};
1127 -
1128 -/**
1129 - * (For IE <=11) Starts tracking propertychange events on the passed-in element
1130 - * and override the value property so that we can distinguish user events from
1131 - * value changes in JS.
1132 - */
1133 -function startWatchingForValueChange(target, targetInst) {
1134 - activeElement = target;
1135 - activeElementInst = targetInst;
1136 - activeElementValue = target.value;
1137 - activeElementValueProp = Object.getOwnPropertyDescriptor(target.constructor.prototype, 'value');
1138 -
1139 - // Not guarded in a canDefineProperty check: IE8 supports defineProperty only
1140 - // on DOM elements
1141 - Object.defineProperty(activeElement, 'value', newValueProp);
1142 - if (activeElement.attachEvent) {
1143 - activeElement.attachEvent('onpropertychange', handlePropertyChange);
1144 - } else {
1145 - activeElement.addEventListener('propertychange', handlePropertyChange, false);
1146 - }
1147 -}
1148 -
1149 -/**
1150 - * (For IE <=11) Removes the event listeners from the currently-tracked element,
1151 - * if any exists.
1152 - */
1153 -function stopWatchingForValueChange() {
1154 - if (!activeElement) {
1155 - return;
1156 - }
1157 -
1158 - // delete restores the original property definition
1159 - delete activeElement.value;
1160 -
1161 - if (activeElement.detachEvent) {
1162 - activeElement.detachEvent('onpropertychange', handlePropertyChange);
1163 - } else {
1164 - activeElement.removeEventListener('propertychange', handlePropertyChange, false);
1165 - }
1166 -
1167 - activeElement = null;
1168 - activeElementInst = null;
1169 - activeElementValue = null;
1170 - activeElementValueProp = null;
1171 -}
1172 -
1173 -/**
1174 - * (For IE <=11) Handles a propertychange event, sending a `change` event if
1175 - * the value of the active element has changed.
1176 - */
1177 -function handlePropertyChange(nativeEvent) {
1178 - if (nativeEvent.propertyName !== 'value') {
1179 - return;
1180 - }
1181 - var value = nativeEvent.srcElement.value;
1182 - if (value === activeElementValue) {
1183 - return;
1184 - }
1185 - activeElementValue = value;
1186 -
1187 - manualDispatchChangeEvent(nativeEvent);
1188 -}
1189 -
1190 -/**
1191 - * If a `change` event should be fired, returns the target's ID.
1192 - */
1193 -function getTargetInstForInputEvent(topLevelType, targetInst) {
1194 - if (topLevelType === 'topInput') {
1195 - // In modern browsers (i.e., not IE8 or IE9), the input event is exactly
1196 - // what we want so fall through here and trigger an abstract event
1197 - return targetInst;
1198 - }
1199 -}
1200 -
1201 -function handleEventsForInputEventIE(topLevelType, target, targetInst) {
1202 - if (topLevelType === 'topFocus') {
1203 - // In IE8, we can capture almost all .value changes by adding a
1204 - // propertychange handler and looking for events with propertyName
1205 - // equal to 'value'
1206 - // In IE9-11, propertychange fires for most input events but is buggy and
1207 - // doesn't fire when text is deleted, but conveniently, selectionchange
1208 - // appears to fire in all of the remaining cases so we catch those and
1209 - // forward the event if the value has changed
1210 - // In either case, we don't want to call the event handler if the value
1211 - // is changed from JS so we redefine a setter for `.value` that updates
1212 - // our activeElementValue variable, allowing us to ignore those changes
1213 - //
1214 - // stopWatching() should be a noop here but we call it just in case we
1215 - // missed a blur event somehow.
1216 - stopWatchingForValueChange();
1217 - startWatchingForValueChange(target, targetInst);
1218 - } else if (topLevelType === 'topBlur') {
1219 - stopWatchingForValueChange();
1220 - }
1221 -}
1222 -
1223 -// For IE8 and IE9.
1224 -function getTargetInstForInputEventIE(topLevelType, targetInst) {
1225 - if (topLevelType === 'topSelectionChange' || topLevelType === 'topKeyUp' || topLevelType === 'topKeyDown') {
1226 - // On the selectionchange event, the target is just document which isn't
1227 - // helpful for us so just check activeElement instead.
1228 - //
1229 - // 99% of the time, keydown and keyup aren't necessary. IE8 fails to fire
1230 - // propertychange on the first input event after setting `value` from a
1231 - // script and fires only keydown, keypress, keyup. Catching keyup usually
1232 - // gets it and catching keydown lets us fire an event for the first
1233 - // keystroke if user does a key repeat (it'll be a little delayed: right
1234 - // before the second keystroke). Other input methods (e.g., paste) seem to
1235 - // fire selectionchange normally.
1236 - if (activeElement && activeElement.value !== activeElementValue) {
1237 - activeElementValue = activeElement.value;
1238 - return activeElementInst;
1239 - }
1240 - }
1241 -}
1242 -
1243 -/**
1244 - * SECTION: handle `click` event
1245 - */
1246 -function shouldUseClickEvent(elem) {
1247 - // Use the `click` event to detect changes to checkbox and radio inputs.
1248 - // This approach works across all browsers, whereas `change` does not fire
1249 - // until `blur` in IE8.
1250 - return elem.nodeName && elem.nodeName.toLowerCase() === 'input' && (elem.type === 'checkbox' || elem.type === 'radio');
1251 -}
1252 -
1253 -function getTargetInstForClickEvent(topLevelType, targetInst) {
1254 - if (topLevelType === 'topClick') {
1255 - return targetInst;
1256 - }
1257 -}
1258 -
1259 -/**
1260 - * This plugin creates an `onChange` event that normalizes change events
1261 - * across form elements. This event fires at a time when it's possible to
1262 - * change the element's value without seeing a flicker.
1263 - *
1264 - * Supported elements are:
1265 - * - input (see `isTextInputElement`)
1266 - * - textarea
1267 - * - select
1268 - */
1269 -var ChangeEventPlugin = {
1270 -
1271 - eventTypes: eventTypes,
1272 -
1273 - extractEvents: function (topLevelType, targetInst, nativeEvent, nativeEventTarget) {
1274 - var targetNode = targetInst ? ReactDOMComponentTree.getNodeFromInstance(targetInst) : window;
1275 -
1276 - var getTargetInstFunc, handleEventFunc;
1277 - if (shouldUseChangeEvent(targetNode)) {
1278 - if (doesChangeEventBubble) {
1279 - getTargetInstFunc = getTargetInstForChangeEvent;
1280 - } else {
1281 - handleEventFunc = handleEventsForChangeEventIE8;
1282 - }
1283 - } else if (isTextInputElement(targetNode)) {
1284 - if (isInputEventSupported) {
1285 - getTargetInstFunc = getTargetInstForInputEvent;
1286 - } else {
1287 - getTargetInstFunc = getTargetInstForInputEventIE;
1288 - handleEventFunc = handleEventsForInputEventIE;
1289 - }
1290 - } else if (shouldUseClickEvent(targetNode)) {
1291 - getTargetInstFunc = getTargetInstForClickEvent;
1292 - }
1293 -
1294 - if (getTargetInstFunc) {
1295 - var inst = getTargetInstFunc(topLevelType, targetInst);
1296 - if (inst) {
1297 - var event = SyntheticEvent.getPooled(eventTypes.change, inst, nativeEvent, nativeEventTarget);
1298 - event.type = 'change';
1299 - EventPropagators.accumulateTwoPhaseDispatches(event);
1300 - return event;
1301 - }
1302 - }
1303 -
1304 - if (handleEventFunc) {
1305 - handleEventFunc(topLevelType, targetNode, targetInst);
1306 - }
1307 - }
1308 -
1309 -};
1310 -
1311 -module.exports = ChangeEventPlugin;
1312 -},{"114":114,"122":122,"123":123,"136":136,"17":17,"20":20,"34":34,"82":82,"91":91}],8:[function(_dereq_,module,exports){
1313 -/**
1314 - * Copyright 2013-present, Facebook, Inc.
1315 - * All rights reserved.
1316 - *
1317 - * This source code is licensed under the BSD-style license found in the
1318 - * LICENSE file in the root directory of this source tree. An additional grant
1319 - * of patent rights can be found in the PATENTS file in the same directory.
1320 - *
1321 - */
1322 -
1323 -'use strict';
1324 -
1325 -var DOMLazyTree = _dereq_(9);
1326 -var Danger = _dereq_(13);
1327 -var ReactDOMComponentTree = _dereq_(34);
1328 -var ReactInstrumentation = _dereq_(64);
1329 -
1330 -var createMicrosoftUnsafeLocalFunction = _dereq_(105);
1331 -var setInnerHTML = _dereq_(127);
1332 -var setTextContent = _dereq_(128);
1333 -
1334 -function getNodeAfter(parentNode, node) {
1335 - // Special case for text components, which return [open, close] comments
1336 - // from getHostNode.
1337 - if (Array.isArray(node)) {
1338 - node = node[1];
1339 - }
1340 - return node ? node.nextSibling : parentNode.firstChild;
1341 -}
1342 -
1343 -/**
1344 - * Inserts `childNode` as a child of `parentNode` at the `index`.
1345 - *
1346 - * @param {DOMElement} parentNode Parent node in which to insert.
1347 - * @param {DOMElement} childNode Child node to insert.
1348 - * @param {number} index Index at which to insert the child.
1349 - * @internal
1350 - */
1351 -var insertChildAt = createMicrosoftUnsafeLocalFunction(function (parentNode, childNode, referenceNode) {
1352 - // We rely exclusively on `insertBefore(node, null)` instead of also using
1353 - // `appendChild(node)`. (Using `undefined` is not allowed by all browsers so
1354 - // we are careful to use `null`.)
1355 - parentNode.insertBefore(childNode, referenceNode);
1356 -});
1357 -
1358 -function insertLazyTreeChildAt(parentNode, childTree, referenceNode) {
1359 - DOMLazyTree.insertTreeBefore(parentNode, childTree, referenceNode);
1360 -}
1361 -
1362 -function moveChild(parentNode, childNode, referenceNode) {
1363 - if (Array.isArray(childNode)) {
1364 - moveDelimitedText(parentNode, childNode[0], childNode[1], referenceNode);
1365 - } else {
1366 - insertChildAt(parentNode, childNode, referenceNode);
1367 - }
1368 -}
1369 -
1370 -function removeChild(parentNode, childNode) {
1371 - if (Array.isArray(childNode)) {
1372 - var closingComment = childNode[1];
1373 - childNode = childNode[0];
1374 - removeDelimitedText(parentNode, childNode, closingComment);
1375 - parentNode.removeChild(closingComment);
1376 - }
1377 - parentNode.removeChild(childNode);
1378 -}
1379 -
1380 -function moveDelimitedText(parentNode, openingComment, closingComment, referenceNode) {
1381 - var node = openingComment;
1382 - while (true) {
1383 - var nextNode = node.nextSibling;
1384 - insertChildAt(parentNode, node, referenceNode);
1385 - if (node === closingComment) {
1386 - break;
1387 - }
1388 - node = nextNode;
1389 - }
1390 -}
1391 -
1392 -function removeDelimitedText(parentNode, startNode, closingComment) {
1393 - while (true) {
1394 - var node = startNode.nextSibling;
1395 - if (node === closingComment) {
1396 - // The closing comment is removed by ReactMultiChild.
1397 - break;
1398 - } else {
1399 - parentNode.removeChild(node);
1400 - }
1401 - }
1402 -}
1403 -
1404 -function replaceDelimitedText(openingComment, closingComment, stringText) {
1405 - var parentNode = openingComment.parentNode;
1406 - var nodeAfterComment = openingComment.nextSibling;
1407 - if (nodeAfterComment === closingComment) {
1408 - // There are no text nodes between the opening and closing comments; insert
1409 - // a new one if stringText isn't empty.
1410 - if (stringText) {
1411 - insertChildAt(parentNode, document.createTextNode(stringText), nodeAfterComment);
1412 - }
1413 - } else {
1414 - if (stringText) {
1415 - // Set the text content of the first node after the opening comment, and
1416 - // remove all following nodes up until the closing comment.
1417 - setTextContent(nodeAfterComment, stringText);
1418 - removeDelimitedText(parentNode, nodeAfterComment, closingComment);
1419 - } else {
1420 - removeDelimitedText(parentNode, openingComment, closingComment);
1421 - }
1422 - }
1423 -
1424 - if ("development" !== 'production') {
1425 - ReactInstrumentation.debugTool.onHostOperation({
1426 - instanceID: ReactDOMComponentTree.getInstanceFromNode(openingComment)._debugID,
1427 - type: 'replace text',
1428 - payload: stringText
1429 - });
1430 - }
1431 -}
1432 -
1433 -var dangerouslyReplaceNodeWithMarkup = Danger.dangerouslyReplaceNodeWithMarkup;
1434 -if ("development" !== 'production') {
1435 - dangerouslyReplaceNodeWithMarkup = function (oldChild, markup, prevInstance) {
1436 - Danger.dangerouslyReplaceNodeWithMarkup(oldChild, markup);
1437 - if (prevInstance._debugID !== 0) {
1438 - ReactInstrumentation.debugTool.onHostOperation({
1439 - instanceID: prevInstance._debugID,
1440 - type: 'replace with',
1441 - payload: markup.toString()
1442 - });
1443 - } else {
1444 - var nextInstance = ReactDOMComponentTree.getInstanceFromNode(markup.node);
1445 - if (nextInstance._debugID !== 0) {
1446 - ReactInstrumentation.debugTool.onHostOperation({
1447 - instanceID: nextInstance._debugID,
1448 - type: 'mount',
1449 - payload: markup.toString()
1450 - });
1451 - }
1452 - }
1453 - };
1454 -}
1455 -
1456 -/**
1457 - * Operations for updating with DOM children.
1458 - */
1459 -var DOMChildrenOperations = {
1460 -
1461 - dangerouslyReplaceNodeWithMarkup: dangerouslyReplaceNodeWithMarkup,
1462 -
1463 - replaceDelimitedText: replaceDelimitedText,
1464 -
1465 - /**
1466 - * Updates a component's children by processing a series of updates. The
1467 - * update configurations are each expected to have a `parentNode` property.
1468 - *
1469 - * @param {array<object>} updates List of update configurations.
1470 - * @internal
1471 - */
1472 - processUpdates: function (parentNode, updates) {
1473 - if ("development" !== 'production') {
1474 - var parentNodeDebugID = ReactDOMComponentTree.getInstanceFromNode(parentNode)._debugID;
1475 - }
1476 -
1477 - for (var k = 0; k < updates.length; k++) {
1478 - var update = updates[k];
1479 - switch (update.type) {
1480 - case 'INSERT_MARKUP':
1481 - insertLazyTreeChildAt(parentNode, update.content, getNodeAfter(parentNode, update.afterNode));
1482 - if ("development" !== 'production') {
1483 - ReactInstrumentation.debugTool.onHostOperation({
1484 - instanceID: parentNodeDebugID,
1485 - type: 'insert child',
1486 - payload: { toIndex: update.toIndex, content: update.content.toString() }
1487 - });
1488 - }
1489 - break;
1490 - case 'MOVE_EXISTING':
1491 - moveChild(parentNode, update.fromNode, getNodeAfter(parentNode, update.afterNode));
1492 - if ("development" !== 'production') {
1493 - ReactInstrumentation.debugTool.onHostOperation({
1494 - instanceID: parentNodeDebugID,
1495 - type: 'move child',
1496 - payload: { fromIndex: update.fromIndex, toIndex: update.toIndex }
1497 - });
1498 - }
1499 - break;
1500 - case 'SET_MARKUP':
1501 - setInnerHTML(parentNode, update.content);
1502 - if ("development" !== 'production') {
1503 - ReactInstrumentation.debugTool.onHostOperation({
1504 - instanceID: parentNodeDebugID,
1505 - type: 'replace children',
1506 - payload: update.content.toString()
1507 - });
1508 - }
1509 - break;
1510 - case 'TEXT_CONTENT':
1511 - setTextContent(parentNode, update.content);
1512 - if ("development" !== 'production') {
1513 - ReactInstrumentation.debugTool.onHostOperation({
1514 - instanceID: parentNodeDebugID,
1515 - type: 'replace text',
1516 - payload: update.content.toString()
1517 - });
1518 - }
1519 - break;
1520 - case 'REMOVE_NODE':
1521 - removeChild(parentNode, update.fromNode);
1522 - if ("development" !== 'production') {
1523 - ReactInstrumentation.debugTool.onHostOperation({
1524 - instanceID: parentNodeDebugID,
1525 - type: 'remove child',
1526 - payload: { fromIndex: update.fromIndex }
1527 - });
1528 - }
1529 - break;
1530 - }
1531 - }
1532 - }
1533 -
1534 -};
1535 -
1536 -module.exports = DOMChildrenOperations;
1537 -},{"105":105,"127":127,"128":128,"13":13,"34":34,"64":64,"9":9}],9:[function(_dereq_,module,exports){
1538 -/**
1539 - * Copyright 2015-present, Facebook, Inc.
1540 - * All rights reserved.
1541 - *
1542 - * This source code is licensed under the BSD-style license found in the
1543 - * LICENSE file in the root directory of this source tree. An additional grant
1544 - * of patent rights can be found in the PATENTS file in the same directory.
1545 - *
1546 - */
1547 -
1548 -'use strict';
1549 -
1550 -var DOMNamespaces = _dereq_(10);
1551 -var setInnerHTML = _dereq_(127);
1552 -
1553 -var createMicrosoftUnsafeLocalFunction = _dereq_(105);
1554 -var setTextContent = _dereq_(128);
1555 -
1556 -var ELEMENT_NODE_TYPE = 1;
1557 -var DOCUMENT_FRAGMENT_NODE_TYPE = 11;
1558 -
1559 -/**
1560 - * In IE (8-11) and Edge, appending nodes with no children is dramatically
1561 - * faster than appending a full subtree, so we essentially queue up the
1562 - * .appendChild calls here and apply them so each node is added to its parent
1563 - * before any children are added.
1564 - *
1565 - * In other browsers, doing so is slower or neutral compared to the other order
1566 - * (in Firefox, twice as slow) so we only do this inversion in IE.
1567 - *
1568 - * See https://github.com/spicyj/innerhtml-vs-createelement-vs-clonenode.
1569 - */
1570 -var enableLazy = typeof document !== 'undefined' && typeof document.documentMode === 'number' || typeof navigator !== 'undefined' && typeof navigator.userAgent === 'string' && /\bEdge\/\d/.test(navigator.userAgent);
1571 -
1572 -function insertTreeChildren(tree) {
1573 - if (!enableLazy) {
1574 - return;
1575 - }
1576 - var node = tree.node;
1577 - var children = tree.children;
1578 - if (children.length) {
1579 - for (var i = 0; i < children.length; i++) {
1580 - insertTreeBefore(node, children[i], null);
1581 - }
1582 - } else if (tree.html != null) {
1583 - setInnerHTML(node, tree.html);
1584 - } else if (tree.text != null) {
1585 - setTextContent(node, tree.text);
1586 - }
1587 -}
1588 -
1589 -var insertTreeBefore = createMicrosoftUnsafeLocalFunction(function (parentNode, tree, referenceNode) {
1590 - // DocumentFragments aren't actually part of the DOM after insertion so
1591 - // appending children won't update the DOM. We need to ensure the fragment
1592 - // is properly populated first, breaking out of our lazy approach for just
1593 - // this level. Also, some <object> plugins (like Flash Player) will read
1594 - // <param> nodes immediately upon insertion into the DOM, so <object>
1595 - // must also be populated prior to insertion into the DOM.
1596 - 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)) {
1597 - insertTreeChildren(tree);
1598 - parentNode.insertBefore(tree.node, referenceNode);
1599 - } else {
1600 - parentNode.insertBefore(tree.node, referenceNode);
1601 - insertTreeChildren(tree);
1602 - }
1603 -});
1604 -
1605 -function replaceChildWithTree(oldNode, newTree) {
1606 - oldNode.parentNode.replaceChild(newTree.node, oldNode);
1607 - insertTreeChildren(newTree);
1608 -}
1609 -
1610 -function queueChild(parentTree, childTree) {
1611 - if (enableLazy) {
1612 - parentTree.children.push(childTree);
1613 - } else {
1614 - parentTree.node.appendChild(childTree.node);
1615 - }
1616 -}
1617 -
1618 -function queueHTML(tree, html) {
1619 - if (enableLazy) {
1620 - tree.html = html;
1621 - } else {
1622 - setInnerHTML(tree.node, html);
1623 - }
1624 -}
1625 -
1626 -function queueText(tree, text) {
1627 - if (enableLazy) {
1628 - tree.text = text;
1629 - } else {
1630 - setTextContent(tree.node, text);
1631 - }
1632 -}
1633 -
1634 -function toString() {
1635 - return this.node.nodeName;
1636 -}
1637 -
1638 -function DOMLazyTree(node) {
1639 - return {
1640 - node: node,
1641 - children: [],
1642 - html: null,
1643 - text: null,
1644 - toString: toString
1645 - };
1646 -}
1647 -
1648 -DOMLazyTree.insertTreeBefore = insertTreeBefore;
1649 -DOMLazyTree.replaceChildWithTree = replaceChildWithTree;
1650 -DOMLazyTree.queueChild = queueChild;
1651 -DOMLazyTree.queueHTML = queueHTML;
1652 -DOMLazyTree.queueText = queueText;
1653 -
1654 -module.exports = DOMLazyTree;
1655 -},{"10":10,"105":105,"127":127,"128":128}],10:[function(_dereq_,module,exports){
1656 -/**
1657 - * Copyright 2013-present, Facebook, Inc.
1658 - * All rights reserved.
1659 - *
1660 - * This source code is licensed under the BSD-style license found in the
1661 - * LICENSE file in the root directory of this source tree. An additional grant
1662 - * of patent rights can be found in the PATENTS file in the same directory.
1663 - *
1664 - */
1665 -
1666 -'use strict';
1667 -
1668 -var DOMNamespaces = {
1669 - html: 'http://www.w3.org/1999/xhtml',
1670 - mathml: 'http://www.w3.org/1998/Math/MathML',
1671 - svg: 'http://www.w3.org/2000/svg'
1672 -};
1673 -
1674 -module.exports = DOMNamespaces;
1675 -},{}],11:[function(_dereq_,module,exports){
1676 -/**
1677 - * Copyright 2013-present, Facebook, Inc.
1678 - * All rights reserved.
1679 - *
1680 - * This source code is licensed under the BSD-style license found in the
1681 - * LICENSE file in the root directory of this source tree. An additional grant
1682 - * of patent rights can be found in the PATENTS file in the same directory.
1683 - *
1684 - */
1685 -
1686 -'use strict';
1687 -
1688 -var _prodInvariant = _dereq_(125);
1689 -
1690 -var invariant = _dereq_(150);
1691 -
1692 -function checkMask(value, bitmask) {
1693 - return (value & bitmask) === bitmask;
1694 -}
1695 -
1696 -var DOMPropertyInjection = {
1697 - /**
1698 - * Mapping from normalized, camelcased property names to a configuration that
1699 - * specifies how the associated DOM property should be accessed or rendered.
1700 - */
1701 - MUST_USE_PROPERTY: 0x1,
1702 - HAS_BOOLEAN_VALUE: 0x4,
1703 - HAS_NUMERIC_VALUE: 0x8,
1704 - HAS_POSITIVE_NUMERIC_VALUE: 0x10 | 0x8,
1705 - HAS_OVERLOADED_BOOLEAN_VALUE: 0x20,
1706 -
1707 - /**
1708 - * Inject some specialized knowledge about the DOM. This takes a config object
1709 - * with the following properties:
1710 - *
1711 - * isCustomAttribute: function that given an attribute name will return true
1712 - * if it can be inserted into the DOM verbatim. Useful for data-* or aria-*
1713 - * attributes where it's impossible to enumerate all of the possible
1714 - * attribute names,
1715 - *
1716 - * Properties: object mapping DOM property name to one of the
1717 - * DOMPropertyInjection constants or null. If your attribute isn't in here,
1718 - * it won't get written to the DOM.
1719 - *
1720 - * DOMAttributeNames: object mapping React attribute name to the DOM
1721 - * attribute name. Attribute names not specified use the **lowercase**
1722 - * normalized name.
1723 - *
1724 - * DOMAttributeNamespaces: object mapping React attribute name to the DOM
1725 - * attribute namespace URL. (Attribute names not specified use no namespace.)
1726 - *
1727 - * DOMPropertyNames: similar to DOMAttributeNames but for DOM properties.
1728 - * Property names not specified use the normalized name.
1729 - *
1730 - * DOMMutationMethods: Properties that require special mutation methods. If
1731 - * `value` is undefined, the mutation method should unset the property.
1732 - *
1733 - * @param {object} domPropertyConfig the config as described above.
1734 - */
1735 - injectDOMPropertyConfig: function (domPropertyConfig) {
1736 - var Injection = DOMPropertyInjection;
1737 - var Properties = domPropertyConfig.Properties || {};
1738 - var DOMAttributeNamespaces = domPropertyConfig.DOMAttributeNamespaces || {};
1739 - var DOMAttributeNames = domPropertyConfig.DOMAttributeNames || {};
1740 - var DOMPropertyNames = domPropertyConfig.DOMPropertyNames || {};
1741 - var DOMMutationMethods = domPropertyConfig.DOMMutationMethods || {};
1742 -
1743 - if (domPropertyConfig.isCustomAttribute) {
1744 - DOMProperty._isCustomAttributeFunctions.push(domPropertyConfig.isCustomAttribute);
1745 - }
1746 -
1747 - for (var propName in Properties) {
1748 - !!DOMProperty.properties.hasOwnProperty(propName) ? "development" !== '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) : _prodInvariant('48', propName) : void 0;
1749 -
1750 - var lowerCased = propName.toLowerCase();
1751 - var propConfig = Properties[propName];
1752 -
1753 - var propertyInfo = {
1754 - attributeName: lowerCased,
1755 - attributeNamespace: null,
1756 - propertyName: propName,
1757 - mutationMethod: null,
1758 -
1759 - mustUseProperty: checkMask(propConfig, Injection.MUST_USE_PROPERTY),
1760 - hasBooleanValue: checkMask(propConfig, Injection.HAS_BOOLEAN_VALUE),
1761 - hasNumericValue: checkMask(propConfig, Injection.HAS_NUMERIC_VALUE),
1762 - hasPositiveNumericValue: checkMask(propConfig, Injection.HAS_POSITIVE_NUMERIC_VALUE),
1763 - hasOverloadedBooleanValue: checkMask(propConfig, Injection.HAS_OVERLOADED_BOOLEAN_VALUE)
1764 - };
1765 - !(propertyInfo.hasBooleanValue + propertyInfo.hasNumericValue + propertyInfo.hasOverloadedBooleanValue <= 1) ? "development" !== 'production' ? invariant(false, 'DOMProperty: Value can be one of boolean, overloaded boolean, or numeric value, but not a combination: %s', propName) : _prodInvariant('50', propName) : void 0;
1766 -
1767 - if ("development" !== 'production') {
1768 - DOMProperty.getPossibleStandardName[lowerCased] = propName;
1769 - }
1770 -
1771 - if (DOMAttributeNames.hasOwnProperty(propName)) {
1772 - var attributeName = DOMAttributeNames[propName];
1773 - propertyInfo.attributeName = attributeName;
1774 - if ("development" !== 'production') {
1775 - DOMProperty.getPossibleStandardName[attributeName] = propName;
1776 - }
1777 - }
1778 -
1779 - if (DOMAttributeNamespaces.hasOwnProperty(propName)) {
1780 - propertyInfo.attributeNamespace = DOMAttributeNamespaces[propName];
1781 - }
1782 -
1783 - if (DOMPropertyNames.hasOwnProperty(propName)) {
1784 - propertyInfo.propertyName = DOMPropertyNames[propName];
1785 - }
1786 -
1787 - if (DOMMutationMethods.hasOwnProperty(propName)) {
1788 - propertyInfo.mutationMethod = DOMMutationMethods[propName];
1789 - }
1790 -
1791 - DOMProperty.properties[propName] = propertyInfo;
1792 - }
1793 - }
1794 -};
1795 -
1796 -/* eslint-disable max-len */
1797 -var 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';
1798 -/* eslint-enable max-len */
1799 -
1800 -/**
1801 - * DOMProperty exports lookup objects that can be used like functions:
1802 - *
1803 - * > DOMProperty.isValid['id']
1804 - * true
1805 - * > DOMProperty.isValid['foobar']
1806 - * undefined
1807 - *
1808 - * Although this may be confusing, it performs better in general.
1809 - *
1810 - * @see http://jsperf.com/key-exists
1811 - * @see http://jsperf.com/key-missing
1812 - */
1813 -var DOMProperty = {
1814 -
1815 - ID_ATTRIBUTE_NAME: 'data-reactid',
1816 - ROOT_ATTRIBUTE_NAME: 'data-reactroot',
1817 -
1818 - ATTRIBUTE_NAME_START_CHAR: ATTRIBUTE_NAME_START_CHAR,
1819 - ATTRIBUTE_NAME_CHAR: ATTRIBUTE_NAME_START_CHAR + '\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040',
1820 -
1821 - /**
1822 - * Map from property "standard name" to an object with info about how to set
1823 - * the property in the DOM. Each object contains:
1824 - *
1825 - * attributeName:
1826 - * Used when rendering markup or with `*Attribute()`.
1827 - * attributeNamespace
1828 - * propertyName:
1829 - * Used on DOM node instances. (This includes properties that mutate due to
1830 - * external factors.)
1831 - * mutationMethod:
1832 - * If non-null, used instead of the property or `setAttribute()` after
1833 - * initial render.
1834 - * mustUseProperty:
1835 - * Whether the property must be accessed and mutated as an object property.
1836 - * hasBooleanValue:
1837 - * Whether the property should be removed when set to a falsey value.
1838 - * hasNumericValue:
1839 - * Whether the property must be numeric or parse as a numeric and should be
1840 - * removed when set to a falsey value.
1841 - * hasPositiveNumericValue:
1842 - * Whether the property must be positive numeric or parse as a positive
1843 - * numeric and should be removed when set to a falsey value.
1844 - * hasOverloadedBooleanValue:
1845 - * Whether the property can be used as a flag as well as with a value.
1846 - * Removed when strictly equal to false; present without a value when
1847 - * strictly equal to true; present with a value otherwise.
1848 - */
1849 - properties: {},
1850 -
1851 - /**
1852 - * Mapping from lowercase property names to the properly cased version, used
1853 - * to warn in the case of missing properties. Available only in __DEV__.
1854 - *
1855 - * autofocus is predefined, because adding it to the property whitelist
1856 - * causes unintended side effects.
1857 - *
1858 - * @type {Object}
1859 - */
1860 - getPossibleStandardName: "development" !== 'production' ? { autofocus: 'autoFocus' } : null,
1861 -
1862 - /**
1863 - * All of the isCustomAttribute() functions that have been injected.
1864 - */
1865 - _isCustomAttributeFunctions: [],
1866 -
1867 - /**
1868 - * Checks whether a property name is a custom attribute.
1869 - * @method
1870 - */
1871 - isCustomAttribute: function (attributeName) {
1872 - for (var i = 0; i < DOMProperty._isCustomAttributeFunctions.length; i++) {
1873 - var isCustomAttributeFn = DOMProperty._isCustomAttributeFunctions[i];
1874 - if (isCustomAttributeFn(attributeName)) {
1875 - return true;
1876 - }
1877 - }
1878 - return false;
1879 - },
1880 -
1881 - injection: DOMPropertyInjection
1882 -};
1883 -
1884 -module.exports = DOMProperty;
1885 -},{"125":125,"150":150}],12:[function(_dereq_,module,exports){
1886 -/**
1887 - * Copyright 2013-present, Facebook, Inc.
1888 - * All rights reserved.
1889 - *
1890 - * This source code is licensed under the BSD-style license found in the
1891 - * LICENSE file in the root directory of this source tree. An additional grant
1892 - * of patent rights can be found in the PATENTS file in the same directory.
1893 - *
1894 - */
1895 -
1896 -'use strict';
1897 -
1898 -var DOMProperty = _dereq_(11);
1899 -var ReactDOMComponentTree = _dereq_(34);
1900 -var ReactInstrumentation = _dereq_(64);
1901 -
1902 -var quoteAttributeValueForBrowser = _dereq_(124);
1903 -var warning = _dereq_(157);
1904 -
1905 -var VALID_ATTRIBUTE_NAME_REGEX = new RegExp('^[' + DOMProperty.ATTRIBUTE_NAME_START_CHAR + '][' + DOMProperty.ATTRIBUTE_NAME_CHAR + ']*$');
1906 -var illegalAttributeNameCache = {};
1907 -var validatedAttributeNameCache = {};
1908 -
1909 -function isAttributeNameSafe(attributeName) {
1910 - if (validatedAttributeNameCache.hasOwnProperty(attributeName)) {
1911 - return true;
1912 - }
1913 - if (illegalAttributeNameCache.hasOwnProperty(attributeName)) {
1914 - return false;
1915 - }
1916 - if (VALID_ATTRIBUTE_NAME_REGEX.test(attributeName)) {
1917 - validatedAttributeNameCache[attributeName] = true;
1918 - return true;
1919 - }
1920 - illegalAttributeNameCache[attributeName] = true;
1921 - "development" !== 'production' ? warning(false, 'Invalid attribute name: `%s`', attributeName) : void 0;
1922 - return false;
1923 -}
1924 -
1925 -function shouldIgnoreValue(propertyInfo, value) {
1926 - return value == null || propertyInfo.hasBooleanValue && !value || propertyInfo.hasNumericValue && isNaN(value) || propertyInfo.hasPositiveNumericValue && value < 1 || propertyInfo.hasOverloadedBooleanValue && value === false;
1927 -}
1928 -
1929 -/**
1930 - * Operations for dealing with DOM properties.
1931 - */
1932 -var DOMPropertyOperations = {
1933 -
1934 - /**
1935 - * Creates markup for the ID property.
1936 - *
1937 - * @param {string} id Unescaped ID.
1938 - * @return {string} Markup string.
1939 - */
1940 - createMarkupForID: function (id) {
1941 - return DOMProperty.ID_ATTRIBUTE_NAME + '=' + quoteAttributeValueForBrowser(id);
1942 - },
1943 -
1944 - setAttributeForID: function (node, id) {
1945 - node.setAttribute(DOMProperty.ID_ATTRIBUTE_NAME, id);
1946 - },
1947 -
1948 - createMarkupForRoot: function () {
1949 - return DOMProperty.ROOT_ATTRIBUTE_NAME + '=""';
1950 - },
1951 -
1952 - setAttributeForRoot: function (node) {
1953 - node.setAttribute(DOMProperty.ROOT_ATTRIBUTE_NAME, '');
1954 - },
1955 -
1956 - /**
1957 - * Creates markup for a property.
1958 - *
1959 - * @param {string} name
1960 - * @param {*} value
1961 - * @return {?string} Markup string, or null if the property was invalid.
1962 - */
1963 - createMarkupForProperty: function (name, value) {
1964 - var propertyInfo = DOMProperty.properties.hasOwnProperty(name) ? DOMProperty.properties[name] : null;
1965 - if (propertyInfo) {
1966 - if (shouldIgnoreValue(propertyInfo, value)) {
1967 - return '';
1968 - }
1969 - var attributeName = propertyInfo.attributeName;
1970 - if (propertyInfo.hasBooleanValue || propertyInfo.hasOverloadedBooleanValue && value === true) {
1971 - return attributeName + '=""';
1972 - }
1973 - return attributeName + '=' + quoteAttributeValueForBrowser(value);
1974 - } else if (DOMProperty.isCustomAttribute(name)) {
1975 - if (value == null) {
1976 - return '';
1977 - }
1978 - return name + '=' + quoteAttributeValueForBrowser(value);
1979 - }
1980 - return null;
1981 - },
1982 -
1983 - /**
1984 - * Creates markup for a custom property.
1985 - *
1986 - * @param {string} name
1987 - * @param {*} value
1988 - * @return {string} Markup string, or empty string if the property was invalid.
1989 - */
1990 - createMarkupForCustomAttribute: function (name, value) {
1991 - if (!isAttributeNameSafe(name) || value == null) {
1992 - return '';
1993 - }
1994 - return name + '=' + quoteAttributeValueForBrowser(value);
1995 - },
1996 -
1997 - /**
1998 - * Sets the value for a property on a node.
1999 - *
2000 - * @param {DOMElement} node
2001 - * @param {string} name
2002 - * @param {*} value
2003 - */
2004 - setValueForProperty: function (node, name, value) {
2005 - var propertyInfo = DOMProperty.properties.hasOwnProperty(name) ? DOMProperty.properties[name] : null;
2006 - if (propertyInfo) {
2007 - var mutationMethod = propertyInfo.mutationMethod;
2008 - if (mutationMethod) {
2009 - mutationMethod(node, value);
2010 - } else if (shouldIgnoreValue(propertyInfo, value)) {
2011 - this.deleteValueForProperty(node, name);
2012 - return;
2013 - } else if (propertyInfo.mustUseProperty) {
2014 - // Contrary to `setAttribute`, object properties are properly
2015 - // `toString`ed by IE8/9.
2016 - node[propertyInfo.propertyName] = value;
2017 - } else {
2018 - var attributeName = propertyInfo.attributeName;
2019 - var namespace = propertyInfo.attributeNamespace;
2020 - // `setAttribute` with objects becomes only `[object]` in IE8/9,
2021 - // ('' + value) makes it output the correct toString()-value.
2022 - if (namespace) {
2023 - node.setAttributeNS(namespace, attributeName, '' + value);
2024 - } else if (propertyInfo.hasBooleanValue || propertyInfo.hasOverloadedBooleanValue && value === true) {
2025 - node.setAttribute(attributeName, '');
2026 - } else {
2027 - node.setAttribute(attributeName, '' + value);
2028 - }
2029 - }
2030 - } else if (DOMProperty.isCustomAttribute(name)) {
2031 - DOMPropertyOperations.setValueForAttribute(node, name, value);
2032 - return;
2033 - }
2034 -
2035 - if ("development" !== 'production') {
2036 - var payload = {};
2037 - payload[name] = value;
2038 - ReactInstrumentation.debugTool.onHostOperation({
2039 - instanceID: ReactDOMComponentTree.getInstanceFromNode(node)._debugID,
2040 - type: 'update attribute',
2041 - payload: payload
2042 - });
2043 - }
2044 - },
2045 -
2046 - setValueForAttribute: function (node, name, value) {
2047 - if (!isAttributeNameSafe(name)) {
2048 - return;
2049 - }
2050 - if (value == null) {
2051 - node.removeAttribute(name);
2052 - } else {
2053 - node.setAttribute(name, '' + value);
2054 - }
2055 -
2056 - if ("development" !== 'production') {
2057 - var payload = {};
2058 - payload[name] = value;
2059 - ReactInstrumentation.debugTool.onHostOperation({
2060 - instanceID: ReactDOMComponentTree.getInstanceFromNode(node)._debugID,
2061 - type: 'update attribute',
2062 - payload: payload
2063 - });
2064 - }
2065 - },
2066 -
2067 - /**
2068 - * Deletes an attributes from a node.
2069 - *
2070 - * @param {DOMElement} node
2071 - * @param {string} name
2072 - */
2073 - deleteValueForAttribute: function (node, name) {
2074 - node.removeAttribute(name);
2075 - if ("development" !== 'production') {
2076 - ReactInstrumentation.debugTool.onHostOperation({
2077 - instanceID: ReactDOMComponentTree.getInstanceFromNode(node)._debugID,
2078 - type: 'remove attribute',
2079 - payload: name
2080 - });
2081 - }
2082 - },
2083 -
2084 - /**
2085 - * Deletes the value for a property on a node.
2086 - *
2087 - * @param {DOMElement} node
2088 - * @param {string} name
2089 - */
2090 - deleteValueForProperty: function (node, name) {
2091 - var propertyInfo = DOMProperty.properties.hasOwnProperty(name) ? DOMProperty.properties[name] : null;
2092 - if (propertyInfo) {
2093 - var mutationMethod = propertyInfo.mutationMethod;
2094 - if (mutationMethod) {
2095 - mutationMethod(node, undefined);
2096 - } else if (propertyInfo.mustUseProperty) {
2097 - var propName = propertyInfo.propertyName;
2098 - if (propertyInfo.hasBooleanValue) {
2099 - node[propName] = false;
2100 - } else {
2101 - node[propName] = '';
2102 - }
2103 - } else {
2104 - node.removeAttribute(propertyInfo.attributeName);
2105 - }
2106 - } else if (DOMProperty.isCustomAttribute(name)) {
2107 - node.removeAttribute(name);
2108 - }
2109 -
2110 - if ("development" !== 'production') {
2111 - ReactInstrumentation.debugTool.onHostOperation({
2112 - instanceID: ReactDOMComponentTree.getInstanceFromNode(node)._debugID,
2113 - type: 'remove attribute',
2114 - payload: name
2115 - });
2116 - }
2117 - }
2118 -
2119 -};
2120 -
2121 -module.exports = DOMPropertyOperations;
2122 -},{"11":11,"124":124,"157":157,"34":34,"64":64}],13:[function(_dereq_,module,exports){
2123 -/**
2124 - * Copyright 2013-present, Facebook, Inc.
2125 - * All rights reserved.
2126 - *
2127 - * This source code is licensed under the BSD-style license found in the
2128 - * LICENSE file in the root directory of this source tree. An additional grant
2129 - * of patent rights can be found in the PATENTS file in the same directory.
2130 - *
2131 - */
2132 -
2133 -'use strict';
2134 -
2135 -var _prodInvariant = _dereq_(125);
2136 -
2137 -var DOMLazyTree = _dereq_(9);
2138 -var ExecutionEnvironment = _dereq_(136);
2139 -
2140 -var createNodesFromMarkup = _dereq_(141);
2141 -var emptyFunction = _dereq_(142);
2142 -var invariant = _dereq_(150);
2143 -
2144 -var Danger = {
2145 -
2146 - /**
2147 - * Replaces a node with a string of markup at its current position within its
2148 - * parent. The markup must render into a single root node.
2149 - *
2150 - * @param {DOMElement} oldChild Child node to replace.
2151 - * @param {string} markup Markup to render in place of the child node.
2152 - * @internal
2153 - */
2154 - dangerouslyReplaceNodeWithMarkup: function (oldChild, markup) {
2155 - !ExecutionEnvironment.canUseDOM ? "development" !== '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.') : _prodInvariant('56') : void 0;
2156 - !markup ? "development" !== 'production' ? invariant(false, 'dangerouslyReplaceNodeWithMarkup(...): Missing markup.') : _prodInvariant('57') : void 0;
2157 - !(oldChild.nodeName !== 'HTML') ? "development" !== '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().') : _prodInvariant('58') : void 0;
2158 -
2159 - if (typeof markup === 'string') {
2160 - var newChild = createNodesFromMarkup(markup, emptyFunction)[0];
2161 - oldChild.parentNode.replaceChild(newChild, oldChild);
2162 - } else {
2163 - DOMLazyTree.replaceChildWithTree(oldChild, markup);
2164 - }
2165 - }
2166 -
2167 -};
2168 -
2169 -module.exports = Danger;
2170 -},{"125":125,"136":136,"141":141,"142":142,"150":150,"9":9}],14:[function(_dereq_,module,exports){
2171 -/**
2172 - * Copyright 2013-present, Facebook, Inc.
2173 - * All rights reserved.
2174 - *
2175 - * This source code is licensed under the BSD-style license found in the
2176 - * LICENSE file in the root directory of this source tree. An additional grant
2177 - * of patent rights can be found in the PATENTS file in the same directory.
2178 - *
2179 - */
2180 -
2181 -'use strict';
2182 -
2183 -/**
2184 - * Module that is injectable into `EventPluginHub`, that specifies a
2185 - * deterministic ordering of `EventPlugin`s. A convenient way to reason about
2186 - * plugins, without having to package every one of them. This is better than
2187 - * having plugins be ordered in the same order that they are injected because
2188 - * that ordering would be influenced by the packaging order.
2189 - * `ResponderEventPlugin` must occur before `SimpleEventPlugin` so that
2190 - * preventing default on events is convenient in `SimpleEventPlugin` handlers.
2191 - */
2192 -
2193 -var DefaultEventPluginOrder = ['ResponderEventPlugin', 'SimpleEventPlugin', 'TapEventPlugin', 'EnterLeaveEventPlugin', 'ChangeEventPlugin', 'SelectEventPlugin', 'BeforeInputEventPlugin'];
2194 -
2195 -module.exports = DefaultEventPluginOrder;
2196 -},{}],15:[function(_dereq_,module,exports){
2197 -/**
2198 - * Copyright 2013-present, Facebook, Inc.
2199 - * All rights reserved.
2200 - *
2201 - * This source code is licensed under the BSD-style license found in the
2202 - * LICENSE file in the root directory of this source tree. An additional grant
2203 - * of patent rights can be found in the PATENTS file in the same directory.
2204 - *
2205 - */
2206 -
2207 -'use strict';
2208 -
2209 -var EventPropagators = _dereq_(20);
2210 -var ReactDOMComponentTree = _dereq_(34);
2211 -var SyntheticMouseEvent = _dereq_(95);
2212 -
2213 -var eventTypes = {
2214 - mouseEnter: {
2215 - registrationName: 'onMouseEnter',
2216 - dependencies: ['topMouseOut', 'topMouseOver']
2217 - },
2218 - mouseLeave: {
2219 - registrationName: 'onMouseLeave',
2220 - dependencies: ['topMouseOut', 'topMouseOver']
2221 - }
2222 -};
2223 -
2224 -var EnterLeaveEventPlugin = {
2225 -
2226 - eventTypes: eventTypes,
2227 -
2228 - /**
2229 - * For almost every interaction we care about, there will be both a top-level
2230 - * `mouseover` and `mouseout` event that occurs. Only use `mouseout` so that
2231 - * we do not extract duplicate events. However, moving the mouse into the
2232 - * browser from outside will not fire a `mouseout` event. In this case, we use
2233 - * the `mouseover` top-level event.
2234 - */
2235 - extractEvents: function (topLevelType, targetInst, nativeEvent, nativeEventTarget) {
2236 - if (topLevelType === 'topMouseOver' && (nativeEvent.relatedTarget || nativeEvent.fromElement)) {
2237 - return null;
2238 - }
2239 - if (topLevelType !== 'topMouseOut' && topLevelType !== 'topMouseOver') {
2240 - // Must not be a mouse in or mouse out - ignoring.
2241 - return null;
2242 - }
2243 -
2244 - var win;
2245 - if (nativeEventTarget.window === nativeEventTarget) {
2246 - // `nativeEventTarget` is probably a window object.
2247 - win = nativeEventTarget;
2248 - } else {
2249 - // TODO: Figure out why `ownerDocument` is sometimes undefined in IE8.
2250 - var doc = nativeEventTarget.ownerDocument;
2251 - if (doc) {
2252 - win = doc.defaultView || doc.parentWindow;
2253 - } else {
2254 - win = window;
2255 - }
2256 - }
2257 -
2258 - var from;
2259 - var to;
2260 - if (topLevelType === 'topMouseOut') {
2261 - from = targetInst;
2262 - var related = nativeEvent.relatedTarget || nativeEvent.toElement;
2263 - to = related ? ReactDOMComponentTree.getClosestInstanceFromNode(related) : null;
2264 - } else {
2265 - // Moving to a node from outside the window.
2266 - from = null;
2267 - to = targetInst;
2268 - }
2269 -
2270 - if (from === to) {
2271 - // Nothing pertains to our managed components.
2272 - return null;
2273 - }
2274 -
2275 - var fromNode = from == null ? win : ReactDOMComponentTree.getNodeFromInstance(from);
2276 - var toNode = to == null ? win : ReactDOMComponentTree.getNodeFromInstance(to);
2277 -
2278 - var leave = SyntheticMouseEvent.getPooled(eventTypes.mouseLeave, from, nativeEvent, nativeEventTarget);
2279 - leave.type = 'mouseleave';
2280 - leave.target = fromNode;
2281 - leave.relatedTarget = toNode;
2282 -
2283 - var enter = SyntheticMouseEvent.getPooled(eventTypes.mouseEnter, to, nativeEvent, nativeEventTarget);
2284 - enter.type = 'mouseenter';
2285 - enter.target = toNode;
2286 - enter.relatedTarget = fromNode;
2287 -
2288 - EventPropagators.accumulateEnterLeaveDispatches(leave, enter, from, to);
2289 -
2290 - return [leave, enter];
2291 - }
2292 -
2293 -};
2294 -
2295 -module.exports = EnterLeaveEventPlugin;
2296 -},{"20":20,"34":34,"95":95}],16:[function(_dereq_,module,exports){
2297 -/**
2298 - * Copyright 2013-present, Facebook, Inc.
2299 - * All rights reserved.
2300 - *
2301 - * This source code is licensed under the BSD-style license found in the
2302 - * LICENSE file in the root directory of this source tree. An additional grant
2303 - * of patent rights can be found in the PATENTS file in the same directory.
2304 - *
2305 - */
2306 -
2307 -'use strict';
2308 -
2309 -/**
2310 - * Types of raw signals from the browser caught at the top level.
2311 - */
2312 -var topLevelTypes = {
2313 - topAbort: null,
2314 - topAnimationEnd: null,
2315 - topAnimationIteration: null,
2316 - topAnimationStart: null,
2317 - topBlur: null,
2318 - topCanPlay: null,
2319 - topCanPlayThrough: null,
2320 - topChange: null,
2321 - topClick: null,
2322 - topCompositionEnd: null,
2323 - topCompositionStart: null,
2324 - topCompositionUpdate: null,
2325 - topContextMenu: null,
2326 - topCopy: null,
2327 - topCut: null,
2328 - topDoubleClick: null,
2329 - topDrag: null,
2330 - topDragEnd: null,
2331 - topDragEnter: null,
2332 - topDragExit: null,
2333 - topDragLeave: null,
2334 - topDragOver: null,
2335 - topDragStart: null,
2336 - topDrop: null,
2337 - topDurationChange: null,
2338 - topEmptied: null,
2339 - topEncrypted: null,
2340 - topEnded: null,
2341 - topError: null,
2342 - topFocus: null,
2343 - topInput: null,
2344 - topInvalid: null,
2345 - topKeyDown: null,
2346 - topKeyPress: null,
2347 - topKeyUp: null,
2348 - topLoad: null,
2349 - topLoadedData: null,
2350 - topLoadedMetadata: null,
2351 - topLoadStart: null,
2352 - topMouseDown: null,
2353 - topMouseMove: null,
2354 - topMouseOut: null,
2355 - topMouseOver: null,
2356 - topMouseUp: null,
2357 - topPaste: null,
2358 - topPause: null,
2359 - topPlay: null,
2360 - topPlaying: null,
2361 - topProgress: null,
2362 - topRateChange: null,
2363 - topReset: null,
2364 - topScroll: null,
2365 - topSeeked: null,
2366 - topSeeking: null,
2367 - topSelectionChange: null,
2368 - topStalled: null,
2369 - topSubmit: null,
2370 - topSuspend: null,
2371 - topTextInput: null,
2372 - topTimeUpdate: null,
2373 - topTouchCancel: null,
2374 - topTouchEnd: null,
2375 - topTouchMove: null,
2376 - topTouchStart: null,
2377 - topTransitionEnd: null,
2378 - topVolumeChange: null,
2379 - topWaiting: null,
2380 - topWheel: null
2381 -};
2382 -
2383 -var EventConstants = {
2384 - topLevelTypes: topLevelTypes
2385 -};
2386 -
2387 -module.exports = EventConstants;
2388 -},{}],17:[function(_dereq_,module,exports){
2389 -/**
2390 - * Copyright 2013-present, Facebook, Inc.
2391 - * All rights reserved.
2392 - *
2393 - * This source code is licensed under the BSD-style license found in the
2394 - * LICENSE file in the root directory of this source tree. An additional grant
2395 - * of patent rights can be found in the PATENTS file in the same directory.
2396 - *
2397 - */
2398 -
2399 -'use strict';
2400 -
2401 -var _prodInvariant = _dereq_(125);
2402 -
2403 -var EventPluginRegistry = _dereq_(18);
2404 -var EventPluginUtils = _dereq_(19);
2405 -var ReactErrorUtils = _dereq_(55);
2406 -
2407 -var accumulateInto = _dereq_(102);
2408 -var forEachAccumulated = _dereq_(110);
2409 -var invariant = _dereq_(150);
2410 -
2411 -/**
2412 - * Internal store for event listeners
2413 - */
2414 -var listenerBank = {};
2415 -
2416 -/**
2417 - * Internal queue of events that have accumulated their dispatches and are
2418 - * waiting to have their dispatches executed.
2419 - */
2420 -var eventQueue = null;
2421 -
2422 -/**
2423 - * Dispatches an event and releases it back into the pool, unless persistent.
2424 - *
2425 - * @param {?object} event Synthetic event to be dispatched.
2426 - * @param {boolean} simulated If the event is simulated (changes exn behavior)
2427 - * @private
2428 - */
2429 -var executeDispatchesAndRelease = function (event, simulated) {
2430 - if (event) {
2431 - EventPluginUtils.executeDispatchesInOrder(event, simulated);
2432 -
2433 - if (!event.isPersistent()) {
2434 - event.constructor.release(event);
2435 - }
2436 - }
2437 -};
2438 -var executeDispatchesAndReleaseSimulated = function (e) {
2439 - return executeDispatchesAndRelease(e, true);
2440 -};
2441 -var executeDispatchesAndReleaseTopLevel = function (e) {
2442 - return executeDispatchesAndRelease(e, false);
2443 -};
2444 -
2445 -var getDictionaryKey = function (inst) {
2446 - // Prevents V8 performance issue:
2447 - // https://github.com/facebook/react/pull/7232
2448 - return '.' + inst._rootNodeID;
2449 -};
2450 -
2451 -/**
2452 - * This is a unified interface for event plugins to be installed and configured.
2453 - *
2454 - * Event plugins can implement the following properties:
2455 - *
2456 - * `extractEvents` {function(string, DOMEventTarget, string, object): *}
2457 - * Required. When a top-level event is fired, this method is expected to
2458 - * extract synthetic events that will in turn be queued and dispatched.
2459 - *
2460 - * `eventTypes` {object}
2461 - * Optional, plugins that fire events must publish a mapping of registration
2462 - * names that are used to register listeners. Values of this mapping must
2463 - * be objects that contain `registrationName` or `phasedRegistrationNames`.
2464 - *
2465 - * `executeDispatch` {function(object, function, string)}
2466 - * Optional, allows plugins to override how an event gets dispatched. By
2467 - * default, the listener is simply invoked.
2468 - *
2469 - * Each plugin that is injected into `EventsPluginHub` is immediately operable.
2470 - *
2471 - * @public
2472 - */
2473 -var EventPluginHub = {
2474 -
2475 - /**
2476 - * Methods for injecting dependencies.
2477 - */
2478 - injection: {
2479 -
2480 - /**
2481 - * @param {array} InjectedEventPluginOrder
2482 - * @public
2483 - */
2484 - injectEventPluginOrder: EventPluginRegistry.injectEventPluginOrder,
2485 -
2486 - /**
2487 - * @param {object} injectedNamesToPlugins Map from names to plugin modules.
2488 - */
2489 - injectEventPluginsByName: EventPluginRegistry.injectEventPluginsByName
2490 -
2491 - },
2492 -
2493 - /**
2494 - * Stores `listener` at `listenerBank[registrationName][key]`. Is idempotent.
2495 - *
2496 - * @param {object} inst The instance, which is the source of events.
2497 - * @param {string} registrationName Name of listener (e.g. `onClick`).
2498 - * @param {function} listener The callback to store.
2499 - */
2500 - putListener: function (inst, registrationName, listener) {
2501 - !(typeof listener === 'function') ? "development" !== 'production' ? invariant(false, 'Expected %s listener to be a function, instead got type %s', registrationName, typeof listener) : _prodInvariant('94', registrationName, typeof listener) : void 0;
2502 -
2503 - var key = getDictionaryKey(inst);
2504 - var bankForRegistrationName = listenerBank[registrationName] || (listenerBank[registrationName] = {});
2505 - bankForRegistrationName[key] = listener;
2506 -
2507 - var PluginModule = EventPluginRegistry.registrationNameModules[registrationName];
2508 - if (PluginModule && PluginModule.didPutListener) {
2509 - PluginModule.didPutListener(inst, registrationName, listener);
2510 - }
2511 - },
2512 -
2513 - /**
2514 - * @param {object} inst The instance, which is the source of events.
2515 - * @param {string} registrationName Name of listener (e.g. `onClick`).
2516 - * @return {?function} The stored callback.
2517 - */
2518 - getListener: function (inst, registrationName) {
2519 - var bankForRegistrationName = listenerBank[registrationName];
2520 - var key = getDictionaryKey(inst);
2521 - return bankForRegistrationName && bankForRegistrationName[key];
2522 - },
2523 -
2524 - /**
2525 - * Deletes a listener from the registration bank.
2526 - *
2527 - * @param {object} inst The instance, which is the source of events.
2528 - * @param {string} registrationName Name of listener (e.g. `onClick`).
2529 - */
2530 - deleteListener: function (inst, registrationName) {
2531 - var PluginModule = EventPluginRegistry.registrationNameModules[registrationName];
2532 - if (PluginModule && PluginModule.willDeleteListener) {
2533 - PluginModule.willDeleteListener(inst, registrationName);
2534 - }
2535 -
2536 - var bankForRegistrationName = listenerBank[registrationName];
2537 - // TODO: This should never be null -- when is it?
2538 - if (bankForRegistrationName) {
2539 - var key = getDictionaryKey(inst);
2540 - delete bankForRegistrationName[key];
2541 - }
2542 - },
2543 -
2544 - /**
2545 - * Deletes all listeners for the DOM element with the supplied ID.
2546 - *
2547 - * @param {object} inst The instance, which is the source of events.
2548 - */
2549 - deleteAllListeners: function (inst) {
2550 - var key = getDictionaryKey(inst);
2551 - for (var registrationName in listenerBank) {
2552 - if (!listenerBank.hasOwnProperty(registrationName)) {
2553 - continue;
2554 - }
2555 -
2556 - if (!listenerBank[registrationName][key]) {
2557 - continue;
2558 - }
2559 -
2560 - var PluginModule = EventPluginRegistry.registrationNameModules[registrationName];
2561 - if (PluginModule && PluginModule.willDeleteListener) {
2562 - PluginModule.willDeleteListener(inst, registrationName);
2563 - }
2564 -
2565 - delete listenerBank[registrationName][key];
2566 - }
2567 - },
2568 -
2569 - /**
2570 - * Allows registered plugins an opportunity to extract events from top-level
2571 - * native browser events.
2572 - *
2573 - * @return {*} An accumulation of synthetic events.
2574 - * @internal
2575 - */
2576 - extractEvents: function (topLevelType, targetInst, nativeEvent, nativeEventTarget) {
2577 - var events;
2578 - var plugins = EventPluginRegistry.plugins;
2579 - for (var i = 0; i < plugins.length; i++) {
2580 - // Not every plugin in the ordering may be loaded at runtime.
2581 - var possiblePlugin = plugins[i];
2582 - if (possiblePlugin) {
2583 - var extractedEvents = possiblePlugin.extractEvents(topLevelType, targetInst, nativeEvent, nativeEventTarget);
2584 - if (extractedEvents) {
2585 - events = accumulateInto(events, extractedEvents);
2586 - }
2587 - }
2588 - }
2589 - return events;
2590 - },
2591 -
2592 - /**
2593 - * Enqueues a synthetic event that should be dispatched when
2594 - * `processEventQueue` is invoked.
2595 - *
2596 - * @param {*} events An accumulation of synthetic events.
2597 - * @internal
2598 - */
2599 - enqueueEvents: function (events) {
2600 - if (events) {
2601 - eventQueue = accumulateInto(eventQueue, events);
2602 - }
2603 - },
2604 -
2605 - /**
2606 - * Dispatches all synthetic events on the event queue.
2607 - *
2608 - * @internal
2609 - */
2610 - processEventQueue: function (simulated) {
2611 - // Set `eventQueue` to null before processing it so that we can tell if more
2612 - // events get enqueued while processing.
2613 - var processingEventQueue = eventQueue;
2614 - eventQueue = null;
2615 - if (simulated) {
2616 - forEachAccumulated(processingEventQueue, executeDispatchesAndReleaseSimulated);
2617 - } else {
2618 - forEachAccumulated(processingEventQueue, executeDispatchesAndReleaseTopLevel);
2619 - }
2620 - !!eventQueue ? "development" !== 'production' ? invariant(false, 'processEventQueue(): Additional events were enqueued while processing an event queue. Support for this has not yet been implemented.') : _prodInvariant('95') : void 0;
2621 - // This would be a good time to rethrow if any of the event handlers threw.
2622 - ReactErrorUtils.rethrowCaughtError();
2623 - },
2624 -
2625 - /**
2626 - * These are needed for tests only. Do not use!
2627 - */
2628 - __purge: function () {
2629 - listenerBank = {};
2630 - },
2631 -
2632 - __getListenerBank: function () {
2633 - return listenerBank;
2634 - }
2635 -
2636 -};
2637 -
2638 -module.exports = EventPluginHub;
2639 -},{"102":102,"110":110,"125":125,"150":150,"18":18,"19":19,"55":55}],18:[function(_dereq_,module,exports){
2640 -/**
2641 - * Copyright 2013-present, Facebook, Inc.
2642 - * All rights reserved.
2643 - *
2644 - * This source code is licensed under the BSD-style license found in the
2645 - * LICENSE file in the root directory of this source tree. An additional grant
2646 - * of patent rights can be found in the PATENTS file in the same directory.
2647 - *
2648 - *
2649 - */
2650 -
2651 -'use strict';
2652 -
2653 -var _prodInvariant = _dereq_(125);
2654 -
2655 -var invariant = _dereq_(150);
2656 -
2657 -/**
2658 - * Injectable ordering of event plugins.
2659 - */
2660 -var eventPluginOrder = null;
2661 -
2662 -/**
2663 - * Injectable mapping from names to event plugin modules.
2664 - */
2665 -var namesToPlugins = {};
2666 -
2667 -/**
2668 - * Recomputes the plugin list using the injected plugins and plugin ordering.
2669 - *
2670 - * @private
2671 - */
2672 -function recomputePluginOrdering() {
2673 - if (!eventPluginOrder) {
2674 - // Wait until an `eventPluginOrder` is injected.
2675 - return;
2676 - }
2677 - for (var pluginName in namesToPlugins) {
2678 - var pluginModule = namesToPlugins[pluginName];
2679 - var pluginIndex = eventPluginOrder.indexOf(pluginName);
2680 - !(pluginIndex > -1) ? "development" !== 'production' ? invariant(false, 'EventPluginRegistry: Cannot inject event plugins that do not exist in the plugin ordering, `%s`.', pluginName) : _prodInvariant('96', pluginName) : void 0;
2681 - if (EventPluginRegistry.plugins[pluginIndex]) {
2682 - continue;
2683 - }
2684 - !pluginModule.extractEvents ? "development" !== 'production' ? invariant(false, 'EventPluginRegistry: Event plugins must implement an `extractEvents` method, but `%s` does not.', pluginName) : _prodInvariant('97', pluginName) : void 0;
2685 - EventPluginRegistry.plugins[pluginIndex] = pluginModule;
2686 - var publishedEvents = pluginModule.eventTypes;
2687 - for (var eventName in publishedEvents) {
2688 - !publishEventForPlugin(publishedEvents[eventName], pluginModule, eventName) ? "development" !== 'production' ? invariant(false, 'EventPluginRegistry: Failed to publish event `%s` for plugin `%s`.', eventName, pluginName) : _prodInvariant('98', eventName, pluginName) : void 0;
2689 - }
2690 - }
2691 -}
2692 -
2693 -/**
2694 - * Publishes an event so that it can be dispatched by the supplied plugin.
2695 - *
2696 - * @param {object} dispatchConfig Dispatch configuration for the event.
2697 - * @param {object} PluginModule Plugin publishing the event.
2698 - * @return {boolean} True if the event was successfully published.
2699 - * @private
2700 - */
2701 -function publishEventForPlugin(dispatchConfig, pluginModule, eventName) {
2702 - !!EventPluginRegistry.eventNameDispatchConfigs.hasOwnProperty(eventName) ? "development" !== 'production' ? invariant(false, 'EventPluginHub: More than one plugin attempted to publish the same event name, `%s`.', eventName) : _prodInvariant('99', eventName) : void 0;
2703 - EventPluginRegistry.eventNameDispatchConfigs[eventName] = dispatchConfig;
2704 -
2705 - var phasedRegistrationNames = dispatchConfig.phasedRegistrationNames;
2706 - if (phasedRegistrationNames) {
2707 - for (var phaseName in phasedRegistrationNames) {
2708 - if (phasedRegistrationNames.hasOwnProperty(phaseName)) {
2709 - var phasedRegistrationName = phasedRegistrationNames[phaseName];
2710 - publishRegistrationName(phasedRegistrationName, pluginModule, eventName);
2711 - }
2712 - }
2713 - return true;
2714 - } else if (dispatchConfig.registrationName) {
2715 - publishRegistrationName(dispatchConfig.registrationName, pluginModule, eventName);
2716 - return true;
2717 - }
2718 - return false;
2719 -}
2720 -
2721 -/**
2722 - * Publishes a registration name that is used to identify dispatched events and
2723 - * can be used with `EventPluginHub.putListener` to register listeners.
2724 - *
2725 - * @param {string} registrationName Registration name to add.
2726 - * @param {object} PluginModule Plugin publishing the event.
2727 - * @private
2728 - */
2729 -function publishRegistrationName(registrationName, pluginModule, eventName) {
2730 - !!EventPluginRegistry.registrationNameModules[registrationName] ? "development" !== 'production' ? invariant(false, 'EventPluginHub: More than one plugin attempted to publish the same registration name, `%s`.', registrationName) : _prodInvariant('100', registrationName) : void 0;
2731 - EventPluginRegistry.registrationNameModules[registrationName] = pluginModule;
2732 - EventPluginRegistry.registrationNameDependencies[registrationName] = pluginModule.eventTypes[eventName].dependencies;
2733 -
2734 - if ("development" !== 'production') {
2735 - var lowerCasedName = registrationName.toLowerCase();
2736 - EventPluginRegistry.possibleRegistrationNames[lowerCasedName] = registrationName;
2737 -
2738 - if (registrationName === 'onDoubleClick') {
2739 - EventPluginRegistry.possibleRegistrationNames.ondblclick = registrationName;
2740 - }
2741 - }
2742 -}
2743 -
2744 -/**
2745 - * Registers plugins so that they can extract and dispatch events.
2746 - *
2747 - * @see {EventPluginHub}
2748 - */
2749 -var EventPluginRegistry = {
2750 -
2751 - /**
2752 - * Ordered list of injected plugins.
2753 - */
2754 - plugins: [],
2755 -
2756 - /**
2757 - * Mapping from event name to dispatch config
2758 - */
2759 - eventNameDispatchConfigs: {},
2760 -
2761 - /**
2762 - * Mapping from registration name to plugin module
2763 - */
2764 - registrationNameModules: {},
2765 -
2766 - /**
2767 - * Mapping from registration name to event name
2768 - */
2769 - registrationNameDependencies: {},
2770 -
2771 - /**
2772 - * Mapping from lowercase registration names to the properly cased version,
2773 - * used to warn in the case of missing event handlers. Available
2774 - * only in __DEV__.
2775 - * @type {Object}
2776 - */
2777 - possibleRegistrationNames: "development" !== 'production' ? {} : null,
2778 - // Trust the developer to only use possibleRegistrationNames in __DEV__
2779 -
2780 - /**
2781 - * Injects an ordering of plugins (by plugin name). This allows the ordering
2782 - * to be decoupled from injection of the actual plugins so that ordering is
2783 - * always deterministic regardless of packaging, on-the-fly injection, etc.
2784 - *
2785 - * @param {array} InjectedEventPluginOrder
2786 - * @internal
2787 - * @see {EventPluginHub.injection.injectEventPluginOrder}
2788 - */
2789 - injectEventPluginOrder: function (injectedEventPluginOrder) {
2790 - !!eventPluginOrder ? "development" !== 'production' ? invariant(false, 'EventPluginRegistry: Cannot inject event plugin ordering more than once. You are likely trying to load more than one copy of React.') : _prodInvariant('101') : void 0;
2791 - // Clone the ordering so it cannot be dynamically mutated.
2792 - eventPluginOrder = Array.prototype.slice.call(injectedEventPluginOrder);
2793 - recomputePluginOrdering();
2794 - },
2795 -
2796 - /**
2797 - * Injects plugins to be used by `EventPluginHub`. The plugin names must be
2798 - * in the ordering injected by `injectEventPluginOrder`.
2799 - *
2800 - * Plugins can be injected as part of page initialization or on-the-fly.
2801 - *
2802 - * @param {object} injectedNamesToPlugins Map from names to plugin modules.
2803 - * @internal
2804 - * @see {EventPluginHub.injection.injectEventPluginsByName}
2805 - */
2806 - injectEventPluginsByName: function (injectedNamesToPlugins) {
2807 - var isOrderingDirty = false;
2808 - for (var pluginName in injectedNamesToPlugins) {
2809 - if (!injectedNamesToPlugins.hasOwnProperty(pluginName)) {
2810 - continue;
2811 - }
2812 - var pluginModule = injectedNamesToPlugins[pluginName];
2813 - if (!namesToPlugins.hasOwnProperty(pluginName) || namesToPlugins[pluginName] !== pluginModule) {
2814 - !!namesToPlugins[pluginName] ? "development" !== 'production' ? invariant(false, 'EventPluginRegistry: Cannot inject two different event plugins using the same name, `%s`.', pluginName) : _prodInvariant('102', pluginName) : void 0;
2815 - namesToPlugins[pluginName] = pluginModule;
2816 - isOrderingDirty = true;
2817 - }
2818 - }
2819 - if (isOrderingDirty) {
2820 - recomputePluginOrdering();
2821 - }
2822 - },
2823 -
2824 - /**
2825 - * Looks up the plugin for the supplied event.
2826 - *
2827 - * @param {object} event A synthetic event.
2828 - * @return {?object} The plugin that created the supplied event.
2829 - * @internal
2830 - */
2831 - getPluginModuleForEvent: function (event) {
2832 - var dispatchConfig = event.dispatchConfig;
2833 - if (dispatchConfig.registrationName) {
2834 - return EventPluginRegistry.registrationNameModules[dispatchConfig.registrationName] || null;
2835 - }
2836 - if (dispatchConfig.phasedRegistrationNames !== undefined) {
2837 - // pulling phasedRegistrationNames out of dispatchConfig helps Flow see
2838 - // that it is not undefined.
2839 - var phasedRegistrationNames = dispatchConfig.phasedRegistrationNames;
2840 -
2841 - for (var phase in phasedRegistrationNames) {
2842 - if (!phasedRegistrationNames.hasOwnProperty(phase)) {
2843 - continue;
2844 - }
2845 - var pluginModule = EventPluginRegistry.registrationNameModules[phasedRegistrationNames[phase]];
2846 - if (pluginModule) {
2847 - return pluginModule;
2848 - }
2849 - }
2850 - }
2851 - return null;
2852 - },
2853 -
2854 - /**
2855 - * Exposed for unit testing.
2856 - * @private
2857 - */
2858 - _resetEventPlugins: function () {
2859 - eventPluginOrder = null;
2860 - for (var pluginName in namesToPlugins) {
2861 - if (namesToPlugins.hasOwnProperty(pluginName)) {
2862 - delete namesToPlugins[pluginName];
2863 - }
2864 - }
2865 - EventPluginRegistry.plugins.length = 0;
2866 -
2867 - var eventNameDispatchConfigs = EventPluginRegistry.eventNameDispatchConfigs;
2868 - for (var eventName in eventNameDispatchConfigs) {
2869 - if (eventNameDispatchConfigs.hasOwnProperty(eventName)) {
2870 - delete eventNameDispatchConfigs[eventName];
2871 - }
2872 - }
2873 -
2874 - var registrationNameModules = EventPluginRegistry.registrationNameModules;
2875 - for (var registrationName in registrationNameModules) {
2876 - if (registrationNameModules.hasOwnProperty(registrationName)) {
2877 - delete registrationNameModules[registrationName];
2878 - }
2879 - }
2880 -
2881 - if ("development" !== 'production') {
2882 - var possibleRegistrationNames = EventPluginRegistry.possibleRegistrationNames;
2883 - for (var lowerCasedName in possibleRegistrationNames) {
2884 - if (possibleRegistrationNames.hasOwnProperty(lowerCasedName)) {
2885 - delete possibleRegistrationNames[lowerCasedName];
2886 - }
2887 - }
2888 - }
2889 - }
2890 -
2891 -};
2892 -
2893 -module.exports = EventPluginRegistry;
2894 -},{"125":125,"150":150}],19:[function(_dereq_,module,exports){
2895 -/**
2896 - * Copyright 2013-present, Facebook, Inc.
2897 - * All rights reserved.
2898 - *
2899 - * This source code is licensed under the BSD-style license found in the
2900 - * LICENSE file in the root directory of this source tree. An additional grant
2901 - * of patent rights can be found in the PATENTS file in the same directory.
2902 - *
2903 - */
2904 -
2905 -'use strict';
2906 -
2907 -var _prodInvariant = _dereq_(125);
2908 -
2909 -var ReactErrorUtils = _dereq_(55);
2910 -
2911 -var invariant = _dereq_(150);
2912 -var warning = _dereq_(157);
2913 -
2914 -/**
2915 - * Injected dependencies:
2916 - */
2917 -
2918 -/**
2919 - * - `ComponentTree`: [required] Module that can convert between React instances
2920 - * and actual node references.
2921 - */
2922 -var ComponentTree;
2923 -var TreeTraversal;
2924 -var injection = {
2925 - injectComponentTree: function (Injected) {
2926 - ComponentTree = Injected;
2927 - if ("development" !== 'production') {
2928 - "development" !== 'production' ? warning(Injected && Injected.getNodeFromInstance && Injected.getInstanceFromNode, 'EventPluginUtils.injection.injectComponentTree(...): Injected ' + 'module is missing getNodeFromInstance or getInstanceFromNode.') : void 0;
2929 - }
2930 - },
2931 - injectTreeTraversal: function (Injected) {
2932 - TreeTraversal = Injected;
2933 - if ("development" !== 'production') {
2934 - "development" !== 'production' ? warning(Injected && Injected.isAncestor && Injected.getLowestCommonAncestor, 'EventPluginUtils.injection.injectTreeTraversal(...): Injected ' + 'module is missing isAncestor or getLowestCommonAncestor.') : void 0;
2935 - }
2936 - }
2937 -};
2938 -
2939 -function isEndish(topLevelType) {
2940 - return topLevelType === 'topMouseUp' || topLevelType === 'topTouchEnd' || topLevelType === 'topTouchCancel';
2941 -}
2942 -
2943 -function isMoveish(topLevelType) {
2944 - return topLevelType === 'topMouseMove' || topLevelType === 'topTouchMove';
2945 -}
2946 -function isStartish(topLevelType) {
2947 - return topLevelType === 'topMouseDown' || topLevelType === 'topTouchStart';
2948 -}
2949 -
2950 -var validateEventDispatches;
2951 -if ("development" !== 'production') {
2952 - validateEventDispatches = function (event) {
2953 - var dispatchListeners = event._dispatchListeners;
2954 - var dispatchInstances = event._dispatchInstances;
2955 -
2956 - var listenersIsArr = Array.isArray(dispatchListeners);
2957 - var listenersLen = listenersIsArr ? dispatchListeners.length : dispatchListeners ? 1 : 0;
2958 -
2959 - var instancesIsArr = Array.isArray(dispatchInstances);
2960 - var instancesLen = instancesIsArr ? dispatchInstances.length : dispatchInstances ? 1 : 0;
2961 -
2962 - "development" !== 'production' ? warning(instancesIsArr === listenersIsArr && instancesLen === listenersLen, 'EventPluginUtils: Invalid `event`.') : void 0;
2963 - };
2964 -}
2965 -
2966 -/**
2967 - * Dispatch the event to the listener.
2968 - * @param {SyntheticEvent} event SyntheticEvent to handle
2969 - * @param {boolean} simulated If the event is simulated (changes exn behavior)
2970 - * @param {function} listener Application-level callback
2971 - * @param {*} inst Internal component instance
2972 - */
2973 -function executeDispatch(event, simulated, listener, inst) {
2974 - var type = event.type || 'unknown-event';
2975 - event.currentTarget = EventPluginUtils.getNodeFromInstance(inst);
2976 - if (simulated) {
2977 - ReactErrorUtils.invokeGuardedCallbackWithCatch(type, listener, event);
2978 - } else {
2979 - ReactErrorUtils.invokeGuardedCallback(type, listener, event);
2980 - }
2981 - event.currentTarget = null;
2982 -}
2983 -
2984 -/**
2985 - * Standard/simple iteration through an event's collected dispatches.
2986 - */
2987 -function executeDispatchesInOrder(event, simulated) {
2988 - var dispatchListeners = event._dispatchListeners;
2989 - var dispatchInstances = event._dispatchInstances;
2990 - if ("development" !== 'production') {
2991 - validateEventDispatches(event);
2992 - }
2993 - if (Array.isArray(dispatchListeners)) {
2994 - for (var i = 0; i < dispatchListeners.length; i++) {
2995 - if (event.isPropagationStopped()) {
2996 - break;
2997 - }
2998 - // Listeners and Instances are two parallel arrays that are always in sync.
2999 - executeDispatch(event, simulated, dispatchListeners[i], dispatchInstances[i]);
3000 - }
3001 - } else if (dispatchListeners) {
3002 - executeDispatch(event, simulated, dispatchListeners, dispatchInstances);
3003 - }
3004 - event._dispatchListeners = null;
3005 - event._dispatchInstances = null;
3006 -}
3007 -
3008 -/**
3009 - * Standard/simple iteration through an event's collected dispatches, but stops
3010 - * at the first dispatch execution returning true, and returns that id.
3011 - *
3012 - * @return {?string} id of the first dispatch execution who's listener returns
3013 - * true, or null if no listener returned true.
3014 - */
3015 -function executeDispatchesInOrderStopAtTrueImpl(event) {
3016 - var dispatchListeners = event._dispatchListeners;
3017 - var dispatchInstances = event._dispatchInstances;
3018 - if ("development" !== 'production') {
3019 - validateEventDispatches(event);
3020 - }
3021 - if (Array.isArray(dispatchListeners)) {
3022 - for (var i = 0; i < dispatchListeners.length; i++) {
3023 - if (event.isPropagationStopped()) {
3024 - break;
3025 - }
3026 - // Listeners and Instances are two parallel arrays that are always in sync.
3027 - if (dispatchListeners[i](event, dispatchInstances[i])) {
3028 - return dispatchInstances[i];
3029 - }
3030 - }
3031 - } else if (dispatchListeners) {
3032 - if (dispatchListeners(event, dispatchInstances)) {
3033 - return dispatchInstances;
3034 - }
3035 - }
3036 - return null;
3037 -}
3038 -
3039 -/**
3040 - * @see executeDispatchesInOrderStopAtTrueImpl
3041 - */
3042 -function executeDispatchesInOrderStopAtTrue(event) {
3043 - var ret = executeDispatchesInOrderStopAtTrueImpl(event);
3044 - event._dispatchInstances = null;
3045 - event._dispatchListeners = null;
3046 - return ret;
3047 -}
3048 -
3049 -/**
3050 - * Execution of a "direct" dispatch - there must be at most one dispatch
3051 - * accumulated on the event or it is considered an error. It doesn't really make
3052 - * sense for an event with multiple dispatches (bubbled) to keep track of the
3053 - * return values at each dispatch execution, but it does tend to make sense when
3054 - * dealing with "direct" dispatches.
3055 - *
3056 - * @return {*} The return value of executing the single dispatch.
3057 - */
3058 -function executeDirectDispatch(event) {
3059 - if ("development" !== 'production') {
3060 - validateEventDispatches(event);
3061 - }
3062 - var dispatchListener = event._dispatchListeners;
3063 - var dispatchInstance = event._dispatchInstances;
3064 - !!Array.isArray(dispatchListener) ? "development" !== 'production' ? invariant(false, 'executeDirectDispatch(...): Invalid `event`.') : _prodInvariant('103') : void 0;
3065 - event.currentTarget = dispatchListener ? EventPluginUtils.getNodeFromInstance(dispatchInstance) : null;
3066 - var res = dispatchListener ? dispatchListener(event) : null;
3067 - event.currentTarget = null;
3068 - event._dispatchListeners = null;
3069 - event._dispatchInstances = null;
3070 - return res;
3071 -}
3072 -
3073 -/**
3074 - * @param {SyntheticEvent} event
3075 - * @return {boolean} True iff number of dispatches accumulated is greater than 0.
3076 - */
3077 -function hasDispatches(event) {
3078 - return !!event._dispatchListeners;
3079 -}
3080 -
3081 -/**
3082 - * General utilities that are useful in creating custom Event Plugins.
3083 - */
3084 -var EventPluginUtils = {
3085 - isEndish: isEndish,
3086 - isMoveish: isMoveish,
3087 - isStartish: isStartish,
3088 -
3089 - executeDirectDispatch: executeDirectDispatch,
3090 - executeDispatchesInOrder: executeDispatchesInOrder,
3091 - executeDispatchesInOrderStopAtTrue: executeDispatchesInOrderStopAtTrue,
3092 - hasDispatches: hasDispatches,
3093 -
3094 - getInstanceFromNode: function (node) {
3095 - return ComponentTree.getInstanceFromNode(node);
3096 - },
3097 - getNodeFromInstance: function (node) {
3098 - return ComponentTree.getNodeFromInstance(node);
3099 - },
3100 - isAncestor: function (a, b) {
3101 - return TreeTraversal.isAncestor(a, b);
3102 - },
3103 - getLowestCommonAncestor: function (a, b) {
3104 - return TreeTraversal.getLowestCommonAncestor(a, b);
3105 - },
3106 - getParentInstance: function (inst) {
3107 - return TreeTraversal.getParentInstance(inst);
3108 - },
3109 - traverseTwoPhase: function (target, fn, arg) {
3110 - return TreeTraversal.traverseTwoPhase(target, fn, arg);
3111 - },
3112 - traverseEnterLeave: function (from, to, fn, argFrom, argTo) {
3113 - return TreeTraversal.traverseEnterLeave(from, to, fn, argFrom, argTo);
3114 - },
3115 -
3116 - injection: injection
3117 -};
3118 -
3119 -module.exports = EventPluginUtils;
3120 -},{"125":125,"150":150,"157":157,"55":55}],20:[function(_dereq_,module,exports){
3121 -/**
3122 - * Copyright 2013-present, Facebook, Inc.
3123 - * All rights reserved.
3124 - *
3125 - * This source code is licensed under the BSD-style license found in the
3126 - * LICENSE file in the root directory of this source tree. An additional grant
3127 - * of patent rights can be found in the PATENTS file in the same directory.
3128 - *
3129 - */
3130 -
3131 -'use strict';
3132 -
3133 -var EventPluginHub = _dereq_(17);
3134 -var EventPluginUtils = _dereq_(19);
3135 -
3136 -var accumulateInto = _dereq_(102);
3137 -var forEachAccumulated = _dereq_(110);
3138 -var warning = _dereq_(157);
3139 -
3140 -var getListener = EventPluginHub.getListener;
3141 -
3142 -/**
3143 - * Some event types have a notion of different registration names for different
3144 - * "phases" of propagation. This finds listeners by a given phase.
3145 - */
3146 -function listenerAtPhase(inst, event, propagationPhase) {
3147 - var registrationName = event.dispatchConfig.phasedRegistrationNames[propagationPhase];
3148 - return getListener(inst, registrationName);
3149 -}
3150 -
3151 -/**
3152 - * Tags a `SyntheticEvent` with dispatched listeners. Creating this function
3153 - * here, allows us to not have to bind or create functions for each event.
3154 - * Mutating the event's members allows us to not have to create a wrapping
3155 - * "dispatch" object that pairs the event with the listener.
3156 - */
3157 -function accumulateDirectionalDispatches(inst, phase, event) {
3158 - if ("development" !== 'production') {
3159 - "development" !== 'production' ? warning(inst, 'Dispatching inst must not be null') : void 0;
3160 - }
3161 - var listener = listenerAtPhase(inst, event, phase);
3162 - if (listener) {
3163 - event._dispatchListeners = accumulateInto(event._dispatchListeners, listener);
3164 - event._dispatchInstances = accumulateInto(event._dispatchInstances, inst);
3165 - }
3166 -}
3167 -
3168 -/**
3169 - * Collect dispatches (must be entirely collected before dispatching - see unit
3170 - * tests). Lazily allocate the array to conserve memory. We must loop through
3171 - * each event and perform the traversal for each one. We cannot perform a
3172 - * single traversal for the entire collection of events because each event may
3173 - * have a different target.
3174 - */
3175 -function accumulateTwoPhaseDispatchesSingle(event) {
3176 - if (event && event.dispatchConfig.phasedRegistrationNames) {
3177 - EventPluginUtils.traverseTwoPhase(event._targetInst, accumulateDirectionalDispatches, event);
3178 - }
3179 -}
3180 -
3181 -/**
3182 - * Same as `accumulateTwoPhaseDispatchesSingle`, but skips over the targetID.
3183 - */
3184 -function accumulateTwoPhaseDispatchesSingleSkipTarget(event) {
3185 - if (event && event.dispatchConfig.phasedRegistrationNames) {
3186 - var targetInst = event._targetInst;
3187 - var parentInst = targetInst ? EventPluginUtils.getParentInstance(targetInst) : null;
3188 - EventPluginUtils.traverseTwoPhase(parentInst, accumulateDirectionalDispatches, event);
3189 - }
3190 -}
3191 -
3192 -/**
3193 - * Accumulates without regard to direction, does not look for phased
3194 - * registration names. Same as `accumulateDirectDispatchesSingle` but without
3195 - * requiring that the `dispatchMarker` be the same as the dispatched ID.
3196 - */
3197 -function accumulateDispatches(inst, ignoredDirection, event) {
3198 - if (event && event.dispatchConfig.registrationName) {
3199 - var registrationName = event.dispatchConfig.registrationName;
3200 - var listener = getListener(inst, registrationName);
3201 - if (listener) {
3202 - event._dispatchListeners = accumulateInto(event._dispatchListeners, listener);
3203 - event._dispatchInstances = accumulateInto(event._dispatchInstances, inst);
3204 - }
3205 - }
3206 -}
3207 -
3208 -/**
3209 - * Accumulates dispatches on an `SyntheticEvent`, but only for the
3210 - * `dispatchMarker`.
3211 - * @param {SyntheticEvent} event
3212 - */
3213 -function accumulateDirectDispatchesSingle(event) {
3214 - if (event && event.dispatchConfig.registrationName) {
3215 - accumulateDispatches(event._targetInst, null, event);
3216 - }
3217 -}
3218 -
3219 -function accumulateTwoPhaseDispatches(events) {
3220 - forEachAccumulated(events, accumulateTwoPhaseDispatchesSingle);
3221 -}
3222 -
3223 -function accumulateTwoPhaseDispatchesSkipTarget(events) {
3224 - forEachAccumulated(events, accumulateTwoPhaseDispatchesSingleSkipTarget);
3225 -}
3226 -
3227 -function accumulateEnterLeaveDispatches(leave, enter, from, to) {
3228 - EventPluginUtils.traverseEnterLeave(from, to, accumulateDispatches, leave, enter);
3229 -}
3230 -
3231 -function accumulateDirectDispatches(events) {
3232 - forEachAccumulated(events, accumulateDirectDispatchesSingle);
3233 -}
3234 -
3235 -/**
3236 - * A small set of propagation patterns, each of which will accept a small amount
3237 - * of information, and generate a set of "dispatch ready event objects" - which
3238 - * are sets of events that have already been annotated with a set of dispatched
3239 - * listener functions/ids. The API is designed this way to discourage these
3240 - * propagation strategies from actually executing the dispatches, since we
3241 - * always want to collect the entire set of dispatches before executing event a
3242 - * single one.
3243 - *
3244 - * @constructor EventPropagators
3245 - */
3246 -var EventPropagators = {
3247 - accumulateTwoPhaseDispatches: accumulateTwoPhaseDispatches,
3248 - accumulateTwoPhaseDispatchesSkipTarget: accumulateTwoPhaseDispatchesSkipTarget,
3249 - accumulateDirectDispatches: accumulateDirectDispatches,
3250 - accumulateEnterLeaveDispatches: accumulateEnterLeaveDispatches
3251 -};
3252 -
3253 -module.exports = EventPropagators;
3254 -},{"102":102,"110":110,"157":157,"17":17,"19":19}],21:[function(_dereq_,module,exports){
3255 -/**
3256 - * Copyright 2013-present, Facebook, Inc.
3257 - * All rights reserved.
3258 - *
3259 - * This source code is licensed under the BSD-style license found in the
3260 - * LICENSE file in the root directory of this source tree. An additional grant
3261 - * of patent rights can be found in the PATENTS file in the same directory.
3262 - *
3263 - */
3264 -
3265 -'use strict';
3266 -
3267 -var _assign = _dereq_(158);
3268 -
3269 -var PooledClass = _dereq_(25);
3270 -
3271 -var getTextContentAccessor = _dereq_(119);
3272 -
3273 -/**
3274 - * This helper class stores information about text content of a target node,
3275 - * allowing comparison of content before and after a given event.
3276 - *
3277 - * Identify the node where selection currently begins, then observe
3278 - * both its text content and its current position in the DOM. Since the
3279 - * browser may natively replace the target node during composition, we can
3280 - * use its position to find its replacement.
3281 - *
3282 - * @param {DOMEventTarget} root
3283 - */
3284 -function FallbackCompositionState(root) {
3285 - this._root = root;
3286 - this._startText = this.getText();
3287 - this._fallbackText = null;
3288 -}
3289 -
3290 -_assign(FallbackCompositionState.prototype, {
3291 - destructor: function () {
3292 - this._root = null;
3293 - this._startText = null;
3294 - this._fallbackText = null;
3295 - },
3296 -
3297 - /**
3298 - * Get current text of input.
3299 - *
3300 - * @return {string}
3301 - */
3302 - getText: function () {
3303 - if ('value' in this._root) {
3304 - return this._root.value;
3305 - }
3306 - return this._root[getTextContentAccessor()];
3307 - },
3308 -
3309 - /**
3310 - * Determine the differing substring between the initially stored
3311 - * text content and the current content.
3312 - *
3313 - * @return {string}
3314 - */
3315 - getData: function () {
3316 - if (this._fallbackText) {
3317 - return this._fallbackText;
3318 - }
3319 -
3320 - var start;
3321 - var startValue = this._startText;
3322 - var startLength = startValue.length;
3323 - var end;
3324 - var endValue = this.getText();
3325 - var endLength = endValue.length;
3326 -
3327 - for (start = 0; start < startLength; start++) {
3328 - if (startValue[start] !== endValue[start]) {
3329 - break;
3330 - }
3331 - }
3332 -
3333 - var minEnd = startLength - start;
3334 - for (end = 1; end <= minEnd; end++) {
3335 - if (startValue[startLength - end] !== endValue[endLength - end]) {
3336 - break;
3337 - }
3338 - }
3339 -
3340 - var sliceTail = end > 1 ? 1 - end : undefined;
3341 - this._fallbackText = endValue.slice(start, sliceTail);
3342 - return this._fallbackText;
3343 - }
3344 -});
3345 -
3346 -PooledClass.addPoolingTo(FallbackCompositionState);
3347 -
3348 -module.exports = FallbackCompositionState;
3349 -},{"119":119,"158":158,"25":25}],22:[function(_dereq_,module,exports){
3350 -/**
3351 - * Copyright 2013-present, Facebook, Inc.
3352 - * All rights reserved.
3353 - *
3354 - * This source code is licensed under the BSD-style license found in the
3355 - * LICENSE file in the root directory of this source tree. An additional grant
3356 - * of patent rights can be found in the PATENTS file in the same directory.
3357 - *
3358 - */
3359 -
3360 -'use strict';
3361 -
3362 -var DOMProperty = _dereq_(11);
3363 -
3364 -var MUST_USE_PROPERTY = DOMProperty.injection.MUST_USE_PROPERTY;
3365 -var HAS_BOOLEAN_VALUE = DOMProperty.injection.HAS_BOOLEAN_VALUE;
3366 -var HAS_NUMERIC_VALUE = DOMProperty.injection.HAS_NUMERIC_VALUE;
3367 -var HAS_POSITIVE_NUMERIC_VALUE = DOMProperty.injection.HAS_POSITIVE_NUMERIC_VALUE;
3368 -var HAS_OVERLOADED_BOOLEAN_VALUE = DOMProperty.injection.HAS_OVERLOADED_BOOLEAN_VALUE;
3369 -
3370 -var HTMLDOMPropertyConfig = {
3371 - isCustomAttribute: RegExp.prototype.test.bind(new RegExp('^(data|aria)-[' + DOMProperty.ATTRIBUTE_NAME_CHAR + ']*$')),
3372 - Properties: {
3373 - /**
3374 - * Standard Properties
3375 - */
3376 - accept: 0,
3377 - acceptCharset: 0,
3378 - accessKey: 0,
3379 - action: 0,
3380 - allowFullScreen: HAS_BOOLEAN_VALUE,
3381 - allowTransparency: 0,
3382 - alt: 0,
3383 - // specifies target context for links with `preload` type
3384 - as: 0,
3385 - async: HAS_BOOLEAN_VALUE,
3386 - autoComplete: 0,
3387 - // autoFocus is polyfilled/normalized by AutoFocusUtils
3388 - // autoFocus: HAS_BOOLEAN_VALUE,
3389 - autoPlay: HAS_BOOLEAN_VALUE,
3390 - capture: HAS_BOOLEAN_VALUE,
3391 - cellPadding: 0,
3392 - cellSpacing: 0,
3393 - charSet: 0,
3394 - challenge: 0,
3395 - checked: MUST_USE_PROPERTY | HAS_BOOLEAN_VALUE,
3396 - cite: 0,
3397 - classID: 0,
3398 - className: 0,
3399 - cols: HAS_POSITIVE_NUMERIC_VALUE,
3400 - colSpan: 0,
3401 - content: 0,
3402 - contentEditable: 0,
3403 - contextMenu: 0,
3404 - controls: HAS_BOOLEAN_VALUE,
3405 - coords: 0,
3406 - crossOrigin: 0,
3407 - data: 0, // For `<object />` acts as `src`.
3408 - dateTime: 0,
3409 - 'default': HAS_BOOLEAN_VALUE,
3410 - defer: HAS_BOOLEAN_VALUE,
3411 - dir: 0,
3412 - disabled: HAS_BOOLEAN_VALUE,
3413 - download: HAS_OVERLOADED_BOOLEAN_VALUE,
3414 - draggable: 0,
3415 - encType: 0,
3416 - form: 0,
3417 - formAction: 0,
3418 - formEncType: 0,
3419 - formMethod: 0,
3420 - formNoValidate: HAS_BOOLEAN_VALUE,
3421 - formTarget: 0,
3422 - frameBorder: 0,
3423 - headers: 0,
3424 - height: 0,
3425 - hidden: HAS_BOOLEAN_VALUE,
3426 - high: 0,
3427 - href: 0,
3428 - hrefLang: 0,
3429 - htmlFor: 0,
3430 - httpEquiv: 0,
3431 - icon: 0,
3432 - id: 0,
3433 - inputMode: 0,
3434 - integrity: 0,
3435 - is: 0,
3436 - keyParams: 0,
3437 - keyType: 0,
3438 - kind: 0,
3439 - label: 0,
3440 - lang: 0,
3441 - list: 0,
3442 - loop: HAS_BOOLEAN_VALUE,
3443 - low: 0,
3444 - manifest: 0,
3445 - marginHeight: 0,
3446 - marginWidth: 0,
3447 - max: 0,
3448 - maxLength: 0,
3449 - media: 0,
3450 - mediaGroup: 0,
3451 - method: 0,
3452 - min: 0,
3453 - minLength: 0,
3454 - // Caution; `option.selected` is not updated if `select.multiple` is
3455 - // disabled with `removeAttribute`.
3456 - multiple: MUST_USE_PROPERTY | HAS_BOOLEAN_VALUE,
3457 - muted: MUST_USE_PROPERTY | HAS_BOOLEAN_VALUE,
3458 - name: 0,
3459 - nonce: 0,
3460 - noValidate: HAS_BOOLEAN_VALUE,
3461 - open: HAS_BOOLEAN_VALUE,
3462 - optimum: 0,
3463 - pattern: 0,
3464 - placeholder: 0,
3465 - playsInline: HAS_BOOLEAN_VALUE,
3466 - poster: 0,
3467 - preload: 0,
3468 - profile: 0,
3469 - radioGroup: 0,
3470 - readOnly: HAS_BOOLEAN_VALUE,
3471 - referrerPolicy: 0,
3472 - rel: 0,
3473 - required: HAS_BOOLEAN_VALUE,
3474 - reversed: HAS_BOOLEAN_VALUE,
3475 - role: 0,
3476 - rows: HAS_POSITIVE_NUMERIC_VALUE,
3477 - rowSpan: HAS_NUMERIC_VALUE,
3478 - sandbox: 0,
3479 - scope: 0,
3480 - scoped: HAS_BOOLEAN_VALUE,
3481 - scrolling: 0,
3482 - seamless: HAS_BOOLEAN_VALUE,
3483 - selected: MUST_USE_PROPERTY | HAS_BOOLEAN_VALUE,
3484 - shape: 0,
3485 - size: HAS_POSITIVE_NUMERIC_VALUE,
3486 - sizes: 0,
3487 - span: HAS_POSITIVE_NUMERIC_VALUE,
3488 - spellCheck: 0,
3489 - src: 0,
3490 - srcDoc: 0,
3491 - srcLang: 0,
3492 - srcSet: 0,
3493 - start: HAS_NUMERIC_VALUE,
3494 - step: 0,
3495 - style: 0,
3496 - summary: 0,
3497 - tabIndex: 0,
3498 - target: 0,
3499 - title: 0,
3500 - // Setting .type throws on non-<input> tags
3501 - type: 0,
3502 - useMap: 0,
3503 - value: 0,
3504 - width: 0,
3505 - wmode: 0,
3506 - wrap: 0,
3507 -
3508 - /**
3509 - * RDFa Properties
3510 - */
3511 - about: 0,
3512 - datatype: 0,
3513 - inlist: 0,
3514 - prefix: 0,
3515 - // property is also supported for OpenGraph in meta tags.
3516 - property: 0,
3517 - resource: 0,
3518 - 'typeof': 0,
3519 - vocab: 0,
3520 -
3521 - /**
3522 - * Non-standard Properties
3523 - */
3524 - // autoCapitalize and autoCorrect are supported in Mobile Safari for
3525 - // keyboard hints.
3526 - autoCapitalize: 0,
3527 - autoCorrect: 0,
3528 - // autoSave allows WebKit/Blink to persist values of input fields on page reloads
3529 - autoSave: 0,
3530 - // color is for Safari mask-icon link
3531 - color: 0,
3532 - // itemProp, itemScope, itemType are for
3533 - // Microdata support. See http://schema.org/docs/gs.html
3534 - itemProp: 0,
3535 - itemScope: HAS_BOOLEAN_VALUE,
3536 - itemType: 0,
3537 - // itemID and itemRef are for Microdata support as well but
3538 - // only specified in the WHATWG spec document. See
3539 - // https://html.spec.whatwg.org/multipage/microdata.html#microdata-dom-api
3540 - itemID: 0,
3541 - itemRef: 0,
3542 - // results show looking glass icon and recent searches on input
3543 - // search fields in WebKit/Blink
3544 - results: 0,
3545 - // IE-only attribute that specifies security restrictions on an iframe
3546 - // as an alternative to the sandbox attribute on IE<10
3547 - security: 0,
3548 - // IE-only attribute that controls focus behavior
3549 - unselectable: 0
3550 - },
3551 - DOMAttributeNames: {
3552 - acceptCharset: 'accept-charset',
3553 - className: 'class',
3554 - htmlFor: 'for',
3555 - httpEquiv: 'http-equiv'
3556 - },
3557 - DOMPropertyNames: {}
3558 -};
3559 -
3560 -module.exports = HTMLDOMPropertyConfig;
3561 -},{"11":11}],23:[function(_dereq_,module,exports){
3562 -/**
3563 - * Copyright 2013-present, Facebook, Inc.
3564 - * All rights reserved.
3565 - *
3566 - * This source code is licensed under the BSD-style license found in the
3567 - * LICENSE file in the root directory of this source tree. An additional grant
3568 - * of patent rights can be found in the PATENTS file in the same directory.
3569 - *
3570 - *
3571 - */
3572 -
3573 -'use strict';
3574 -
3575 -/**
3576 - * Escape and wrap key so it is safe to use as a reactid
3577 - *
3578 - * @param {string} key to be escaped.
3579 - * @return {string} the escaped key.
3580 - */
3581 -
3582 -function escape(key) {
3583 - var escapeRegex = /[=:]/g;
3584 - var escaperLookup = {
3585 - '=': '=0',
3586 - ':': '=2'
3587 - };
3588 - var escapedString = ('' + key).replace(escapeRegex, function (match) {
3589 - return escaperLookup[match];
3590 - });
3591 -
3592 - return '$' + escapedString;
3593 -}
3594 -
3595 -/**
3596 - * Unescape and unwrap key for human-readable display
3597 - *
3598 - * @param {string} key to unescape.
3599 - * @return {string} the unescaped key.
3600 - */
3601 -function unescape(key) {
3602 - var unescapeRegex = /(=0|=2)/g;
3603 - var unescaperLookup = {
3604 - '=0': '=',
3605 - '=2': ':'
3606 - };
3607 - var keySubstring = key[0] === '.' && key[1] === '$' ? key.substring(2) : key.substring(1);
3608 -
3609 - return ('' + keySubstring).replace(unescapeRegex, function (match) {
3610 - return unescaperLookup[match];
3611 - });
3612 -}
3613 -
3614 -var KeyEscapeUtils = {
3615 - escape: escape,
3616 - unescape: unescape
3617 -};
3618 -
3619 -module.exports = KeyEscapeUtils;
3620 -},{}],24:[function(_dereq_,module,exports){
3621 -/**
3622 - * Copyright 2013-present, Facebook, Inc.
3623 - * All rights reserved.
3624 - *
3625 - * This source code is licensed under the BSD-style license found in the
3626 - * LICENSE file in the root directory of this source tree. An additional grant
3627 - * of patent rights can be found in the PATENTS file in the same directory.
3628 - *
3629 - */
3630 -
3631 -'use strict';
3632 -
3633 -var _prodInvariant = _dereq_(125);
3634 -
3635 -var React = _dereq_(134);
3636 -var ReactPropTypesSecret = _dereq_(73);
3637 -
3638 -var invariant = _dereq_(150);
3639 -var warning = _dereq_(157);
3640 -
3641 -var hasReadOnlyValue = {
3642 - 'button': true,
3643 - 'checkbox': true,
3644 - 'image': true,
3645 - 'hidden': true,
3646 - 'radio': true,
3647 - 'reset': true,
3648 - 'submit': true
3649 -};
3650 -
3651 -function _assertSingleLink(inputProps) {
3652 - !(inputProps.checkedLink == null || inputProps.valueLink == null) ? "development" !== '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.') : _prodInvariant('87') : void 0;
3653 -}
3654 -function _assertValueLink(inputProps) {
3655 - _assertSingleLink(inputProps);
3656 - !(inputProps.value == null && inputProps.onChange == null) ? "development" !== '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.') : _prodInvariant('88') : void 0;
3657 -}
3658 -
3659 -function _assertCheckedLink(inputProps) {
3660 - _assertSingleLink(inputProps);
3661 - !(inputProps.checked == null && inputProps.onChange == null) ? "development" !== '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') : _prodInvariant('89') : void 0;
3662 -}
3663 -
3664 -var propTypes = {
3665 - value: function (props, propName, componentName) {
3666 - if (!props[propName] || hasReadOnlyValue[props.type] || props.onChange || props.readOnly || props.disabled) {
3667 - return null;
3668 - }
3669 - 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`.');
3670 - },
3671 - checked: function (props, propName, componentName) {
3672 - if (!props[propName] || props.onChange || props.readOnly || props.disabled) {
3673 - return null;
3674 - }
3675 - 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`.');
3676 - },
3677 - onChange: React.PropTypes.func
3678 -};
3679 -
3680 -var loggedTypeFailures = {};
3681 -function getDeclarationErrorAddendum(owner) {
3682 - if (owner) {
3683 - var name = owner.getName();
3684 - if (name) {
3685 - return ' Check the render method of `' + name + '`.';
3686 - }
3687 - }
3688 - return '';
3689 -}
3690 -
3691 -/**
3692 - * Provide a linked `value` attribute for controlled forms. You should not use
3693 - * this outside of the ReactDOM controlled form components.
3694 - */
3695 -var LinkedValueUtils = {
3696 - checkPropTypes: function (tagName, props, owner) {
3697 - for (var propName in propTypes) {
3698 - if (propTypes.hasOwnProperty(propName)) {
3699 - var error = propTypes[propName](props, propName, tagName, 'prop', null, ReactPropTypesSecret);
3700 - }
3701 - if (error instanceof Error && !(error.message in loggedTypeFailures)) {
3702 - // Only monitor this failure once because there tends to be a lot of the
3703 - // same error.
3704 - loggedTypeFailures[error.message] = true;
3705 -
3706 - var addendum = getDeclarationErrorAddendum(owner);
3707 - "development" !== 'production' ? warning(false, 'Failed form propType: %s%s', error.message, addendum) : void 0;
3708 - }
3709 - }
3710 - },
3711 -
3712 - /**
3713 - * @param {object} inputProps Props for form component
3714 - * @return {*} current value of the input either from value prop or link.
3715 - */
3716 - getValue: function (inputProps) {
3717 - if (inputProps.valueLink) {
3718 - _assertValueLink(inputProps);
3719 - return inputProps.valueLink.value;
3720 - }
3721 - return inputProps.value;
3722 - },
3723 -
3724 - /**
3725 - * @param {object} inputProps Props for form component
3726 - * @return {*} current checked status of the input either from checked prop
3727 - * or link.
3728 - */
3729 - getChecked: function (inputProps) {
3730 - if (inputProps.checkedLink) {
3731 - _assertCheckedLink(inputProps);
3732 - return inputProps.checkedLink.value;
3733 - }
3734 - return inputProps.checked;
3735 - },
3736 -
3737 - /**
3738 - * @param {object} inputProps Props for form component
3739 - * @param {SyntheticEvent} event change event to handle
3740 - */
3741 - executeOnChange: function (inputProps, event) {
3742 - if (inputProps.valueLink) {
3743 - _assertValueLink(inputProps);
3744 - return inputProps.valueLink.requestChange(event.target.value);
3745 - } else if (inputProps.checkedLink) {
3746 - _assertCheckedLink(inputProps);
3747 - return inputProps.checkedLink.requestChange(event.target.checked);
3748 - } else if (inputProps.onChange) {
3749 - return inputProps.onChange.call(undefined, event);
3750 - }
3751 - }
3752 -};
3753 -
3754 -module.exports = LinkedValueUtils;
3755 -},{"125":125,"134":134,"150":150,"157":157,"73":73}],25:[function(_dereq_,module,exports){
3756 -/**
3757 - * Copyright 2013-present, Facebook, Inc.
3758 - * All rights reserved.
3759 - *
3760 - * This source code is licensed under the BSD-style license found in the
3761 - * LICENSE file in the root directory of this source tree. An additional grant
3762 - * of patent rights can be found in the PATENTS file in the same directory.
3763 - *
3764 - *
3765 - */
3766 -
3767 -'use strict';
3768 -
3769 -var _prodInvariant = _dereq_(125);
3770 -
3771 -var invariant = _dereq_(150);
3772 -
3773 -/**
3774 - * Static poolers. Several custom versions for each potential number of
3775 - * arguments. A completely generic pooler is easy to implement, but would
3776 - * require accessing the `arguments` object. In each of these, `this` refers to
3777 - * the Class itself, not an instance. If any others are needed, simply add them
3778 - * here, or in their own files.
3779 - */
3780 -var oneArgumentPooler = function (copyFieldsFrom) {
3781 - var Klass = this;
3782 - if (Klass.instancePool.length) {
3783 - var instance = Klass.instancePool.pop();
3784 - Klass.call(instance, copyFieldsFrom);
3785 - return instance;
3786 - } else {
3787 - return new Klass(copyFieldsFrom);
3788 - }
3789 -};
3790 -
3791 -var twoArgumentPooler = function (a1, a2) {
3792 - var Klass = this;
3793 - if (Klass.instancePool.length) {
3794 - var instance = Klass.instancePool.pop();
3795 - Klass.call(instance, a1, a2);
3796 - return instance;
3797 - } else {
3798 - return new Klass(a1, a2);
3799 - }
3800 -};
3801 -
3802 -var threeArgumentPooler = function (a1, a2, a3) {
3803 - var Klass = this;
3804 - if (Klass.instancePool.length) {
3805 - var instance = Klass.instancePool.pop();
3806 - Klass.call(instance, a1, a2, a3);
3807 - return instance;
3808 - } else {
3809 - return new Klass(a1, a2, a3);
3810 - }
3811 -};
3812 -
3813 -var fourArgumentPooler = function (a1, a2, a3, a4) {
3814 - var Klass = this;
3815 - if (Klass.instancePool.length) {
3816 - var instance = Klass.instancePool.pop();
3817 - Klass.call(instance, a1, a2, a3, a4);
3818 - return instance;
3819 - } else {
3820 - return new Klass(a1, a2, a3, a4);
3821 - }
3822 -};
3823 -
3824 -var fiveArgumentPooler = function (a1, a2, a3, a4, a5) {
3825 - var Klass = this;
3826 - if (Klass.instancePool.length) {
3827 - var instance = Klass.instancePool.pop();
3828 - Klass.call(instance, a1, a2, a3, a4, a5);
3829 - return instance;
3830 - } else {
3831 - return new Klass(a1, a2, a3, a4, a5);
3832 - }
3833 -};
3834 -
3835 -var standardReleaser = function (instance) {
3836 - var Klass = this;
3837 - !(instance instanceof Klass) ? "development" !== 'production' ? invariant(false, 'Trying to release an instance into a pool of a different type.') : _prodInvariant('25') : void 0;
3838 - instance.destructor();
3839 - if (Klass.instancePool.length < Klass.poolSize) {
3840 - Klass.instancePool.push(instance);
3841 - }
3842 -};
3843 -
3844 -var DEFAULT_POOL_SIZE = 10;
3845 -var DEFAULT_POOLER = oneArgumentPooler;
3846 -
3847 -/**
3848 - * Augments `CopyConstructor` to be a poolable class, augmenting only the class
3849 - * itself (statically) not adding any prototypical fields. Any CopyConstructor
3850 - * you give this may have a `poolSize` property, and will look for a
3851 - * prototypical `destructor` on instances.
3852 - *
3853 - * @param {Function} CopyConstructor Constructor that can be used to reset.
3854 - * @param {Function} pooler Customizable pooler.
3855 - */
3856 -var addPoolingTo = function (CopyConstructor, pooler) {
3857 - // Casting as any so that flow ignores the actual implementation and trusts
3858 - // it to match the type we declared
3859 - var NewKlass = CopyConstructor;
3860 - NewKlass.instancePool = [];
3861 - NewKlass.getPooled = pooler || DEFAULT_POOLER;
3862 - if (!NewKlass.poolSize) {
3863 - NewKlass.poolSize = DEFAULT_POOL_SIZE;
3864 - }
3865 - NewKlass.release = standardReleaser;
3866 - return NewKlass;
3867 -};
3868 -
3869 -var PooledClass = {
3870 - addPoolingTo: addPoolingTo,
3871 - oneArgumentPooler: oneArgumentPooler,
3872 - twoArgumentPooler: twoArgumentPooler,
3873 - threeArgumentPooler: threeArgumentPooler,
3874 - fourArgumentPooler: fourArgumentPooler,
3875 - fiveArgumentPooler: fiveArgumentPooler
3876 -};
3877 -
3878 -module.exports = PooledClass;
3879 -},{"125":125,"150":150}],26:[function(_dereq_,module,exports){
3880 -/**
3881 - * Copyright 2013-present, Facebook, Inc.
3882 - * All rights reserved.
3883 - *
3884 - * This source code is licensed under the BSD-style license found in the
3885 - * LICENSE file in the root directory of this source tree. An additional grant
3886 - * of patent rights can be found in the PATENTS file in the same directory.
3887 - *
3888 - */
3889 -
3890 -'use strict';
3891 -
3892 -var _assign = _dereq_(158);
3893 -
3894 -var EventPluginRegistry = _dereq_(18);
3895 -var ReactEventEmitterMixin = _dereq_(56);
3896 -var ViewportMetrics = _dereq_(101);
3897 -
3898 -var getVendorPrefixedEventName = _dereq_(120);
3899 -var isEventSupported = _dereq_(122);
3900 -
3901 -/**
3902 - * Summary of `ReactBrowserEventEmitter` event handling:
3903 - *
3904 - * - Top-level delegation is used to trap most native browser events. This
3905 - * may only occur in the main thread and is the responsibility of
3906 - * ReactEventListener, which is injected and can therefore support pluggable
3907 - * event sources. This is the only work that occurs in the main thread.
3908 - *
3909 - * - We normalize and de-duplicate events to account for browser quirks. This
3910 - * may be done in the worker thread.
3911 - *
3912 - * - Forward these native events (with the associated top-level type used to
3913 - * trap it) to `EventPluginHub`, which in turn will ask plugins if they want
3914 - * to extract any synthetic events.
3915 - *
3916 - * - The `EventPluginHub` will then process each event by annotating them with
3917 - * "dispatches", a sequence of listeners and IDs that care about that event.
3918 - *
3919 - * - The `EventPluginHub` then dispatches the events.
3920 - *
3921 - * Overview of React and the event system:
3922 - *
3923 - * +------------+ .
3924 - * | DOM | .
3925 - * +------------+ .
3926 - * | .
3927 - * v .
3928 - * +------------+ .
3929 - * | ReactEvent | .
3930 - * | Listener | .
3931 - * +------------+ . +-----------+
3932 - * | . +--------+|SimpleEvent|
3933 - * | . | |Plugin |
3934 - * +-----|------+ . v +-----------+
3935 - * | | | . +--------------+ +------------+
3936 - * | +-----------.--->|EventPluginHub| | Event |
3937 - * | | . | | +-----------+ | Propagators|
3938 - * | ReactEvent | . | | |TapEvent | |------------|
3939 - * | Emitter | . | |<---+|Plugin | |other plugin|
3940 - * | | . | | +-----------+ | utilities |
3941 - * | +-----------.--->| | +------------+
3942 - * | | | . +--------------+
3943 - * +-----|------+ . ^ +-----------+
3944 - * | . | |Enter/Leave|
3945 - * + . +-------+|Plugin |
3946 - * +-------------+ . +-----------+
3947 - * | application | .
3948 - * |-------------| .
3949 - * | | .
3950 - * | | .
3951 - * +-------------+ .
3952 - * .
3953 - * React Core . General Purpose Event Plugin System
3954 - */
3955 -
3956 -var hasEventPageXY;
3957 -var alreadyListeningTo = {};
3958 -var isMonitoringScrollValue = false;
3959 -var reactTopListenersCounter = 0;
3960 -
3961 -// For events like 'submit' which don't consistently bubble (which we trap at a
3962 -// lower node than `document`), binding at `document` would cause duplicate
3963 -// events so we don't include them here
3964 -var topEventMapping = {
3965 - topAbort: 'abort',
3966 - topAnimationEnd: getVendorPrefixedEventName('animationend') || 'animationend',
3967 - topAnimationIteration: getVendorPrefixedEventName('animationiteration') || 'animationiteration',
3968 - topAnimationStart: getVendorPrefixedEventName('animationstart') || 'animationstart',
3969 - topBlur: 'blur',
3970 - topCanPlay: 'canplay',
3971 - topCanPlayThrough: 'canplaythrough',
3972 - topChange: 'change',
3973 - topClick: 'click',
3974 - topCompositionEnd: 'compositionend',
3975 - topCompositionStart: 'compositionstart',
3976 - topCompositionUpdate: 'compositionupdate',
3977 - topContextMenu: 'contextmenu',
3978 - topCopy: 'copy',
3979 - topCut: 'cut',
3980 - topDoubleClick: 'dblclick',
3981 - topDrag: 'drag',
3982 - topDragEnd: 'dragend',
3983 - topDragEnter: 'dragenter',
3984 - topDragExit: 'dragexit',
3985 - topDragLeave: 'dragleave',
3986 - topDragOver: 'dragover',
3987 - topDragStart: 'dragstart',
3988 - topDrop: 'drop',
3989 - topDurationChange: 'durationchange',
3990 - topEmptied: 'emptied',
3991 - topEncrypted: 'encrypted',
3992 - topEnded: 'ended',
3993 - topError: 'error',
3994 - topFocus: 'focus',
3995 - topInput: 'input',
3996 - topKeyDown: 'keydown',
3997 - topKeyPress: 'keypress',
3998 - topKeyUp: 'keyup',
3999 - topLoadedData: 'loadeddata',
4000 - topLoadedMetadata: 'loadedmetadata',
4001 - topLoadStart: 'loadstart',
4002 - topMouseDown: 'mousedown',
4003 - topMouseMove: 'mousemove',
4004 - topMouseOut: 'mouseout',
4005 - topMouseOver: 'mouseover',
4006 - topMouseUp: 'mouseup',
4007 - topPaste: 'paste',
4008 - topPause: 'pause',
4009 - topPlay: 'play',
4010 - topPlaying: 'playing',
4011 - topProgress: 'progress',
4012 - topRateChange: 'ratechange',
4013 - topScroll: 'scroll',
4014 - topSeeked: 'seeked',
4015 - topSeeking: 'seeking',
4016 - topSelectionChange: 'selectionchange',
4017 - topStalled: 'stalled',
4018 - topSuspend: 'suspend',
4019 - topTextInput: 'textInput',
4020 - topTimeUpdate: 'timeupdate',
4021 - topTouchCancel: 'touchcancel',
4022 - topTouchEnd: 'touchend',
4023 - topTouchMove: 'touchmove',
4024 - topTouchStart: 'touchstart',
4025 - topTransitionEnd: getVendorPrefixedEventName('transitionend') || 'transitionend',
4026 - topVolumeChange: 'volumechange',
4027 - topWaiting: 'waiting',
4028 - topWheel: 'wheel'
4029 -};
4030 -
4031 -/**
4032 - * To ensure no conflicts with other potential React instances on the page
4033 - */
4034 -var topListenersIDKey = '_reactListenersID' + String(Math.random()).slice(2);
4035 -
4036 -function getListeningForDocument(mountAt) {
4037 - // In IE8, `mountAt` is a host object and doesn't have `hasOwnProperty`
4038 - // directly.
4039 - if (!Object.prototype.hasOwnProperty.call(mountAt, topListenersIDKey)) {
4040 - mountAt[topListenersIDKey] = reactTopListenersCounter++;
4041 - alreadyListeningTo[mountAt[topListenersIDKey]] = {};
4042 - }
4043 - return alreadyListeningTo[mountAt[topListenersIDKey]];
4044 -}
4045 -
4046 -/**
4047 - * `ReactBrowserEventEmitter` is used to attach top-level event listeners. For
4048 - * example:
4049 - *
4050 - * EventPluginHub.putListener('myID', 'onClick', myFunction);
4051 - *
4052 - * This would allocate a "registration" of `('onClick', myFunction)` on 'myID'.
4053 - *
4054 - * @internal
4055 - */
4056 -var ReactBrowserEventEmitter = _assign({}, ReactEventEmitterMixin, {
4057 -
4058 - /**
4059 - * Injectable event backend
4060 - */
4061 - ReactEventListener: null,
4062 -
4063 - injection: {
4064 - /**
4065 - * @param {object} ReactEventListener
4066 - */
4067 - injectReactEventListener: function (ReactEventListener) {
4068 - ReactEventListener.setHandleTopLevel(ReactBrowserEventEmitter.handleTopLevel);
4069 - ReactBrowserEventEmitter.ReactEventListener = ReactEventListener;
4070 - }
4071 - },
4072 -
4073 - /**
4074 - * Sets whether or not any created callbacks should be enabled.
4075 - *
4076 - * @param {boolean} enabled True if callbacks should be enabled.
4077 - */
4078 - setEnabled: function (enabled) {
4079 - if (ReactBrowserEventEmitter.ReactEventListener) {
4080 - ReactBrowserEventEmitter.ReactEventListener.setEnabled(enabled);
4081 - }
4082 - },
4083 -
4084 - /**
4085 - * @return {boolean} True if callbacks are enabled.
4086 - */
4087 - isEnabled: function () {
4088 - return !!(ReactBrowserEventEmitter.ReactEventListener && ReactBrowserEventEmitter.ReactEventListener.isEnabled());
4089 - },
4090 -
4091 - /**
4092 - * We listen for bubbled touch events on the document object.
4093 - *
4094 - * Firefox v8.01 (and possibly others) exhibited strange behavior when
4095 - * mounting `onmousemove` events at some node that was not the document
4096 - * element. The symptoms were that if your mouse is not moving over something
4097 - * contained within that mount point (for example on the background) the
4098 - * top-level listeners for `onmousemove` won't be called. However, if you
4099 - * register the `mousemove` on the document object, then it will of course
4100 - * catch all `mousemove`s. This along with iOS quirks, justifies restricting
4101 - * top-level listeners to the document object only, at least for these
4102 - * movement types of events and possibly all events.
4103 - *
4104 - * @see http://www.quirksmode.org/blog/archives/2010/09/click_event_del.html
4105 - *
4106 - * Also, `keyup`/`keypress`/`keydown` do not bubble to the window on IE, but
4107 - * they bubble to document.
4108 - *
4109 - * @param {string} registrationName Name of listener (e.g. `onClick`).
4110 - * @param {object} contentDocumentHandle Document which owns the container
4111 - */
4112 - listenTo: function (registrationName, contentDocumentHandle) {
4113 - var mountAt = contentDocumentHandle;
4114 - var isListening = getListeningForDocument(mountAt);
4115 - var dependencies = EventPluginRegistry.registrationNameDependencies[registrationName];
4116 -
4117 - for (var i = 0; i < dependencies.length; i++) {
4118 - var dependency = dependencies[i];
4119 - if (!(isListening.hasOwnProperty(dependency) && isListening[dependency])) {
4120 - if (dependency === 'topWheel') {
4121 - if (isEventSupported('wheel')) {
4122 - ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent('topWheel', 'wheel', mountAt);
4123 - } else if (isEventSupported('mousewheel')) {
4124 - ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent('topWheel', 'mousewheel', mountAt);
4125 - } else {
4126 - // Firefox needs to capture a different mouse scroll event.
4127 - // @see http://www.quirksmode.org/dom/events/tests/scroll.html
4128 - ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent('topWheel', 'DOMMouseScroll', mountAt);
4129 - }
4130 - } else if (dependency === 'topScroll') {
4131 -
4132 - if (isEventSupported('scroll', true)) {
4133 - ReactBrowserEventEmitter.ReactEventListener.trapCapturedEvent('topScroll', 'scroll', mountAt);
4134 - } else {
4135 - ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent('topScroll', 'scroll', ReactBrowserEventEmitter.ReactEventListener.WINDOW_HANDLE);
4136 - }
4137 - } else if (dependency === 'topFocus' || dependency === 'topBlur') {
4138 -
4139 - if (isEventSupported('focus', true)) {
4140 - ReactBrowserEventEmitter.ReactEventListener.trapCapturedEvent('topFocus', 'focus', mountAt);
4141 - ReactBrowserEventEmitter.ReactEventListener.trapCapturedEvent('topBlur', 'blur', mountAt);
4142 - } else if (isEventSupported('focusin')) {
4143 - // IE has `focusin` and `focusout` events which bubble.
4144 - // @see http://www.quirksmode.org/blog/archives/2008/04/delegating_the.html
4145 - ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent('topFocus', 'focusin', mountAt);
4146 - ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent('topBlur', 'focusout', mountAt);
4147 - }
4148 -
4149 - // to make sure blur and focus event listeners are only attached once
4150 - isListening.topBlur = true;
4151 - isListening.topFocus = true;
4152 - } else if (topEventMapping.hasOwnProperty(dependency)) {
4153 - ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent(dependency, topEventMapping[dependency], mountAt);
4154 - }
4155 -
4156 - isListening[dependency] = true;
4157 - }
4158 - }
4159 - },
4160 -
4161 - trapBubbledEvent: function (topLevelType, handlerBaseName, handle) {
4162 - return ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent(topLevelType, handlerBaseName, handle);
4163 - },
4164 -
4165 - trapCapturedEvent: function (topLevelType, handlerBaseName, handle) {
4166 - return ReactBrowserEventEmitter.ReactEventListener.trapCapturedEvent(topLevelType, handlerBaseName, handle);
4167 - },
4168 -
4169 - /**
4170 - * Protect against document.createEvent() returning null
4171 - * Some popup blocker extensions appear to do this:
4172 - * https://github.com/facebook/react/issues/6887
4173 - */
4174 - supportsEventPageXY: function () {
4175 - if (!document.createEvent) {
4176 - return false;
4177 - }
4178 - var ev = document.createEvent('MouseEvent');
4179 - return ev != null && 'pageX' in ev;
4180 - },
4181 -
4182 - /**
4183 - * Listens to window scroll and resize events. We cache scroll values so that
4184 - * application code can access them without triggering reflows.
4185 - *
4186 - * ViewportMetrics is only used by SyntheticMouse/TouchEvent and only when
4187 - * pageX/pageY isn't supported (legacy browsers).
4188 - *
4189 - * NOTE: Scroll events do not bubble.
4190 - *
4191 - * @see http://www.quirksmode.org/dom/events/scroll.html
4192 - */
4193 - ensureScrollValueMonitoring: function () {
4194 - if (hasEventPageXY === undefined) {
4195 - hasEventPageXY = ReactBrowserEventEmitter.supportsEventPageXY();
4196 - }
4197 - if (!hasEventPageXY && !isMonitoringScrollValue) {
4198 - var refresh = ViewportMetrics.refreshScrollValues;
4199 - ReactBrowserEventEmitter.ReactEventListener.monitorScrollValue(refresh);
4200 - isMonitoringScrollValue = true;
4201 - }
4202 - }
4203 -
4204 -});
4205 -
4206 -module.exports = ReactBrowserEventEmitter;
4207 -},{"101":101,"120":120,"122":122,"158":158,"18":18,"56":56}],27:[function(_dereq_,module,exports){
4208 -(function (process){
4209 -/**
4210 - * Copyright 2014-present, Facebook, Inc.
4211 - * All rights reserved.
4212 - *
4213 - * This source code is licensed under the BSD-style license found in the
4214 - * LICENSE file in the root directory of this source tree. An additional grant
4215 - * of patent rights can be found in the PATENTS file in the same directory.
4216 - *
4217 - */
4218 -
4219 -'use strict';
4220 -
4221 -var ReactReconciler = _dereq_(75);
4222 -
4223 -var instantiateReactComponent = _dereq_(121);
4224 -var KeyEscapeUtils = _dereq_(23);
4225 -var shouldUpdateReactComponent = _dereq_(129);
4226 -var traverseAllChildren = _dereq_(130);
4227 -var warning = _dereq_(157);
4228 -
4229 -var ReactComponentTreeHook;
4230 -
4231 -if (typeof process !== 'undefined' && process.env && "development" === 'test') {
4232 - // Temporary hack.
4233 - // Inline requires don't work well with Jest:
4234 - // https://github.com/facebook/react/issues/7240
4235 - // Remove the inline requires when we don't need them anymore:
4236 - // https://github.com/facebook/react/pull/7178
4237 - ReactComponentTreeHook = _dereq_(132);
4238 -}
4239 -
4240 -function instantiateChild(childInstances, child, name, selfDebugID) {
4241 - // We found a component instance.
4242 - var keyUnique = childInstances[name] === undefined;
4243 - if ("development" !== 'production') {
4244 - if (!ReactComponentTreeHook) {
4245 - ReactComponentTreeHook = _dereq_(132);
4246 - }
4247 - if (!keyUnique) {
4248 - "development" !== 'production' ? warning(false, '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.%s', KeyEscapeUtils.unescape(name), ReactComponentTreeHook.getStackAddendumByID(selfDebugID)) : void 0;
4249 - }
4250 - }
4251 - if (child != null && keyUnique) {
4252 - childInstances[name] = instantiateReactComponent(child, true);
4253 - }
4254 -}
4255 -
4256 -/**
4257 - * ReactChildReconciler provides helpers for initializing or updating a set of
4258 - * children. Its output is suitable for passing it onto ReactMultiChild which
4259 - * does diffed reordering and insertion.
4260 - */
4261 -var ReactChildReconciler = {
4262 - /**
4263 - * Generates a "mount image" for each of the supplied children. In the case
4264 - * of `ReactDOMComponent`, a mount image is a string of markup.
4265 - *
4266 - * @param {?object} nestedChildNodes Nested child maps.
4267 - * @return {?object} A set of child instances.
4268 - * @internal
4269 - */
4270 - instantiateChildren: function (nestedChildNodes, transaction, context, selfDebugID // 0 in production and for roots
4271 - ) {
4272 - if (nestedChildNodes == null) {
4273 - return null;
4274 - }
4275 - var childInstances = {};
4276 -
4277 - if ("development" !== 'production') {
4278 - traverseAllChildren(nestedChildNodes, function (childInsts, child, name) {
4279 - return instantiateChild(childInsts, child, name, selfDebugID);
4280 - }, childInstances);
4281 - } else {
4282 - traverseAllChildren(nestedChildNodes, instantiateChild, childInstances);
4283 - }
4284 - return childInstances;
4285 - },
4286 -
4287 - /**
4288 - * Updates the rendered children and returns a new set of children.
4289 - *
4290 - * @param {?object} prevChildren Previously initialized set of children.
4291 - * @param {?object} nextChildren Flat child element maps.
4292 - * @param {ReactReconcileTransaction} transaction
4293 - * @param {object} context
4294 - * @return {?object} A new set of child instances.
4295 - * @internal
4296 - */
4297 - updateChildren: function (prevChildren, nextChildren, mountImages, removedNodes, transaction, hostParent, hostContainerInfo, context, selfDebugID // 0 in production and for roots
4298 - ) {
4299 - // We currently don't have a way to track moves here but if we use iterators
4300 - // instead of for..in we can zip the iterators and check if an item has
4301 - // moved.
4302 - // TODO: If nothing has changed, return the prevChildren object so that we
4303 - // can quickly bailout if nothing has changed.
4304 - if (!nextChildren && !prevChildren) {
4305 - return;
4306 - }
4307 - var name;
4308 - var prevChild;
4309 - for (name in nextChildren) {
4310 - if (!nextChildren.hasOwnProperty(name)) {
4311 - continue;
4312 - }
4313 - prevChild = prevChildren && prevChildren[name];
4314 - var prevElement = prevChild && prevChild._currentElement;
4315 - var nextElement = nextChildren[name];
4316 - if (prevChild != null && shouldUpdateReactComponent(prevElement, nextElement)) {
4317 - ReactReconciler.receiveComponent(prevChild, nextElement, transaction, context);
4318 - nextChildren[name] = prevChild;
4319 - } else {
4320 - if (prevChild) {
4321 - removedNodes[name] = ReactReconciler.getHostNode(prevChild);
4322 - ReactReconciler.unmountComponent(prevChild, false);
4323 - }
4324 - // The child must be instantiated before it's mounted.
4325 - var nextChildInstance = instantiateReactComponent(nextElement, true);
4326 - nextChildren[name] = nextChildInstance;
4327 - // Creating mount image now ensures refs are resolved in right order
4328 - // (see https://github.com/facebook/react/pull/7101 for explanation).
4329 - var nextChildMountImage = ReactReconciler.mountComponent(nextChildInstance, transaction, hostParent, hostContainerInfo, context, selfDebugID);
4330 - mountImages.push(nextChildMountImage);
4331 - }
4332 - }
4333 - // Unmount children that are no longer present.
4334 - for (name in prevChildren) {
4335 - if (prevChildren.hasOwnProperty(name) && !(nextChildren && nextChildren.hasOwnProperty(name))) {
4336 - prevChild = prevChildren[name];
4337 - removedNodes[name] = ReactReconciler.getHostNode(prevChild);
4338 - ReactReconciler.unmountComponent(prevChild, false);
4339 - }
4340 - }
4341 - },
4342 -
4343 - /**
4344 - * Unmounts all rendered children. This should be used to clean up children
4345 - * when this component is unmounted.
4346 - *
4347 - * @param {?object} renderedChildren Previously initialized set of children.
4348 - * @internal
4349 - */
4350 - unmountChildren: function (renderedChildren, safely) {
4351 - for (var name in renderedChildren) {
4352 - if (renderedChildren.hasOwnProperty(name)) {
4353 - var renderedChild = renderedChildren[name];
4354 - ReactReconciler.unmountComponent(renderedChild, safely);
4355 - }
4356 - }
4357 - }
4358 -
4359 -};
4360 -
4361 -module.exports = ReactChildReconciler;
4362 -}).call(this,undefined)
4363 -},{"121":121,"129":129,"130":130,"132":132,"157":157,"23":23,"75":75}],28:[function(_dereq_,module,exports){
4364 -/**
4365 - * Copyright 2013-present, Facebook, Inc.
4366 - * All rights reserved.
4367 - *
4368 - * This source code is licensed under the BSD-style license found in the
4369 - * LICENSE file in the root directory of this source tree. An additional grant
4370 - * of patent rights can be found in the PATENTS file in the same directory.
4371 - *
4372 - */
4373 -
4374 -'use strict';
4375 -
4376 -var DOMChildrenOperations = _dereq_(8);
4377 -var ReactDOMIDOperations = _dereq_(38);
4378 -
4379 -/**
4380 - * Abstracts away all functionality of the reconciler that requires knowledge of
4381 - * the browser context. TODO: These callers should be refactored to avoid the
4382 - * need for this injection.
4383 - */
4384 -var ReactComponentBrowserEnvironment = {
4385 -
4386 - processChildrenUpdates: ReactDOMIDOperations.dangerouslyProcessChildrenUpdates,
4387 -
4388 - replaceNodeWithMarkup: DOMChildrenOperations.dangerouslyReplaceNodeWithMarkup
4389 -
4390 -};
4391 -
4392 -module.exports = ReactComponentBrowserEnvironment;
4393 -},{"38":38,"8":8}],29:[function(_dereq_,module,exports){
4394 -/**
4395 - * Copyright 2014-present, Facebook, Inc.
4396 - * All rights reserved.
4397 - *
4398 - * This source code is licensed under the BSD-style license found in the
4399 - * LICENSE file in the root directory of this source tree. An additional grant
4400 - * of patent rights can be found in the PATENTS file in the same directory.
4401 - *
4402 - *
4403 - */
4404 -
4405 -'use strict';
4406 -
4407 -var _prodInvariant = _dereq_(125);
4408 -
4409 -var invariant = _dereq_(150);
4410 -
4411 -var injected = false;
4412 -
4413 -var ReactComponentEnvironment = {
4414 -
4415 - /**
4416 - * Optionally injectable hook for swapping out mount images in the middle of
4417 - * the tree.
4418 - */
4419 - replaceNodeWithMarkup: null,
4420 -
4421 - /**
4422 - * Optionally injectable hook for processing a queue of child updates. Will
4423 - * later move into MultiChildComponents.
4424 - */
4425 - processChildrenUpdates: null,
4426 -
4427 - injection: {
4428 - injectEnvironment: function (environment) {
4429 - !!injected ? "development" !== 'production' ? invariant(false, 'ReactCompositeComponent: injectEnvironment() can only be called once.') : _prodInvariant('104') : void 0;
4430 - ReactComponentEnvironment.replaceNodeWithMarkup = environment.replaceNodeWithMarkup;
4431 - ReactComponentEnvironment.processChildrenUpdates = environment.processChildrenUpdates;
4432 - injected = true;
4433 - }
4434 - }
4435 -
4436 -};
4437 -
4438 -module.exports = ReactComponentEnvironment;
4439 -},{"125":125,"150":150}],30:[function(_dereq_,module,exports){
4440 -/**
4441 - * Copyright 2013-present, Facebook, Inc.
4442 - * All rights reserved.
4443 - *
4444 - * This source code is licensed under the BSD-style license found in the
4445 - * LICENSE file in the root directory of this source tree. An additional grant
4446 - * of patent rights can be found in the PATENTS file in the same directory.
4447 - *
4448 - */
4449 -
4450 -'use strict';
4451 -
4452 -var _prodInvariant = _dereq_(125),
4453 - _assign = _dereq_(158);
4454 -
4455 -var React = _dereq_(134);
4456 -var ReactComponentEnvironment = _dereq_(29);
4457 -var ReactCurrentOwner = _dereq_(133);
4458 -var ReactErrorUtils = _dereq_(55);
4459 -var ReactInstanceMap = _dereq_(63);
4460 -var ReactInstrumentation = _dereq_(64);
4461 -var ReactNodeTypes = _dereq_(69);
4462 -var ReactReconciler = _dereq_(75);
4463 -
4464 -if ("development" !== 'production') {
4465 - var checkReactTypeSpec = _dereq_(104);
4466 -}
4467 -
4468 -var emptyObject = _dereq_(143);
4469 -var invariant = _dereq_(150);
4470 -var shallowEqual = _dereq_(156);
4471 -var shouldUpdateReactComponent = _dereq_(129);
4472 -var warning = _dereq_(157);
4473 -
4474 -var CompositeTypes = {
4475 - ImpureClass: 0,
4476 - PureClass: 1,
4477 - StatelessFunctional: 2
4478 -};
4479 -
4480 -function StatelessComponent(Component) {}
4481 -StatelessComponent.prototype.render = function () {
4482 - var Component = ReactInstanceMap.get(this)._currentElement.type;
4483 - var element = Component(this.props, this.context, this.updater);
4484 - warnIfInvalidElement(Component, element);
4485 - return element;
4486 -};
4487 -
4488 -function warnIfInvalidElement(Component, element) {
4489 - if ("development" !== 'production') {
4490 - "development" !== 'production' ? warning(element === null || element === false || React.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;
4491 - "development" !== 'production' ? warning(!Component.childContextTypes, '%s(...): childContextTypes cannot be defined on a functional component.', Component.displayName || Component.name || 'Component') : void 0;
4492 - }
4493 -}
4494 -
4495 -function shouldConstruct(Component) {
4496 - return !!(Component.prototype && Component.prototype.isReactComponent);
4497 -}
4498 -
4499 -function isPureComponent(Component) {
4500 - return !!(Component.prototype && Component.prototype.isPureReactComponent);
4501 -}
4502 -
4503 -// Separated into a function to contain deoptimizations caused by try/finally.
4504 -function measureLifeCyclePerf(fn, debugID, timerType) {
4505 - if (debugID === 0) {
4506 - // Top-level wrappers (see ReactMount) and empty components (see
4507 - // ReactDOMEmptyComponent) are invisible to hooks and devtools.
4508 - // Both are implementation details that should go away in the future.
4509 - return fn();
4510 - }
4511 -
4512 - ReactInstrumentation.debugTool.onBeginLifeCycleTimer(debugID, timerType);
4513 - try {
4514 - return fn();
4515 - } finally {
4516 - ReactInstrumentation.debugTool.onEndLifeCycleTimer(debugID, timerType);
4517 - }
4518 -}
4519 -
4520 -/**
4521 - * ------------------ The Life-Cycle of a Composite Component ------------------
4522 - *
4523 - * - constructor: Initialization of state. The instance is now retained.
4524 - * - componentWillMount
4525 - * - render
4526 - * - [children's constructors]
4527 - * - [children's componentWillMount and render]
4528 - * - [children's componentDidMount]
4529 - * - componentDidMount
4530 - *
4531 - * Update Phases:
4532 - * - componentWillReceiveProps (only called if parent updated)
4533 - * - shouldComponentUpdate
4534 - * - componentWillUpdate
4535 - * - render
4536 - * - [children's constructors or receive props phases]
4537 - * - componentDidUpdate
4538 - *
4539 - * - componentWillUnmount
4540 - * - [children's componentWillUnmount]
4541 - * - [children destroyed]
4542 - * - (destroyed): The instance is now blank, released by React and ready for GC.
4543 - *
4544 - * -----------------------------------------------------------------------------
4545 - */
4546 -
4547 -/**
4548 - * An incrementing ID assigned to each component when it is mounted. This is
4549 - * used to enforce the order in which `ReactUpdates` updates dirty components.
4550 - *
4551 - * @private
4552 - */
4553 -var nextMountID = 1;
4554 -
4555 -/**
4556 - * @lends {ReactCompositeComponent.prototype}
4557 - */
4558 -var ReactCompositeComponent = {
4559 -
4560 - /**
4561 - * Base constructor for all composite component.
4562 - *
4563 - * @param {ReactElement} element
4564 - * @final
4565 - * @internal
4566 - */
4567 - construct: function (element) {
4568 - this._currentElement = element;
4569 - this._rootNodeID = 0;
4570 - this._compositeType = null;
4571 - this._instance = null;
4572 - this._hostParent = null;
4573 - this._hostContainerInfo = null;
4574 -
4575 - // See ReactUpdateQueue
4576 - this._updateBatchNumber = null;
4577 - this._pendingElement = null;
4578 - this._pendingStateQueue = null;
4579 - this._pendingReplaceState = false;
4580 - this._pendingForceUpdate = false;
4581 -
4582 - this._renderedNodeType = null;
4583 - this._renderedComponent = null;
4584 - this._context = null;
4585 - this._mountOrder = 0;
4586 - this._topLevelWrapper = null;
4587 -
4588 - // See ReactUpdates and ReactUpdateQueue.
4589 - this._pendingCallbacks = null;
4590 -
4591 - // ComponentWillUnmount shall only be called once
4592 - this._calledComponentWillUnmount = false;
4593 -
4594 - if ("development" !== 'production') {
4595 - this._warnedAboutRefsInRender = false;
4596 - }
4597 - },
4598 -
4599 - /**
4600 - * Initializes the component, renders markup, and registers event listeners.
4601 - *
4602 - * @param {ReactReconcileTransaction|ReactServerRenderingTransaction} transaction
4603 - * @param {?object} hostParent
4604 - * @param {?object} hostContainerInfo
4605 - * @param {?object} context
4606 - * @return {?string} Rendered markup to be inserted into the DOM.
4607 - * @final
4608 - * @internal
4609 - */
4610 - mountComponent: function (transaction, hostParent, hostContainerInfo, context) {
4611 - var _this = this;
4612 -
4613 - this._context = context;
4614 - this._mountOrder = nextMountID++;
4615 - this._hostParent = hostParent;
4616 - this._hostContainerInfo = hostContainerInfo;
4617 -
4618 - var publicProps = this._currentElement.props;
4619 - var publicContext = this._processContext(context);
4620 -
4621 - var Component = this._currentElement.type;
4622 -
4623 - var updateQueue = transaction.getUpdateQueue();
4624 -
4625 - // Initialize the public class
4626 - var doConstruct = shouldConstruct(Component);
4627 - var inst = this._constructComponent(doConstruct, publicProps, publicContext, updateQueue);
4628 - var renderedElement;
4629 -
4630 - // Support functional components
4631 - if (!doConstruct && (inst == null || inst.render == null)) {
4632 - renderedElement = inst;
4633 - warnIfInvalidElement(Component, renderedElement);
4634 - !(inst === null || inst === false || React.isValidElement(inst)) ? "development" !== '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') : _prodInvariant('105', Component.displayName || Component.name || 'Component') : void 0;
4635 - inst = new StatelessComponent(Component);
4636 - this._compositeType = CompositeTypes.StatelessFunctional;
4637 - } else {
4638 - if (isPureComponent(Component)) {
4639 - this._compositeType = CompositeTypes.PureClass;
4640 - } else {
4641 - this._compositeType = CompositeTypes.ImpureClass;
4642 - }
4643 - }
4644 -
4645 - if ("development" !== 'production') {
4646 - // This will throw later in _renderValidatedComponent, but add an early
4647 - // warning now to help debugging
4648 - if (inst.render == null) {
4649 - "development" !== '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;
4650 - }
4651 -
4652 - var propsMutated = inst.props !== publicProps;
4653 - var componentName = Component.displayName || Component.name || 'Component';
4654 -
4655 - "development" !== '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;
4656 - }
4657 -
4658 - // These should be set up in the constructor, but as a convenience for
4659 - // simpler class abstractions, we set them up after the fact.
4660 - inst.props = publicProps;
4661 - inst.context = publicContext;
4662 - inst.refs = emptyObject;
4663 - inst.updater = updateQueue;
4664 -
4665 - this._instance = inst;
4666 -
4667 - // Store a reference from the instance back to the internal representation
4668 - ReactInstanceMap.set(inst, this);
4669 -
4670 - if ("development" !== 'production') {
4671 - // Since plain JS classes are defined without any special initialization
4672 - // logic, we can not catch common errors early. Therefore, we have to
4673 - // catch them here, at initialization time, instead.
4674 - "development" !== '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;
4675 - "development" !== '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;
4676 - "development" !== '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;
4677 - "development" !== '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;
4678 - "development" !== '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;
4679 - "development" !== '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;
4680 - "development" !== 'production' ? warning(typeof inst.componentWillRecieveProps !== 'function', '%s has a method called ' + 'componentWillRecieveProps(). Did you mean componentWillReceiveProps()?', this.getName() || 'A component') : void 0;
4681 - }
4682 -
4683 - var initialState = inst.state;
4684 - if (initialState === undefined) {
4685 - inst.state = initialState = null;
4686 - }
4687 - !(typeof initialState === 'object' && !Array.isArray(initialState)) ? "development" !== 'production' ? invariant(false, '%s.state: must be set to an object or null', this.getName() || 'ReactCompositeComponent') : _prodInvariant('106', this.getName() || 'ReactCompositeComponent') : void 0;
4688 -
4689 - this._pendingStateQueue = null;
4690 - this._pendingReplaceState = false;
4691 - this._pendingForceUpdate = false;
4692 -
4693 - var markup;
4694 - if (inst.unstable_handleError) {
4695 - markup = this.performInitialMountWithErrorHandling(renderedElement, hostParent, hostContainerInfo, transaction, context);
4696 - } else {
4697 - markup = this.performInitialMount(renderedElement, hostParent, hostContainerInfo, transaction, context);
4698 - }
4699 -
4700 - if (inst.componentDidMount) {
4701 - if ("development" !== 'production') {
4702 - transaction.getReactMountReady().enqueue(function () {
4703 - measureLifeCyclePerf(function () {
4704 - return inst.componentDidMount();
4705 - }, _this._debugID, 'componentDidMount');
4706 - });
4707 - } else {
4708 - transaction.getReactMountReady().enqueue(inst.componentDidMount, inst);
4709 - }
4710 - }
4711 -
4712 - return markup;
4713 - },
4714 -
4715 - _constructComponent: function (doConstruct, publicProps, publicContext, updateQueue) {
4716 - if ("development" !== 'production') {
4717 - ReactCurrentOwner.current = this;
4718 - try {
4719 - return this._constructComponentWithoutOwner(doConstruct, publicProps, publicContext, updateQueue);
4720 - } finally {
4721 - ReactCurrentOwner.current = null;
4722 - }
4723 - } else {
4724 - return this._constructComponentWithoutOwner(doConstruct, publicProps, publicContext, updateQueue);
4725 - }
4726 - },
4727 -
4728 - _constructComponentWithoutOwner: function (doConstruct, publicProps, publicContext, updateQueue) {
4729 - var Component = this._currentElement.type;
4730 -
4731 - if (doConstruct) {
4732 - if ("development" !== 'production') {
4733 - return measureLifeCyclePerf(function () {
4734 - return new Component(publicProps, publicContext, updateQueue);
4735 - }, this._debugID, 'ctor');
4736 - } else {
4737 - return new Component(publicProps, publicContext, updateQueue);
4738 - }
4739 - }
4740 -
4741 - // This can still be an instance in case of factory components
4742 - // but we'll count this as time spent rendering as the more common case.
4743 - if ("development" !== 'production') {
4744 - return measureLifeCyclePerf(function () {
4745 - return Component(publicProps, publicContext, updateQueue);
4746 - }, this._debugID, 'render');
4747 - } else {
4748 - return Component(publicProps, publicContext, updateQueue);
4749 - }
4750 - },
4751 -
4752 - performInitialMountWithErrorHandling: function (renderedElement, hostParent, hostContainerInfo, transaction, context) {
4753 - var markup;
4754 - var checkpoint = transaction.checkpoint();
4755 - try {
4756 - markup = this.performInitialMount(renderedElement, hostParent, hostContainerInfo, transaction, context);
4757 - } catch (e) {
4758 - // Roll back to checkpoint, handle error (which may add items to the transaction), and take a new checkpoint
4759 - transaction.rollback(checkpoint);
4760 - this._instance.unstable_handleError(e);
4761 - if (this._pendingStateQueue) {
4762 - this._instance.state = this._processPendingState(this._instance.props, this._instance.context);
4763 - }
4764 - checkpoint = transaction.checkpoint();
4765 -
4766 - this._renderedComponent.unmountComponent(true);
4767 - transaction.rollback(checkpoint);
4768 -
4769 - // Try again - we've informed the component about the error, so they can render an error message this time.
4770 - // If this throws again, the error will bubble up (and can be caught by a higher error boundary).
4771 - markup = this.performInitialMount(renderedElement, hostParent, hostContainerInfo, transaction, context);
4772 - }
4773 - return markup;
4774 - },
4775 -
4776 - performInitialMount: function (renderedElement, hostParent, hostContainerInfo, transaction, context) {
4777 - var inst = this._instance;
4778 -
4779 - var debugID = 0;
4780 - if ("development" !== 'production') {
4781 - debugID = this._debugID;
4782 - }
4783 -
4784 - if (inst.componentWillMount) {
4785 - if ("development" !== 'production') {
4786 - measureLifeCyclePerf(function () {
4787 - return inst.componentWillMount();
4788 - }, debugID, 'componentWillMount');
4789 - } else {
4790 - inst.componentWillMount();
4791 - }
4792 - // When mounting, calls to `setState` by `componentWillMount` will set
4793 - // `this._pendingStateQueue` without triggering a re-render.
4794 - if (this._pendingStateQueue) {
4795 - inst.state = this._processPendingState(inst.props, inst.context);
4796 - }
4797 - }
4798 -
4799 - // If not a stateless component, we now render
4800 - if (renderedElement === undefined) {
4801 - renderedElement = this._renderValidatedComponent();
4802 - }
4803 -
4804 - var nodeType = ReactNodeTypes.getType(renderedElement);
4805 - this._renderedNodeType = nodeType;
4806 - var child = this._instantiateReactComponent(renderedElement, nodeType !== ReactNodeTypes.EMPTY /* shouldHaveDebugID */
4807 - );
4808 - this._renderedComponent = child;
4809 -
4810 - var markup = ReactReconciler.mountComponent(child, transaction, hostParent, hostContainerInfo, this._processChildContext(context), debugID);
4811 -
4812 - if ("development" !== 'production') {
4813 - if (debugID !== 0) {
4814 - var childDebugIDs = child._debugID !== 0 ? [child._debugID] : [];
4815 - ReactInstrumentation.debugTool.onSetChildren(debugID, childDebugIDs);
4816 - }
4817 - }
4818 -
4819 - return markup;
4820 - },
4821 -
4822 - getHostNode: function () {
4823 - return ReactReconciler.getHostNode(this._renderedComponent);
4824 - },
4825 -
4826 - /**
4827 - * Releases any resources allocated by `mountComponent`.
4828 - *
4829 - * @final
4830 - * @internal
4831 - */
4832 - unmountComponent: function (safely) {
4833 - if (!this._renderedComponent) {
4834 - return;
4835 - }
4836 -
4837 - var inst = this._instance;
4838 -
4839 - if (inst.componentWillUnmount && !inst._calledComponentWillUnmount) {
4840 - inst._calledComponentWillUnmount = true;
4841 -
4842 - if (safely) {
4843 - var name = this.getName() + '.componentWillUnmount()';
4844 - ReactErrorUtils.invokeGuardedCallback(name, inst.componentWillUnmount.bind(inst));
4845 - } else {
4846 - if ("development" !== 'production') {
4847 - measureLifeCyclePerf(function () {
4848 - return inst.componentWillUnmount();
4849 - }, this._debugID, 'componentWillUnmount');
4850 - } else {
4851 - inst.componentWillUnmount();
4852 - }
4853 - }
4854 - }
4855 -
4856 - if (this._renderedComponent) {
4857 - ReactReconciler.unmountComponent(this._renderedComponent, safely);
4858 - this._renderedNodeType = null;
4859 - this._renderedComponent = null;
4860 - this._instance = null;
4861 - }
4862 -
4863 - // Reset pending fields
4864 - // Even if this component is scheduled for another update in ReactUpdates,
4865 - // it would still be ignored because these fields are reset.
4866 - this._pendingStateQueue = null;
4867 - this._pendingReplaceState = false;
4868 - this._pendingForceUpdate = false;
4869 - this._pendingCallbacks = null;
4870 - this._pendingElement = null;
4871 -
4872 - // These fields do not really need to be reset since this object is no
4873 - // longer accessible.
4874 - this._context = null;
4875 - this._rootNodeID = 0;
4876 - this._topLevelWrapper = null;
4877 -
4878 - // Delete the reference from the instance to this internal representation
4879 - // which allow the internals to be properly cleaned up even if the user
4880 - // leaks a reference to the public instance.
4881 - ReactInstanceMap.remove(inst);
4882 -
4883 - // Some existing components rely on inst.props even after they've been
4884 - // destroyed (in event handlers).
4885 - // TODO: inst.props = null;
4886 - // TODO: inst.state = null;
4887 - // TODO: inst.context = null;
4888 - },
4889 -
4890 - /**
4891 - * Filters the context object to only contain keys specified in
4892 - * `contextTypes`
4893 - *
4894 - * @param {object} context
4895 - * @return {?object}
4896 - * @private
4897 - */
4898 - _maskContext: function (context) {
4899 - var Component = this._currentElement.type;
4900 - var contextTypes = Component.contextTypes;
4901 - if (!contextTypes) {
4902 - return emptyObject;
4903 - }
4904 - var maskedContext = {};
4905 - for (var contextName in contextTypes) {
4906 - maskedContext[contextName] = context[contextName];
4907 - }
4908 - return maskedContext;
4909 - },
4910 -
4911 - /**
4912 - * Filters the context object to only contain keys specified in
4913 - * `contextTypes`, and asserts that they are valid.
4914 - *
4915 - * @param {object} context
4916 - * @return {?object}
4917 - * @private
4918 - */
4919 - _processContext: function (context) {
4920 - var maskedContext = this._maskContext(context);
4921 - if ("development" !== 'production') {
4922 - var Component = this._currentElement.type;
4923 - if (Component.contextTypes) {
4924 - this._checkContextTypes(Component.contextTypes, maskedContext, 'context');
4925 - }
4926 - }
4927 - return maskedContext;
4928 - },
4929 -
4930 - /**
4931 - * @param {object} currentContext
4932 - * @return {object}
4933 - * @private
4934 - */
4935 - _processChildContext: function (currentContext) {
4936 - var Component = this._currentElement.type;
4937 - var inst = this._instance;
4938 - var childContext;
4939 -
4940 - if (inst.getChildContext) {
4941 - if ("development" !== 'production') {
4942 - ReactInstrumentation.debugTool.onBeginProcessingChildContext();
4943 - try {
4944 - childContext = inst.getChildContext();
4945 - } finally {
4946 - ReactInstrumentation.debugTool.onEndProcessingChildContext();
4947 - }
4948 - } else {
4949 - childContext = inst.getChildContext();
4950 - }
4951 - }
4952 -
4953 - if (childContext) {
4954 - !(typeof Component.childContextTypes === 'object') ? "development" !== 'production' ? invariant(false, '%s.getChildContext(): childContextTypes must be defined in order to use getChildContext().', this.getName() || 'ReactCompositeComponent') : _prodInvariant('107', this.getName() || 'ReactCompositeComponent') : void 0;
4955 - if ("development" !== 'production') {
4956 - this._checkContextTypes(Component.childContextTypes, childContext, 'childContext');
4957 - }
4958 - for (var name in childContext) {
4959 - !(name in Component.childContextTypes) ? "development" !== 'production' ? invariant(false, '%s.getChildContext(): key "%s" is not defined in childContextTypes.', this.getName() || 'ReactCompositeComponent', name) : _prodInvariant('108', this.getName() || 'ReactCompositeComponent', name) : void 0;
4960 - }
4961 - return _assign({}, currentContext, childContext);
4962 - }
4963 - return currentContext;
4964 - },
4965 -
4966 - /**
4967 - * Assert that the context types are valid
4968 - *
4969 - * @param {object} typeSpecs Map of context field to a ReactPropType
4970 - * @param {object} values Runtime values that need to be type-checked
4971 - * @param {string} location e.g. "prop", "context", "child context"
4972 - * @private
4973 - */
4974 - _checkContextTypes: function (typeSpecs, values, location) {
4975 - if ("development" !== 'production') {
4976 - checkReactTypeSpec(typeSpecs, values, location, this.getName(), null, this._debugID);
4977 - }
4978 - },
4979 -
4980 - receiveComponent: function (nextElement, transaction, nextContext) {
4981 - var prevElement = this._currentElement;
4982 - var prevContext = this._context;
4983 -
4984 - this._pendingElement = null;
4985 -
4986 - this.updateComponent(transaction, prevElement, nextElement, prevContext, nextContext);
4987 - },
4988 -
4989 - /**
4990 - * If any of `_pendingElement`, `_pendingStateQueue`, or `_pendingForceUpdate`
4991 - * is set, update the component.
4992 - *
4993 - * @param {ReactReconcileTransaction} transaction
4994 - * @internal
4995 - */
4996 - performUpdateIfNecessary: function (transaction) {
4997 - if (this._pendingElement != null) {
4998 - ReactReconciler.receiveComponent(this, this._pendingElement, transaction, this._context);
4999 - } else if (this._pendingStateQueue !== null || this._pendingForceUpdate) {

This file is too large to show in full.

docs/js/react.js deleted
-3748
@@ -1,3748 +0,0 @@
1 - /**
2 - * React v15.4.0
3 - */
4 -(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.React = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(_dereq_,module,exports){
5 -/**
6 - * Copyright 2013-present, Facebook, Inc.
7 - * All rights reserved.
8 - *
9 - * This source code is licensed under the BSD-style license found in the
10 - * LICENSE file in the root directory of this source tree. An additional grant
11 - * of patent rights can be found in the PATENTS file in the same directory.
12 - *
13 - *
14 - */
15 -
16 -'use strict';
17 -
18 -/**
19 - * Escape and wrap key so it is safe to use as a reactid
20 - *
21 - * @param {string} key to be escaped.
22 - * @return {string} the escaped key.
23 - */
24 -
25 -function escape(key) {
26 - var escapeRegex = /[=:]/g;
27 - var escaperLookup = {
28 - '=': '=0',
29 - ':': '=2'
30 - };
31 - var escapedString = ('' + key).replace(escapeRegex, function (match) {
32 - return escaperLookup[match];
33 - });
34 -
35 - return '$' + escapedString;
36 -}
37 -
38 -/**
39 - * Unescape and unwrap key for human-readable display
40 - *
41 - * @param {string} key to unescape.
42 - * @return {string} the unescaped key.
43 - */
44 -function unescape(key) {
45 - var unescapeRegex = /(=0|=2)/g;
46 - var unescaperLookup = {
47 - '=0': '=',
48 - '=2': ':'
49 - };
50 - var keySubstring = key[0] === '.' && key[1] === '$' ? key.substring(2) : key.substring(1);
51 -
52 - return ('' + keySubstring).replace(unescapeRegex, function (match) {
53 - return unescaperLookup[match];
54 - });
55 -}
56 -
57 -var KeyEscapeUtils = {
58 - escape: escape,
59 - unescape: unescape
60 -};
61 -
62 -module.exports = KeyEscapeUtils;
63 -},{}],2:[function(_dereq_,module,exports){
64 -/**
65 - * Copyright 2013-present, Facebook, Inc.
66 - * All rights reserved.
67 - *
68 - * This source code is licensed under the BSD-style license found in the
69 - * LICENSE file in the root directory of this source tree. An additional grant
70 - * of patent rights can be found in the PATENTS file in the same directory.
71 - *
72 - *
73 - */
74 -
75 -'use strict';
76 -
77 -var _prodInvariant = _dereq_(24);
78 -
79 -var invariant = _dereq_(28);
80 -
81 -/**
82 - * Static poolers. Several custom versions for each potential number of
83 - * arguments. A completely generic pooler is easy to implement, but would
84 - * require accessing the `arguments` object. In each of these, `this` refers to
85 - * the Class itself, not an instance. If any others are needed, simply add them
86 - * here, or in their own files.
87 - */
88 -var oneArgumentPooler = function (copyFieldsFrom) {
89 - var Klass = this;
90 - if (Klass.instancePool.length) {
91 - var instance = Klass.instancePool.pop();
92 - Klass.call(instance, copyFieldsFrom);
93 - return instance;
94 - } else {
95 - return new Klass(copyFieldsFrom);
96 - }
97 -};
98 -
99 -var twoArgumentPooler = function (a1, a2) {
100 - var Klass = this;
101 - if (Klass.instancePool.length) {
102 - var instance = Klass.instancePool.pop();
103 - Klass.call(instance, a1, a2);
104 - return instance;
105 - } else {
106 - return new Klass(a1, a2);
107 - }
108 -};
109 -
110 -var threeArgumentPooler = function (a1, a2, a3) {
111 - var Klass = this;
112 - if (Klass.instancePool.length) {
113 - var instance = Klass.instancePool.pop();
114 - Klass.call(instance, a1, a2, a3);
115 - return instance;
116 - } else {
117 - return new Klass(a1, a2, a3);
118 - }
119 -};
120 -
121 -var fourArgumentPooler = function (a1, a2, a3, a4) {
122 - var Klass = this;
123 - if (Klass.instancePool.length) {
124 - var instance = Klass.instancePool.pop();
125 - Klass.call(instance, a1, a2, a3, a4);
126 - return instance;
127 - } else {
128 - return new Klass(a1, a2, a3, a4);
129 - }
130 -};
131 -
132 -var fiveArgumentPooler = function (a1, a2, a3, a4, a5) {
133 - var Klass = this;
134 - if (Klass.instancePool.length) {
135 - var instance = Klass.instancePool.pop();
136 - Klass.call(instance, a1, a2, a3, a4, a5);
137 - return instance;
138 - } else {
139 - return new Klass(a1, a2, a3, a4, a5);
140 - }
141 -};
142 -
143 -var standardReleaser = function (instance) {
144 - var Klass = this;
145 - !(instance instanceof Klass) ? "development" !== 'production' ? invariant(false, 'Trying to release an instance into a pool of a different type.') : _prodInvariant('25') : void 0;
146 - instance.destructor();
147 - if (Klass.instancePool.length < Klass.poolSize) {
148 - Klass.instancePool.push(instance);
149 - }
150 -};
151 -
152 -var DEFAULT_POOL_SIZE = 10;
153 -var DEFAULT_POOLER = oneArgumentPooler;
154 -
155 -/**
156 - * Augments `CopyConstructor` to be a poolable class, augmenting only the class
157 - * itself (statically) not adding any prototypical fields. Any CopyConstructor
158 - * you give this may have a `poolSize` property, and will look for a
159 - * prototypical `destructor` on instances.
160 - *
161 - * @param {Function} CopyConstructor Constructor that can be used to reset.
162 - * @param {Function} pooler Customizable pooler.
163 - */
164 -var addPoolingTo = function (CopyConstructor, pooler) {
165 - // Casting as any so that flow ignores the actual implementation and trusts
166 - // it to match the type we declared
167 - var NewKlass = CopyConstructor;
168 - NewKlass.instancePool = [];
169 - NewKlass.getPooled = pooler || DEFAULT_POOLER;
170 - if (!NewKlass.poolSize) {
171 - NewKlass.poolSize = DEFAULT_POOL_SIZE;
172 - }
173 - NewKlass.release = standardReleaser;
174 - return NewKlass;
175 -};
176 -
177 -var PooledClass = {
178 - addPoolingTo: addPoolingTo,
179 - oneArgumentPooler: oneArgumentPooler,
180 - twoArgumentPooler: twoArgumentPooler,
181 - threeArgumentPooler: threeArgumentPooler,
182 - fourArgumentPooler: fourArgumentPooler,
183 - fiveArgumentPooler: fiveArgumentPooler
184 -};
185 -
186 -module.exports = PooledClass;
187 -},{"24":24,"28":28}],3:[function(_dereq_,module,exports){
188 -/**
189 - * Copyright 2013-present, Facebook, Inc.
190 - * All rights reserved.
191 - *
192 - * This source code is licensed under the BSD-style license found in the
193 - * LICENSE file in the root directory of this source tree. An additional grant
194 - * of patent rights can be found in the PATENTS file in the same directory.
195 - *
196 - */
197 -
198 -'use strict';
199 -
200 -var _assign = _dereq_(30);
201 -
202 -var ReactChildren = _dereq_(4);
203 -var ReactComponent = _dereq_(6);
204 -var ReactPureComponent = _dereq_(17);
205 -var ReactClass = _dereq_(5);
206 -var ReactDOMFactories = _dereq_(9);
207 -var ReactElement = _dereq_(10);
208 -var ReactPropTypes = _dereq_(15);
209 -var ReactVersion = _dereq_(19);
210 -
211 -var onlyChild = _dereq_(23);
212 -var warning = _dereq_(29);
213 -
214 -var createElement = ReactElement.createElement;
215 -var createFactory = ReactElement.createFactory;
216 -var cloneElement = ReactElement.cloneElement;
217 -
218 -if ("development" !== 'production') {
219 - var ReactElementValidator = _dereq_(12);
220 - createElement = ReactElementValidator.createElement;
221 - createFactory = ReactElementValidator.createFactory;
222 - cloneElement = ReactElementValidator.cloneElement;
223 -}
224 -
225 -var __spread = _assign;
226 -
227 -if ("development" !== 'production') {
228 - var warned = false;
229 - __spread = function () {
230 - "development" !== '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;
231 - warned = true;
232 - return _assign.apply(null, arguments);
233 - };
234 -}
235 -
236 -var React = {
237 -
238 - // Modern
239 -
240 - Children: {
241 - map: ReactChildren.map,
242 - forEach: ReactChildren.forEach,
243 - count: ReactChildren.count,
244 - toArray: ReactChildren.toArray,
245 - only: onlyChild
246 - },
247 -
248 - Component: ReactComponent,
249 - PureComponent: ReactPureComponent,
250 -
251 - createElement: createElement,
252 - cloneElement: cloneElement,
253 - isValidElement: ReactElement.isValidElement,
254 -
255 - // Classic
256 -
257 - PropTypes: ReactPropTypes,
258 - createClass: ReactClass.createClass,
259 - createFactory: createFactory,
260 - createMixin: function (mixin) {
261 - // Currently a noop. Will be used to validate and trace mixins.
262 - return mixin;
263 - },
264 -
265 - // This looks DOM specific but these are actually isomorphic helpers
266 - // since they are just generating DOM strings.
267 - DOM: ReactDOMFactories,
268 -
269 - version: ReactVersion,
270 -
271 - // Deprecated hook for JSX spread, don't use this for anything.
272 - __spread: __spread
273 -};
274 -
275 -module.exports = React;
276 -},{"10":10,"12":12,"15":15,"17":17,"19":19,"23":23,"29":29,"30":30,"4":4,"5":5,"6":6,"9":9}],4:[function(_dereq_,module,exports){
277 -/**
278 - * Copyright 2013-present, Facebook, Inc.
279 - * All rights reserved.
280 - *
281 - * This source code is licensed under the BSD-style license found in the
282 - * LICENSE file in the root directory of this source tree. An additional grant
283 - * of patent rights can be found in the PATENTS file in the same directory.
284 - *
285 - */
286 -
287 -'use strict';
288 -
289 -var PooledClass = _dereq_(2);
290 -var ReactElement = _dereq_(10);
291 -
292 -var emptyFunction = _dereq_(26);
293 -var traverseAllChildren = _dereq_(25);
294 -
295 -var twoArgumentPooler = PooledClass.twoArgumentPooler;
296 -var fourArgumentPooler = PooledClass.fourArgumentPooler;
297 -
298 -var userProvidedKeyEscapeRegex = /\/+/g;
299 -function escapeUserProvidedKey(text) {
300 - return ('' + text).replace(userProvidedKeyEscapeRegex, '$&/');
301 -}
302 -
303 -/**
304 - * PooledClass representing the bookkeeping associated with performing a child
305 - * traversal. Allows avoiding binding callbacks.
306 - *
307 - * @constructor ForEachBookKeeping
308 - * @param {!function} forEachFunction Function to perform traversal with.
309 - * @param {?*} forEachContext Context to perform context with.
310 - */
311 -function ForEachBookKeeping(forEachFunction, forEachContext) {
312 - this.func = forEachFunction;
313 - this.context = forEachContext;
314 - this.count = 0;
315 -}
316 -ForEachBookKeeping.prototype.destructor = function () {
317 - this.func = null;
318 - this.context = null;
319 - this.count = 0;
320 -};
321 -PooledClass.addPoolingTo(ForEachBookKeeping, twoArgumentPooler);
322 -
323 -function forEachSingleChild(bookKeeping, child, name) {
324 - var func = bookKeeping.func,
325 - context = bookKeeping.context;
326 -
327 - func.call(context, child, bookKeeping.count++);
328 -}
329 -
330 -/**
331 - * Iterates through children that are typically specified as `props.children`.
332 - *
333 - * See https://facebook.github.io/react/docs/top-level-api.html#react.children.foreach
334 - *
335 - * The provided forEachFunc(child, index) will be called for each
336 - * leaf child.
337 - *
338 - * @param {?*} children Children tree container.
339 - * @param {function(*, int)} forEachFunc
340 - * @param {*} forEachContext Context for forEachContext.
341 - */
342 -function forEachChildren(children, forEachFunc, forEachContext) {
343 - if (children == null) {
344 - return children;
345 - }
346 - var traverseContext = ForEachBookKeeping.getPooled(forEachFunc, forEachContext);
347 - traverseAllChildren(children, forEachSingleChild, traverseContext);
348 - ForEachBookKeeping.release(traverseContext);
349 -}
350 -
351 -/**
352 - * PooledClass representing the bookkeeping associated with performing a child
353 - * mapping. Allows avoiding binding callbacks.
354 - *
355 - * @constructor MapBookKeeping
356 - * @param {!*} mapResult Object containing the ordered map of results.
357 - * @param {!function} mapFunction Function to perform mapping with.
358 - * @param {?*} mapContext Context to perform mapping with.
359 - */
360 -function MapBookKeeping(mapResult, keyPrefix, mapFunction, mapContext) {
361 - this.result = mapResult;
362 - this.keyPrefix = keyPrefix;
363 - this.func = mapFunction;
364 - this.context = mapContext;
365 - this.count = 0;
366 -}
367 -MapBookKeeping.prototype.destructor = function () {
368 - this.result = null;
369 - this.keyPrefix = null;
370 - this.func = null;
371 - this.context = null;
372 - this.count = 0;
373 -};
374 -PooledClass.addPoolingTo(MapBookKeeping, fourArgumentPooler);
375 -
376 -function mapSingleChildIntoContext(bookKeeping, child, childKey) {
377 - var result = bookKeeping.result,
378 - keyPrefix = bookKeeping.keyPrefix,
379 - func = bookKeeping.func,
380 - context = bookKeeping.context;
381 -
382 -
383 - var mappedChild = func.call(context, child, bookKeeping.count++);
384 - if (Array.isArray(mappedChild)) {
385 - mapIntoWithKeyPrefixInternal(mappedChild, result, childKey, emptyFunction.thatReturnsArgument);
386 - } else if (mappedChild != null) {
387 - if (ReactElement.isValidElement(mappedChild)) {
388 - mappedChild = ReactElement.cloneAndReplaceKey(mappedChild,
389 - // Keep both the (mapped) and old keys if they differ, just as
390 - // traverseAllChildren used to do for objects as children
391 - keyPrefix + (mappedChild.key && (!child || child.key !== mappedChild.key) ? escapeUserProvidedKey(mappedChild.key) + '/' : '') + childKey);
392 - }
393 - result.push(mappedChild);
394 - }
395 -}
396 -
397 -function mapIntoWithKeyPrefixInternal(children, array, prefix, func, context) {
398 - var escapedPrefix = '';
399 - if (prefix != null) {
400 - escapedPrefix = escapeUserProvidedKey(prefix) + '/';
401 - }
402 - var traverseContext = MapBookKeeping.getPooled(array, escapedPrefix, func, context);
403 - traverseAllChildren(children, mapSingleChildIntoContext, traverseContext);
404 - MapBookKeeping.release(traverseContext);
405 -}
406 -
407 -/**
408 - * Maps children that are typically specified as `props.children`.
409 - *
410 - * See https://facebook.github.io/react/docs/top-level-api.html#react.children.map
411 - *
412 - * The provided mapFunction(child, key, index) will be called for each
413 - * leaf child.
414 - *
415 - * @param {?*} children Children tree container.
416 - * @param {function(*, int)} func The map function.
417 - * @param {*} context Context for mapFunction.
418 - * @return {object} Object containing the ordered map of results.
419 - */
420 -function mapChildren(children, func, context) {
421 - if (children == null) {
422 - return children;
423 - }
424 - var result = [];
425 - mapIntoWithKeyPrefixInternal(children, result, null, func, context);
426 - return result;
427 -}
428 -
429 -function forEachSingleChildDummy(traverseContext, child, name) {
430 - return null;
431 -}
432 -
433 -/**
434 - * Count the number of children that are typically specified as
435 - * `props.children`.
436 - *
437 - * See https://facebook.github.io/react/docs/top-level-api.html#react.children.count
438 - *
439 - * @param {?*} children Children tree container.
440 - * @return {number} The number of children.
441 - */
442 -function countChildren(children, context) {
443 - return traverseAllChildren(children, forEachSingleChildDummy, null);
444 -}
445 -
446 -/**
447 - * Flatten a children object (typically specified as `props.children`) and
448 - * return an array with appropriately re-keyed children.
449 - *
450 - * See https://facebook.github.io/react/docs/top-level-api.html#react.children.toarray
451 - */
452 -function toArray(children) {
453 - var result = [];
454 - mapIntoWithKeyPrefixInternal(children, result, null, emptyFunction.thatReturnsArgument);
455 - return result;
456 -}
457 -
458 -var ReactChildren = {
459 - forEach: forEachChildren,
460 - map: mapChildren,
461 - mapIntoWithKeyPrefixInternal: mapIntoWithKeyPrefixInternal,
462 - count: countChildren,
463 - toArray: toArray
464 -};
465 -
466 -module.exports = ReactChildren;
467 -},{"10":10,"2":2,"25":25,"26":26}],5:[function(_dereq_,module,exports){
468 -/**
469 - * Copyright 2013-present, Facebook, Inc.
470 - * All rights reserved.
471 - *
472 - * This source code is licensed under the BSD-style license found in the
473 - * LICENSE file in the root directory of this source tree. An additional grant
474 - * of patent rights can be found in the PATENTS file in the same directory.
475 - *
476 - */
477 -
478 -'use strict';
479 -
480 -var _prodInvariant = _dereq_(24),
481 - _assign = _dereq_(30);
482 -
483 -var ReactComponent = _dereq_(6);
484 -var ReactElement = _dereq_(10);
485 -var ReactPropTypeLocationNames = _dereq_(14);
486 -var ReactNoopUpdateQueue = _dereq_(13);
487 -
488 -var emptyObject = _dereq_(27);
489 -var invariant = _dereq_(28);
490 -var warning = _dereq_(29);
491 -
492 -var MIXINS_KEY = 'mixins';
493 -
494 -// Helper function to allow the creation of anonymous functions which do not
495 -// have .name set to the name of the variable being assigned to.
496 -function identity(fn) {
497 - return fn;
498 -}
499 -
500 -/**
501 - * Policies that describe methods in `ReactClassInterface`.
502 - */
503 -
504 -
505 -var injectedMixins = [];
506 -
507 -/**
508 - * Composite components are higher-level components that compose other composite
509 - * or host components.
510 - *
511 - * To create a new type of `ReactClass`, pass a specification of
512 - * your new class to `React.createClass`. The only requirement of your class
513 - * specification is that you implement a `render` method.
514 - *
515 - * var MyComponent = React.createClass({
516 - * render: function() {
517 - * return <div>Hello World</div>;
518 - * }
519 - * });
520 - *
521 - * The class specification supports a specific protocol of methods that have
522 - * special meaning (e.g. `render`). See `ReactClassInterface` for
523 - * more the comprehensive protocol. Any other properties and methods in the
524 - * class specification will be available on the prototype.
525 - *
526 - * @interface ReactClassInterface
527 - * @internal
528 - */
529 -var ReactClassInterface = {
530 -
531 - /**
532 - * An array of Mixin objects to include when defining your component.
533 - *
534 - * @type {array}
535 - * @optional
536 - */
537 - mixins: 'DEFINE_MANY',
538 -
539 - /**
540 - * An object containing properties and methods that should be defined on
541 - * the component's constructor instead of its prototype (static methods).
542 - *
543 - * @type {object}
544 - * @optional
545 - */
546 - statics: 'DEFINE_MANY',
547 -
548 - /**
549 - * Definition of prop types for this component.
550 - *
551 - * @type {object}
552 - * @optional
553 - */
554 - propTypes: 'DEFINE_MANY',
555 -
556 - /**
557 - * Definition of context types for this component.
558 - *
559 - * @type {object}
560 - * @optional
561 - */
562 - contextTypes: 'DEFINE_MANY',
563 -
564 - /**
565 - * Definition of context types this component sets for its children.
566 - *
567 - * @type {object}
568 - * @optional
569 - */
570 - childContextTypes: 'DEFINE_MANY',
571 -
572 - // ==== Definition methods ====
573 -
574 - /**
575 - * Invoked when the component is mounted. Values in the mapping will be set on
576 - * `this.props` if that prop is not specified (i.e. using an `in` check).
577 - *
578 - * This method is invoked before `getInitialState` and therefore cannot rely
579 - * on `this.state` or use `this.setState`.
580 - *
581 - * @return {object}
582 - * @optional
583 - */
584 - getDefaultProps: 'DEFINE_MANY_MERGED',
585 -
586 - /**
587 - * Invoked once before the component is mounted. The return value will be used
588 - * as the initial value of `this.state`.
589 - *
590 - * getInitialState: function() {
591 - * return {
592 - * isOn: false,
593 - * fooBaz: new BazFoo()
594 - * }
595 - * }
596 - *
597 - * @return {object}
598 - * @optional
599 - */
600 - getInitialState: 'DEFINE_MANY_MERGED',
601 -
602 - /**
603 - * @return {object}
604 - * @optional
605 - */
606 - getChildContext: 'DEFINE_MANY_MERGED',
607 -
608 - /**
609 - * Uses props from `this.props` and state from `this.state` to render the
610 - * structure of the component.
611 - *
612 - * No guarantees are made about when or how often this method is invoked, so
613 - * it must not have side effects.
614 - *
615 - * render: function() {
616 - * var name = this.props.name;
617 - * return <div>Hello, {name}!</div>;
618 - * }
619 - *
620 - * @return {ReactComponent}
621 - * @nosideeffects
622 - * @required
623 - */
624 - render: 'DEFINE_ONCE',
625 -
626 - // ==== Delegate methods ====
627 -
628 - /**
629 - * Invoked when the component is initially created and about to be mounted.
630 - * This may have side effects, but any external subscriptions or data created
631 - * by this method must be cleaned up in `componentWillUnmount`.
632 - *
633 - * @optional
634 - */
635 - componentWillMount: 'DEFINE_MANY',
636 -
637 - /**
638 - * Invoked when the component has been mounted and has a DOM representation.
639 - * However, there is no guarantee that the DOM node is in the document.
640 - *
641 - * Use this as an opportunity to operate on the DOM when the component has
642 - * been mounted (initialized and rendered) for the first time.
643 - *
644 - * @param {DOMElement} rootNode DOM element representing the component.
645 - * @optional
646 - */
647 - componentDidMount: 'DEFINE_MANY',
648 -
649 - /**
650 - * Invoked before the component receives new props.
651 - *
652 - * Use this as an opportunity to react to a prop transition by updating the
653 - * state using `this.setState`. Current props are accessed via `this.props`.
654 - *
655 - * componentWillReceiveProps: function(nextProps, nextContext) {
656 - * this.setState({
657 - * likesIncreasing: nextProps.likeCount > this.props.likeCount
658 - * });
659 - * }
660 - *
661 - * NOTE: There is no equivalent `componentWillReceiveState`. An incoming prop
662 - * transition may cause a state change, but the opposite is not true. If you
663 - * need it, you are probably looking for `componentWillUpdate`.
664 - *
665 - * @param {object} nextProps
666 - * @optional
667 - */
668 - componentWillReceiveProps: 'DEFINE_MANY',
669 -
670 - /**
671 - * Invoked while deciding if the component should be updated as a result of
672 - * receiving new props, state and/or context.
673 - *
674 - * Use this as an opportunity to `return false` when you're certain that the
675 - * transition to the new props/state/context will not require a component
676 - * update.
677 - *
678 - * shouldComponentUpdate: function(nextProps, nextState, nextContext) {
679 - * return !equal(nextProps, this.props) ||
680 - * !equal(nextState, this.state) ||
681 - * !equal(nextContext, this.context);
682 - * }
683 - *
684 - * @param {object} nextProps
685 - * @param {?object} nextState
686 - * @param {?object} nextContext
687 - * @return {boolean} True if the component should update.
688 - * @optional
689 - */
690 - shouldComponentUpdate: 'DEFINE_ONCE',
691 -
692 - /**
693 - * Invoked when the component is about to update due to a transition from
694 - * `this.props`, `this.state` and `this.context` to `nextProps`, `nextState`
695 - * and `nextContext`.
696 - *
697 - * Use this as an opportunity to perform preparation before an update occurs.
698 - *
699 - * NOTE: You **cannot** use `this.setState()` in this method.
700 - *
701 - * @param {object} nextProps
702 - * @param {?object} nextState
703 - * @param {?object} nextContext
704 - * @param {ReactReconcileTransaction} transaction
705 - * @optional
706 - */
707 - componentWillUpdate: 'DEFINE_MANY',
708 -
709 - /**
710 - * Invoked when the component's DOM representation has been updated.
711 - *
712 - * Use this as an opportunity to operate on the DOM when the component has
713 - * been updated.
714 - *
715 - * @param {object} prevProps
716 - * @param {?object} prevState
717 - * @param {?object} prevContext
718 - * @param {DOMElement} rootNode DOM element representing the component.
719 - * @optional
720 - */
721 - componentDidUpdate: 'DEFINE_MANY',
722 -
723 - /**
724 - * Invoked when the component is about to be removed from its parent and have
725 - * its DOM representation destroyed.
726 - *
727 - * Use this as an opportunity to deallocate any external resources.
728 - *
729 - * NOTE: There is no `componentDidUnmount` since your component will have been
730 - * destroyed by that point.
731 - *
732 - * @optional
733 - */
734 - componentWillUnmount: 'DEFINE_MANY',
735 -
736 - // ==== Advanced methods ====
737 -
738 - /**
739 - * Updates the component's currently mounted DOM representation.
740 - *
741 - * By default, this implements React's rendering and reconciliation algorithm.
742 - * Sophisticated clients may wish to override this.
743 - *
744 - * @param {ReactReconcileTransaction} transaction
745 - * @internal
746 - * @overridable
747 - */
748 - updateComponent: 'OVERRIDE_BASE'
749 -
750 -};
751 -
752 -/**
753 - * Mapping from class specification keys to special processing functions.
754 - *
755 - * Although these are declared like instance properties in the specification
756 - * when defining classes using `React.createClass`, they are actually static
757 - * and are accessible on the constructor instead of the prototype. Despite
758 - * being static, they must be defined outside of the "statics" key under
759 - * which all other static methods are defined.
760 - */
761 -var RESERVED_SPEC_KEYS = {
762 - displayName: function (Constructor, displayName) {
763 - Constructor.displayName = displayName;
764 - },
765 - mixins: function (Constructor, mixins) {
766 - if (mixins) {
767 - for (var i = 0; i < mixins.length; i++) {
768 - mixSpecIntoComponent(Constructor, mixins[i]);
769 - }
770 - }
771 - },
772 - childContextTypes: function (Constructor, childContextTypes) {
773 - if ("development" !== 'production') {
774 - validateTypeDef(Constructor, childContextTypes, 'childContext');
775 - }
776 - Constructor.childContextTypes = _assign({}, Constructor.childContextTypes, childContextTypes);
777 - },
778 - contextTypes: function (Constructor, contextTypes) {
779 - if ("development" !== 'production') {
780 - validateTypeDef(Constructor, contextTypes, 'context');
781 - }
782 - Constructor.contextTypes = _assign({}, Constructor.contextTypes, contextTypes);
783 - },
784 - /**
785 - * Special case getDefaultProps which should move into statics but requires
786 - * automatic merging.
787 - */
788 - getDefaultProps: function (Constructor, getDefaultProps) {
789 - if (Constructor.getDefaultProps) {
790 - Constructor.getDefaultProps = createMergedResultFunction(Constructor.getDefaultProps, getDefaultProps);
791 - } else {
792 - Constructor.getDefaultProps = getDefaultProps;
793 - }
794 - },
795 - propTypes: function (Constructor, propTypes) {
796 - if ("development" !== 'production') {
797 - validateTypeDef(Constructor, propTypes, 'prop');
798 - }
799 - Constructor.propTypes = _assign({}, Constructor.propTypes, propTypes);
800 - },
801 - statics: function (Constructor, statics) {
802 - mixStaticSpecIntoComponent(Constructor, statics);
803 - },
804 - autobind: function () {} };
805 -
806 -function validateTypeDef(Constructor, typeDef, location) {
807 - for (var propName in typeDef) {
808 - if (typeDef.hasOwnProperty(propName)) {
809 - // use a warning instead of an invariant so components
810 - // don't show up in prod but only in __DEV__
811 - "development" !== '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;
812 - }
813 - }
814 -}
815 -
816 -function validateMethodOverride(isAlreadyDefined, name) {
817 - var specPolicy = ReactClassInterface.hasOwnProperty(name) ? ReactClassInterface[name] : null;
818 -
819 - // Disallow overriding of base class methods unless explicitly allowed.
820 - if (ReactClassMixin.hasOwnProperty(name)) {
821 - !(specPolicy === 'OVERRIDE_BASE') ? "development" !== '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) : _prodInvariant('73', name) : void 0;
822 - }
823 -
824 - // Disallow defining methods more than once unless explicitly allowed.
825 - if (isAlreadyDefined) {
826 - !(specPolicy === 'DEFINE_MANY' || specPolicy === 'DEFINE_MANY_MERGED') ? "development" !== '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) : _prodInvariant('74', name) : void 0;
827 - }
828 -}
829 -
830 -/**
831 - * Mixin helper which handles policy validation and reserved
832 - * specification keys when building React classes.
833 - */
834 -function mixSpecIntoComponent(Constructor, spec) {
835 - if (!spec) {
836 - if ("development" !== 'production') {
837 - var typeofSpec = typeof spec;
838 - var isMixinValid = typeofSpec === 'object' && spec !== null;
839 -
840 - "development" !== 'production' ? warning(isMixinValid, '%s: You\'re attempting to include a mixin that is either null ' + 'or not an object. Check the mixins included by the component, ' + 'as well as any mixins they include themselves. ' + 'Expected object but got %s.', Constructor.displayName || 'ReactClass', spec === null ? null : typeofSpec) : void 0;
841 - }
842 -
843 - return;
844 - }
845 -
846 - !(typeof spec !== 'function') ? "development" !== 'production' ? invariant(false, 'ReactClass: You\'re attempting to use a component class or function as a mixin. Instead, just use a regular object.') : _prodInvariant('75') : void 0;
847 - !!ReactElement.isValidElement(spec) ? "development" !== 'production' ? invariant(false, 'ReactClass: You\'re attempting to use a component as a mixin. Instead, just use a regular object.') : _prodInvariant('76') : void 0;
848 -
849 - var proto = Constructor.prototype;
850 - var autoBindPairs = proto.__reactAutoBindPairs;
851 -
852 - // By handling mixins before any other properties, we ensure the same
853 - // chaining order is applied to methods with DEFINE_MANY policy, whether
854 - // mixins are listed before or after these methods in the spec.
855 - if (spec.hasOwnProperty(MIXINS_KEY)) {
856 - RESERVED_SPEC_KEYS.mixins(Constructor, spec.mixins);
857 - }
858 -
859 - for (var name in spec) {
860 - if (!spec.hasOwnProperty(name)) {
861 - continue;
862 - }
863 -
864 - if (name === MIXINS_KEY) {
865 - // We have already handled mixins in a special case above.
866 - continue;
867 - }
868 -
869 - var property = spec[name];
870 - var isAlreadyDefined = proto.hasOwnProperty(name);
871 - validateMethodOverride(isAlreadyDefined, name);
872 -
873 - if (RESERVED_SPEC_KEYS.hasOwnProperty(name)) {
874 - RESERVED_SPEC_KEYS[name](Constructor, property);
875 - } else {
876 - // Setup methods on prototype:
877 - // The following member methods should not be automatically bound:
878 - // 1. Expected ReactClass methods (in the "interface").
879 - // 2. Overridden methods (that were mixed in).
880 - var isReactClassMethod = ReactClassInterface.hasOwnProperty(name);
881 - var isFunction = typeof property === 'function';
882 - var shouldAutoBind = isFunction && !isReactClassMethod && !isAlreadyDefined && spec.autobind !== false;
883 -
884 - if (shouldAutoBind) {
885 - autoBindPairs.push(name, property);
886 - proto[name] = property;
887 - } else {
888 - if (isAlreadyDefined) {
889 - var specPolicy = ReactClassInterface[name];
890 -
891 - // These cases should already be caught by validateMethodOverride.
892 - !(isReactClassMethod && (specPolicy === 'DEFINE_MANY_MERGED' || specPolicy === 'DEFINE_MANY')) ? "development" !== 'production' ? invariant(false, 'ReactClass: Unexpected spec policy %s for key %s when mixing in component specs.', specPolicy, name) : _prodInvariant('77', specPolicy, name) : void 0;
893 -
894 - // For methods which are defined more than once, call the existing
895 - // methods before calling the new property, merging if appropriate.
896 - if (specPolicy === 'DEFINE_MANY_MERGED') {
897 - proto[name] = createMergedResultFunction(proto[name], property);
898 - } else if (specPolicy === 'DEFINE_MANY') {
899 - proto[name] = createChainedFunction(proto[name], property);
900 - }
901 - } else {
902 - proto[name] = property;
903 - if ("development" !== 'production') {
904 - // Add verbose displayName to the function, which helps when looking
905 - // at profiling tools.
906 - if (typeof property === 'function' && spec.displayName) {
907 - proto[name].displayName = spec.displayName + '_' + name;
908 - }
909 - }
910 - }
911 - }
912 - }
913 - }
914 -}
915 -
916 -function mixStaticSpecIntoComponent(Constructor, statics) {
917 - if (!statics) {
918 - return;
919 - }
920 - for (var name in statics) {
921 - var property = statics[name];
922 - if (!statics.hasOwnProperty(name)) {
923 - continue;
924 - }
925 -
926 - var isReserved = name in RESERVED_SPEC_KEYS;
927 - !!isReserved ? "development" !== '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) : _prodInvariant('78', name) : void 0;
928 -
929 - var isInherited = name in Constructor;
930 - !!isInherited ? "development" !== '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) : _prodInvariant('79', name) : void 0;
931 - Constructor[name] = property;
932 - }
933 -}
934 -
935 -/**
936 - * Merge two objects, but throw if both contain the same key.
937 - *
938 - * @param {object} one The first object, which is mutated.
939 - * @param {object} two The second object
940 - * @return {object} one after it has been mutated to contain everything in two.
941 - */
942 -function mergeIntoWithNoDuplicateKeys(one, two) {
943 - !(one && two && typeof one === 'object' && typeof two === 'object') ? "development" !== 'production' ? invariant(false, 'mergeIntoWithNoDuplicateKeys(): Cannot merge non-objects.') : _prodInvariant('80') : void 0;
944 -
945 - for (var key in two) {
946 - if (two.hasOwnProperty(key)) {
947 - !(one[key] === undefined) ? "development" !== '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) : _prodInvariant('81', key) : void 0;
948 - one[key] = two[key];
949 - }
950 - }
951 - return one;
952 -}
953 -
954 -/**
955 - * Creates a function that invokes two functions and merges their return values.
956 - *
957 - * @param {function} one Function to invoke first.
958 - * @param {function} two Function to invoke second.
959 - * @return {function} Function that invokes the two argument functions.
960 - * @private
961 - */
962 -function createMergedResultFunction(one, two) {
963 - return function mergedResult() {
964 - var a = one.apply(this, arguments);
965 - var b = two.apply(this, arguments);
966 - if (a == null) {
967 - return b;
968 - } else if (b == null) {
969 - return a;
970 - }
971 - var c = {};
972 - mergeIntoWithNoDuplicateKeys(c, a);
973 - mergeIntoWithNoDuplicateKeys(c, b);
974 - return c;
975 - };
976 -}
977 -
978 -/**
979 - * Creates a function that invokes two functions and ignores their return vales.
980 - *
981 - * @param {function} one Function to invoke first.
982 - * @param {function} two Function to invoke second.
983 - * @return {function} Function that invokes the two argument functions.
984 - * @private
985 - */
986 -function createChainedFunction(one, two) {
987 - return function chainedFunction() {
988 - one.apply(this, arguments);
989 - two.apply(this, arguments);
990 - };
991 -}
992 -
993 -/**
994 - * Binds a method to the component.
995 - *
996 - * @param {object} component Component whose method is going to be bound.
997 - * @param {function} method Method to be bound.
998 - * @return {function} The bound method.
999 - */
1000 -function bindAutoBindMethod(component, method) {
1001 - var boundMethod = method.bind(component);
1002 - if ("development" !== 'production') {
1003 - boundMethod.__reactBoundContext = component;
1004 - boundMethod.__reactBoundMethod = method;
1005 - boundMethod.__reactBoundArguments = null;
1006 - var componentName = component.constructor.displayName;
1007 - var _bind = boundMethod.bind;
1008 - boundMethod.bind = function (newThis) {
1009 - for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
1010 - args[_key - 1] = arguments[_key];
1011 - }
1012 -
1013 - // User is trying to bind() an autobound method; we effectively will
1014 - // ignore the value of "this" that the user is trying to use, so
1015 - // let's warn.
1016 - if (newThis !== component && newThis !== null) {
1017 - "development" !== 'production' ? warning(false, 'bind(): React component methods may only be bound to the ' + 'component instance. See %s', componentName) : void 0;
1018 - } else if (!args.length) {
1019 - "development" !== '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;
1020 - return boundMethod;
1021 - }
1022 - var reboundMethod = _bind.apply(boundMethod, arguments);
1023 - reboundMethod.__reactBoundContext = component;
1024 - reboundMethod.__reactBoundMethod = method;
1025 - reboundMethod.__reactBoundArguments = args;
1026 - return reboundMethod;
1027 - };
1028 - }
1029 - return boundMethod;
1030 -}
1031 -
1032 -/**
1033 - * Binds all auto-bound methods in a component.
1034 - *
1035 - * @param {object} component Component whose method is going to be bound.
1036 - */
1037 -function bindAutoBindMethods(component) {
1038 - var pairs = component.__reactAutoBindPairs;
1039 - for (var i = 0; i < pairs.length; i += 2) {
1040 - var autoBindKey = pairs[i];
1041 - var method = pairs[i + 1];
1042 - component[autoBindKey] = bindAutoBindMethod(component, method);
1043 - }
1044 -}
1045 -
1046 -/**
1047 - * Add more to the ReactClass base class. These are all legacy features and
1048 - * therefore not already part of the modern ReactComponent.
1049 - */
1050 -var ReactClassMixin = {
1051 -
1052 - /**
1053 - * TODO: This will be deprecated because state should always keep a consistent
1054 - * type signature and the only use case for this, is to avoid that.
1055 - */
1056 - replaceState: function (newState, callback) {
1057 - this.updater.enqueueReplaceState(this, newState);
1058 - if (callback) {
1059 - this.updater.enqueueCallback(this, callback, 'replaceState');
1060 - }
1061 - },
1062 -
1063 - /**
1064 - * Checks whether or not this composite component is mounted.
1065 - * @return {boolean} True if mounted, false otherwise.
1066 - * @protected
1067 - * @final
1068 - */
1069 - isMounted: function () {
1070 - return this.updater.isMounted(this);
1071 - }
1072 -};
1073 -
1074 -var ReactClassComponent = function () {};
1075 -_assign(ReactClassComponent.prototype, ReactComponent.prototype, ReactClassMixin);
1076 -
1077 -/**
1078 - * Module for creating composite components.
1079 - *
1080 - * @class ReactClass
1081 - */
1082 -var ReactClass = {
1083 -
1084 - /**
1085 - * Creates a composite component class given a class specification.
1086 - * See https://facebook.github.io/react/docs/top-level-api.html#react.createclass
1087 - *
1088 - * @param {object} spec Class specification (which must define `render`).
1089 - * @return {function} Component constructor function.
1090 - * @public
1091 - */
1092 - createClass: function (spec) {
1093 - // To keep our warnings more understandable, we'll use a little hack here to
1094 - // ensure that Constructor.name !== 'Constructor'. This makes sure we don't
1095 - // unnecessarily identify a class without displayName as 'Constructor'.
1096 - var Constructor = identity(function (props, context, updater) {
1097 - // This constructor gets overridden by mocks. The argument is used
1098 - // by mocks to assert on what gets mounted.
1099 -
1100 - if ("development" !== 'production') {
1101 - "development" !== '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;
1102 - }
1103 -
1104 - // Wire up auto-binding
1105 - if (this.__reactAutoBindPairs.length) {
1106 - bindAutoBindMethods(this);
1107 - }
1108 -
1109 - this.props = props;
1110 - this.context = context;
1111 - this.refs = emptyObject;
1112 - this.updater = updater || ReactNoopUpdateQueue;
1113 -
1114 - this.state = null;
1115 -
1116 - // ReactClasses doesn't have constructors. Instead, they use the
1117 - // getInitialState and componentWillMount methods for initialization.
1118 -
1119 - var initialState = this.getInitialState ? this.getInitialState() : null;
1120 - if ("development" !== 'production') {
1121 - // We allow auto-mocks to proceed as if they're returning null.
1122 - if (initialState === undefined && this.getInitialState._isMockFunction) {
1123 - // This is probably bad practice. Consider warning here and
1124 - // deprecating this convenience.
1125 - initialState = null;
1126 - }
1127 - }
1128 - !(typeof initialState === 'object' && !Array.isArray(initialState)) ? "development" !== 'production' ? invariant(false, '%s.getInitialState(): must return an object or null', Constructor.displayName || 'ReactCompositeComponent') : _prodInvariant('82', Constructor.displayName || 'ReactCompositeComponent') : void 0;
1129 -
1130 - this.state = initialState;
1131 - });
1132 - Constructor.prototype = new ReactClassComponent();
1133 - Constructor.prototype.constructor = Constructor;
1134 - Constructor.prototype.__reactAutoBindPairs = [];
1135 -
1136 - injectedMixins.forEach(mixSpecIntoComponent.bind(null, Constructor));
1137 -
1138 - mixSpecIntoComponent(Constructor, spec);
1139 -
1140 - // Initialize the defaultProps property after all mixins have been merged.
1141 - if (Constructor.getDefaultProps) {
1142 - Constructor.defaultProps = Constructor.getDefaultProps();
1143 - }
1144 -
1145 - if ("development" !== 'production') {
1146 - // This is a tag to indicate that the use of these method names is ok,
1147 - // since it's used with createClass. If it's not, then it's likely a
1148 - // mistake so we'll warn you to use the static property, property
1149 - // initializer or constructor respectively.
1150 - if (Constructor.getDefaultProps) {
1151 - Constructor.getDefaultProps.isReactClassApproved = {};
1152 - }
1153 - if (Constructor.prototype.getInitialState) {
1154 - Constructor.prototype.getInitialState.isReactClassApproved = {};
1155 - }
1156 - }
1157 -
1158 - !Constructor.prototype.render ? "development" !== 'production' ? invariant(false, 'createClass(...): Class specification must implement a `render` method.') : _prodInvariant('83') : void 0;
1159 -
1160 - if ("development" !== 'production') {
1161 - "development" !== '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;
1162 - "development" !== 'production' ? warning(!Constructor.prototype.componentWillRecieveProps, '%s has a method called ' + 'componentWillRecieveProps(). Did you mean componentWillReceiveProps()?', spec.displayName || 'A component') : void 0;
1163 - }
1164 -
1165 - // Reduce time spent doing lookups by setting these on the prototype.
1166 - for (var methodName in ReactClassInterface) {
1167 - if (!Constructor.prototype[methodName]) {
1168 - Constructor.prototype[methodName] = null;
1169 - }
1170 - }
1171 -
1172 - return Constructor;
1173 - },
1174 -
1175 - injection: {
1176 - injectMixin: function (mixin) {
1177 - injectedMixins.push(mixin);
1178 - }
1179 - }
1180 -
1181 -};
1182 -
1183 -module.exports = ReactClass;
1184 -},{"10":10,"13":13,"14":14,"24":24,"27":27,"28":28,"29":29,"30":30,"6":6}],6:[function(_dereq_,module,exports){
1185 -/**
1186 - * Copyright 2013-present, Facebook, Inc.
1187 - * All rights reserved.
1188 - *
1189 - * This source code is licensed under the BSD-style license found in the
1190 - * LICENSE file in the root directory of this source tree. An additional grant
1191 - * of patent rights can be found in the PATENTS file in the same directory.
1192 - *
1193 - */
1194 -
1195 -'use strict';
1196 -
1197 -var _prodInvariant = _dereq_(24);
1198 -
1199 -var ReactNoopUpdateQueue = _dereq_(13);
1200 -
1201 -var canDefineProperty = _dereq_(20);
1202 -var emptyObject = _dereq_(27);
1203 -var invariant = _dereq_(28);
1204 -var warning = _dereq_(29);
1205 -
1206 -/**
1207 - * Base class helpers for the updating state of a component.
1208 - */
1209 -function ReactComponent(props, context, updater) {
1210 - this.props = props;
1211 - this.context = context;
1212 - this.refs = emptyObject;
1213 - // We initialize the default updater but the real one gets injected by the
1214 - // renderer.
1215 - this.updater = updater || ReactNoopUpdateQueue;
1216 -}
1217 -
1218 -ReactComponent.prototype.isReactComponent = {};
1219 -
1220 -/**
1221 - * Sets a subset of the state. Always use this to mutate
1222 - * state. You should treat `this.state` as immutable.
1223 - *
1224 - * There is no guarantee that `this.state` will be immediately updated, so
1225 - * accessing `this.state` after calling this method may return the old value.
1226 - *
1227 - * There is no guarantee that calls to `setState` will run synchronously,
1228 - * as they may eventually be batched together. You can provide an optional
1229 - * callback that will be executed when the call to setState is actually
1230 - * completed.
1231 - *
1232 - * When a function is provided to setState, it will be called at some point in
1233 - * the future (not synchronously). It will be called with the up to date
1234 - * component arguments (state, props, context). These values can be different
1235 - * from this.* because your function may be called after receiveProps but before
1236 - * shouldComponentUpdate, and this new state, props, and context will not yet be
1237 - * assigned to this.
1238 - *
1239 - * @param {object|function} partialState Next partial state or function to
1240 - * produce next partial state to be merged with current state.
1241 - * @param {?function} callback Called after state is updated.
1242 - * @final
1243 - * @protected
1244 - */
1245 -ReactComponent.prototype.setState = function (partialState, callback) {
1246 - !(typeof partialState === 'object' || typeof partialState === 'function' || partialState == null) ? "development" !== 'production' ? invariant(false, 'setState(...): takes an object of state variables to update or a function which returns an object of state variables.') : _prodInvariant('85') : void 0;
1247 - this.updater.enqueueSetState(this, partialState);
1248 - if (callback) {
1249 - this.updater.enqueueCallback(this, callback, 'setState');
1250 - }
1251 -};
1252 -
1253 -/**
1254 - * Forces an update. This should only be invoked when it is known with
1255 - * certainty that we are **not** in a DOM transaction.
1256 - *
1257 - * You may want to call this when you know that some deeper aspect of the
1258 - * component's state has changed but `setState` was not called.
1259 - *
1260 - * This will not invoke `shouldComponentUpdate`, but it will invoke
1261 - * `componentWillUpdate` and `componentDidUpdate`.
1262 - *
1263 - * @param {?function} callback Called after update is complete.
1264 - * @final
1265 - * @protected
1266 - */
1267 -ReactComponent.prototype.forceUpdate = function (callback) {
1268 - this.updater.enqueueForceUpdate(this);
1269 - if (callback) {
1270 - this.updater.enqueueCallback(this, callback, 'forceUpdate');
1271 - }
1272 -};
1273 -
1274 -/**
1275 - * Deprecated APIs. These APIs used to exist on classic React classes but since
1276 - * we would like to deprecate them, we're not going to move them over to this
1277 - * modern base class. Instead, we define a getter that warns if it's accessed.
1278 - */
1279 -if ("development" !== 'production') {
1280 - var deprecatedAPIs = {
1281 - isMounted: ['isMounted', 'Instead, make sure to clean up subscriptions and pending requests in ' + 'componentWillUnmount to prevent memory leaks.'],
1282 - replaceState: ['replaceState', 'Refactor your code to use setState instead (see ' + 'https://github.com/facebook/react/issues/3236).']
1283 - };
1284 - var defineDeprecationWarning = function (methodName, info) {
1285 - if (canDefineProperty) {
1286 - Object.defineProperty(ReactComponent.prototype, methodName, {
1287 - get: function () {
1288 - "development" !== 'production' ? warning(false, '%s(...) is deprecated in plain JavaScript React classes. %s', info[0], info[1]) : void 0;
1289 - return undefined;
1290 - }
1291 - });
1292 - }
1293 - };
1294 - for (var fnName in deprecatedAPIs) {
1295 - if (deprecatedAPIs.hasOwnProperty(fnName)) {
1296 - defineDeprecationWarning(fnName, deprecatedAPIs[fnName]);
1297 - }
1298 - }
1299 -}
1300 -
1301 -module.exports = ReactComponent;
1302 -},{"13":13,"20":20,"24":24,"27":27,"28":28,"29":29}],7:[function(_dereq_,module,exports){
1303 -/**
1304 - * Copyright 2016-present, Facebook, Inc.
1305 - * All rights reserved.
1306 - *
1307 - * This source code is licensed under the BSD-style license found in the
1308 - * LICENSE file in the root directory of this source tree. An additional grant
1309 - * of patent rights can be found in the PATENTS file in the same directory.
1310 - *
1311 - *
1312 - */
1313 -
1314 -'use strict';
1315 -
1316 -var _prodInvariant = _dereq_(24);
1317 -
1318 -var ReactCurrentOwner = _dereq_(8);
1319 -
1320 -var invariant = _dereq_(28);
1321 -var warning = _dereq_(29);
1322 -
1323 -function isNative(fn) {
1324 - // Based on isNative() from Lodash
1325 - var funcToString = Function.prototype.toString;
1326 - var hasOwnProperty = Object.prototype.hasOwnProperty;
1327 - var reIsNative = RegExp('^' + funcToString
1328 - // Take an example native function source for comparison
1329 - .call(hasOwnProperty)
1330 - // Strip regex characters so we can use it for regex
1331 - .replace(/[\\^$.*+?()[\]{}|]/g, '\\$&')
1332 - // Remove hasOwnProperty from the template to make it generic
1333 - .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$');
1334 - try {
1335 - var source = funcToString.call(fn);
1336 - return reIsNative.test(source);
1337 - } catch (err) {
1338 - return false;
1339 - }
1340 -}
1341 -
1342 -var canUseCollections =
1343 -// Array.from
1344 -typeof Array.from === 'function' &&
1345 -// Map
1346 -typeof Map === 'function' && isNative(Map) &&
1347 -// Map.prototype.keys
1348 -Map.prototype != null && typeof Map.prototype.keys === 'function' && isNative(Map.prototype.keys) &&
1349 -// Set
1350 -typeof Set === 'function' && isNative(Set) &&
1351 -// Set.prototype.keys
1352 -Set.prototype != null && typeof Set.prototype.keys === 'function' && isNative(Set.prototype.keys);
1353 -
1354 -if (canUseCollections) {
1355 - var itemMap = new Map();
1356 - var rootIDSet = new Set();
1357 -
1358 - var setItem = function (id, item) {
1359 - itemMap.set(id, item);
1360 - };
1361 - var getItem = function (id) {
1362 - return itemMap.get(id);
1363 - };
1364 - var removeItem = function (id) {
1365 - itemMap['delete'](id);
1366 - };
1367 - var getItemIDs = function () {
1368 - return Array.from(itemMap.keys());
1369 - };
1370 -
1371 - var addRoot = function (id) {
1372 - rootIDSet.add(id);
1373 - };
1374 - var removeRoot = function (id) {
1375 - rootIDSet['delete'](id);
1376 - };
1377 - var getRootIDs = function () {
1378 - return Array.from(rootIDSet.keys());
1379 - };
1380 -} else {
1381 - var itemByKey = {};
1382 - var rootByKey = {};
1383 -
1384 - // Use non-numeric keys to prevent V8 performance issues:
1385 - // https://github.com/facebook/react/pull/7232
1386 - var getKeyFromID = function (id) {
1387 - return '.' + id;
1388 - };
1389 - var getIDFromKey = function (key) {
1390 - return parseInt(key.substr(1), 10);
1391 - };
1392 -
1393 - var setItem = function (id, item) {
1394 - var key = getKeyFromID(id);
1395 - itemByKey[key] = item;
1396 - };
1397 - var getItem = function (id) {
1398 - var key = getKeyFromID(id);
1399 - return itemByKey[key];
1400 - };
1401 - var removeItem = function (id) {
1402 - var key = getKeyFromID(id);
1403 - delete itemByKey[key];
1404 - };
1405 - var getItemIDs = function () {
1406 - return Object.keys(itemByKey).map(getIDFromKey);
1407 - };
1408 -
1409 - var addRoot = function (id) {
1410 - var key = getKeyFromID(id);
1411 - rootByKey[key] = true;
1412 - };
1413 - var removeRoot = function (id) {
1414 - var key = getKeyFromID(id);
1415 - delete rootByKey[key];
1416 - };
1417 - var getRootIDs = function () {
1418 - return Object.keys(rootByKey).map(getIDFromKey);
1419 - };
1420 -}
1421 -
1422 -var unmountedIDs = [];
1423 -
1424 -function purgeDeep(id) {
1425 - var item = getItem(id);
1426 - if (item) {
1427 - var childIDs = item.childIDs;
1428 -
1429 - removeItem(id);
1430 - childIDs.forEach(purgeDeep);
1431 - }
1432 -}
1433 -
1434 -function describeComponentFrame(name, source, ownerName) {
1435 - return '\n in ' + (name || 'Unknown') + (source ? ' (at ' + source.fileName.replace(/^.*[\\\/]/, '') + ':' + source.lineNumber + ')' : ownerName ? ' (created by ' + ownerName + ')' : '');
1436 -}
1437 -
1438 -function getDisplayName(element) {
1439 - if (element == null) {
1440 - return '#empty';
1441 - } else if (typeof element === 'string' || typeof element === 'number') {
1442 - return '#text';
1443 - } else if (typeof element.type === 'string') {
1444 - return element.type;
1445 - } else {
1446 - return element.type.displayName || element.type.name || 'Unknown';
1447 - }
1448 -}
1449 -
1450 -function describeID(id) {
1451 - var name = ReactComponentTreeHook.getDisplayName(id);
1452 - var element = ReactComponentTreeHook.getElement(id);
1453 - var ownerID = ReactComponentTreeHook.getOwnerID(id);
1454 - var ownerName;
1455 - if (ownerID) {
1456 - ownerName = ReactComponentTreeHook.getDisplayName(ownerID);
1457 - }
1458 - "development" !== 'production' ? warning(element, 'ReactComponentTreeHook: Missing React element for debugID %s when ' + 'building stack', id) : void 0;
1459 - return describeComponentFrame(name, element && element._source, ownerName);
1460 -}
1461 -
1462 -var ReactComponentTreeHook = {
1463 - onSetChildren: function (id, nextChildIDs) {
1464 - var item = getItem(id);
1465 - !item ? "development" !== 'production' ? invariant(false, 'Item must have been set') : _prodInvariant('144') : void 0;
1466 - item.childIDs = nextChildIDs;
1467 -
1468 - for (var i = 0; i < nextChildIDs.length; i++) {
1469 - var nextChildID = nextChildIDs[i];
1470 - var nextChild = getItem(nextChildID);
1471 - !nextChild ? "development" !== 'production' ? invariant(false, 'Expected hook events to fire for the child before its parent includes it in onSetChildren().') : _prodInvariant('140') : void 0;
1472 - !(nextChild.childIDs != null || typeof nextChild.element !== 'object' || nextChild.element == null) ? "development" !== 'production' ? invariant(false, 'Expected onSetChildren() to fire for a container child before its parent includes it in onSetChildren().') : _prodInvariant('141') : void 0;
1473 - !nextChild.isMounted ? "development" !== 'production' ? invariant(false, 'Expected onMountComponent() to fire for the child before its parent includes it in onSetChildren().') : _prodInvariant('71') : void 0;
1474 - if (nextChild.parentID == null) {
1475 - nextChild.parentID = id;
1476 - // TODO: This shouldn't be necessary but mounting a new root during in
1477 - // componentWillMount currently causes not-yet-mounted components to
1478 - // be purged from our tree data so their parent id is missing.
1479 - }
1480 - !(nextChild.parentID === id) ? "development" !== 'production' ? invariant(false, 'Expected onBeforeMountComponent() parent and onSetChildren() to be consistent (%s has parents %s and %s).', nextChildID, nextChild.parentID, id) : _prodInvariant('142', nextChildID, nextChild.parentID, id) : void 0;
1481 - }
1482 - },
1483 - onBeforeMountComponent: function (id, element, parentID) {
1484 - var item = {
1485 - element: element,
1486 - parentID: parentID,
1487 - text: null,
1488 - childIDs: [],
1489 - isMounted: false,
1490 - updateCount: 0
1491 - };
1492 - setItem(id, item);
1493 - },
1494 - onBeforeUpdateComponent: function (id, element) {
1495 - var item = getItem(id);
1496 - if (!item || !item.isMounted) {
1497 - // We may end up here as a result of setState() in componentWillUnmount().
1498 - // In this case, ignore the element.
1499 - return;
1500 - }
1501 - item.element = element;
1502 - },
1503 - onMountComponent: function (id) {
1504 - var item = getItem(id);
1505 - !item ? "development" !== 'production' ? invariant(false, 'Item must have been set') : _prodInvariant('144') : void 0;
1506 - item.isMounted = true;
1507 - var isRoot = item.parentID === 0;
1508 - if (isRoot) {
1509 - addRoot(id);
1510 - }
1511 - },
1512 - onUpdateComponent: function (id) {
1513 - var item = getItem(id);
1514 - if (!item || !item.isMounted) {
1515 - // We may end up here as a result of setState() in componentWillUnmount().
1516 - // In this case, ignore the element.
1517 - return;
1518 - }
1519 - item.updateCount++;
1520 - },
1521 - onUnmountComponent: function (id) {
1522 - var item = getItem(id);
1523 - if (item) {
1524 - // We need to check if it exists.
1525 - // `item` might not exist if it is inside an error boundary, and a sibling
1526 - // error boundary child threw while mounting. Then this instance never
1527 - // got a chance to mount, but it still gets an unmounting event during
1528 - // the error boundary cleanup.
1529 - item.isMounted = false;
1530 - var isRoot = item.parentID === 0;
1531 - if (isRoot) {
1532 - removeRoot(id);
1533 - }
1534 - }
1535 - unmountedIDs.push(id);
1536 - },
1537 - purgeUnmountedComponents: function () {
1538 - if (ReactComponentTreeHook._preventPurging) {
1539 - // Should only be used for testing.
1540 - return;
1541 - }
1542 -
1543 - for (var i = 0; i < unmountedIDs.length; i++) {
1544 - var id = unmountedIDs[i];
1545 - purgeDeep(id);
1546 - }
1547 - unmountedIDs.length = 0;
1548 - },
1549 - isMounted: function (id) {
1550 - var item = getItem(id);
1551 - return item ? item.isMounted : false;
1552 - },
1553 - getCurrentStackAddendum: function (topElement) {
1554 - var info = '';
1555 - if (topElement) {
1556 - var name = getDisplayName(topElement);
1557 - var owner = topElement._owner;
1558 - info += describeComponentFrame(name, topElement._source, owner && owner.getName());
1559 - }
1560 -
1561 - var currentOwner = ReactCurrentOwner.current;
1562 - var id = currentOwner && currentOwner._debugID;
1563 -
1564 - info += ReactComponentTreeHook.getStackAddendumByID(id);
1565 - return info;
1566 - },
1567 - getStackAddendumByID: function (id) {
1568 - var info = '';
1569 - while (id) {
1570 - info += describeID(id);
1571 - id = ReactComponentTreeHook.getParentID(id);
1572 - }
1573 - return info;
1574 - },
1575 - getChildIDs: function (id) {
1576 - var item = getItem(id);
1577 - return item ? item.childIDs : [];
1578 - },
1579 - getDisplayName: function (id) {
1580 - var element = ReactComponentTreeHook.getElement(id);
1581 - if (!element) {
1582 - return null;
1583 - }
1584 - return getDisplayName(element);
1585 - },
1586 - getElement: function (id) {
1587 - var item = getItem(id);
1588 - return item ? item.element : null;
1589 - },
1590 - getOwnerID: function (id) {
1591 - var element = ReactComponentTreeHook.getElement(id);
1592 - if (!element || !element._owner) {
1593 - return null;
1594 - }
1595 - return element._owner._debugID;
1596 - },
1597 - getParentID: function (id) {
1598 - var item = getItem(id);
1599 - return item ? item.parentID : null;
1600 - },
1601 - getSource: function (id) {
1602 - var item = getItem(id);
1603 - var element = item ? item.element : null;
1604 - var source = element != null ? element._source : null;
1605 - return source;
1606 - },
1607 - getText: function (id) {
1608 - var element = ReactComponentTreeHook.getElement(id);
1609 - if (typeof element === 'string') {
1610 - return element;
1611 - } else if (typeof element === 'number') {
1612 - return '' + element;
1613 - } else {
1614 - return null;
1615 - }
1616 - },
1617 - getUpdateCount: function (id) {
1618 - var item = getItem(id);
1619 - return item ? item.updateCount : 0;
1620 - },
1621 -
1622 -
1623 - getRootIDs: getRootIDs,
1624 - getRegisteredIDs: getItemIDs
1625 -};
1626 -
1627 -module.exports = ReactComponentTreeHook;
1628 -},{"24":24,"28":28,"29":29,"8":8}],8:[function(_dereq_,module,exports){
1629 -/**
1630 - * Copyright 2013-present, Facebook, Inc.
1631 - * All rights reserved.
1632 - *
1633 - * This source code is licensed under the BSD-style license found in the
1634 - * LICENSE file in the root directory of this source tree. An additional grant
1635 - * of patent rights can be found in the PATENTS file in the same directory.
1636 - *
1637 - *
1638 - */
1639 -
1640 -'use strict';
1641 -
1642 -/**
1643 - * Keeps track of the current owner.
1644 - *
1645 - * The current owner is the component who should own any components that are
1646 - * currently being constructed.
1647 - */
1648 -var ReactCurrentOwner = {
1649 -
1650 - /**
1651 - * @internal
1652 - * @type {ReactComponent}
1653 - */
1654 - current: null
1655 -
1656 -};
1657 -
1658 -module.exports = ReactCurrentOwner;
1659 -},{}],9:[function(_dereq_,module,exports){
1660 -/**
1661 - * Copyright 2013-present, Facebook, Inc.
1662 - * All rights reserved.
1663 - *
1664 - * This source code is licensed under the BSD-style license found in the
1665 - * LICENSE file in the root directory of this source tree. An additional grant
1666 - * of patent rights can be found in the PATENTS file in the same directory.
1667 - *
1668 - */
1669 -
1670 -'use strict';
1671 -
1672 -var ReactElement = _dereq_(10);
1673 -
1674 -/**
1675 - * Create a factory that creates HTML tag elements.
1676 - *
1677 - * @private
1678 - */
1679 -var createDOMFactory = ReactElement.createFactory;
1680 -if ("development" !== 'production') {
1681 - var ReactElementValidator = _dereq_(12);
1682 - createDOMFactory = ReactElementValidator.createFactory;
1683 -}
1684 -
1685 -/**
1686 - * Creates a mapping from supported HTML tags to `ReactDOMComponent` classes.
1687 - * This is also accessible via `React.DOM`.
1688 - *
1689 - * @public
1690 - */
1691 -var ReactDOMFactories = {
1692 - a: createDOMFactory('a'),
1693 - abbr: createDOMFactory('abbr'),
1694 - address: createDOMFactory('address'),
1695 - area: createDOMFactory('area'),
1696 - article: createDOMFactory('article'),
1697 - aside: createDOMFactory('aside'),
1698 - audio: createDOMFactory('audio'),
1699 - b: createDOMFactory('b'),
1700 - base: createDOMFactory('base'),
1701 - bdi: createDOMFactory('bdi'),
1702 - bdo: createDOMFactory('bdo'),
1703 - big: createDOMFactory('big'),
1704 - blockquote: createDOMFactory('blockquote'),
1705 - body: createDOMFactory('body'),
1706 - br: createDOMFactory('br'),
1707 - button: createDOMFactory('button'),
1708 - canvas: createDOMFactory('canvas'),
1709 - caption: createDOMFactory('caption'),
1710 - cite: createDOMFactory('cite'),
1711 - code: createDOMFactory('code'),
1712 - col: createDOMFactory('col'),
1713 - colgroup: createDOMFactory('colgroup'),
1714 - data: createDOMFactory('data'),
1715 - datalist: createDOMFactory('datalist'),
1716 - dd: createDOMFactory('dd'),
1717 - del: createDOMFactory('del'),
1718 - details: createDOMFactory('details'),
1719 - dfn: createDOMFactory('dfn'),
1720 - dialog: createDOMFactory('dialog'),
1721 - div: createDOMFactory('div'),
1722 - dl: createDOMFactory('dl'),
1723 - dt: createDOMFactory('dt'),
1724 - em: createDOMFactory('em'),
1725 - embed: createDOMFactory('embed'),
1726 - fieldset: createDOMFactory('fieldset'),
1727 - figcaption: createDOMFactory('figcaption'),
1728 - figure: createDOMFactory('figure'),
1729 - footer: createDOMFactory('footer'),
1730 - form: createDOMFactory('form'),
1731 - h1: createDOMFactory('h1'),
1732 - h2: createDOMFactory('h2'),
1733 - h3: createDOMFactory('h3'),
1734 - h4: createDOMFactory('h4'),
1735 - h5: createDOMFactory('h5'),
1736 - h6: createDOMFactory('h6'),
1737 - head: createDOMFactory('head'),
1738 - header: createDOMFactory('header'),
1739 - hgroup: createDOMFactory('hgroup'),
1740 - hr: createDOMFactory('hr'),
1741 - html: createDOMFactory('html'),
1742 - i: createDOMFactory('i'),
1743 - iframe: createDOMFactory('iframe'),
1744 - img: createDOMFactory('img'),
1745 - input: createDOMFactory('input'),
1746 - ins: createDOMFactory('ins'),
1747 - kbd: createDOMFactory('kbd'),
1748 - keygen: createDOMFactory('keygen'),
1749 - label: createDOMFactory('label'),
1750 - legend: createDOMFactory('legend'),
1751 - li: createDOMFactory('li'),
1752 - link: createDOMFactory('link'),
1753 - main: createDOMFactory('main'),
1754 - map: createDOMFactory('map'),
1755 - mark: createDOMFactory('mark'),
1756 - menu: createDOMFactory('menu'),
1757 - menuitem: createDOMFactory('menuitem'),
1758 - meta: createDOMFactory('meta'),
1759 - meter: createDOMFactory('meter'),
1760 - nav: createDOMFactory('nav'),
1761 - noscript: createDOMFactory('noscript'),
1762 - object: createDOMFactory('object'),
1763 - ol: createDOMFactory('ol'),
1764 - optgroup: createDOMFactory('optgroup'),
1765 - option: createDOMFactory('option'),
1766 - output: createDOMFactory('output'),
1767 - p: createDOMFactory('p'),
1768 - param: createDOMFactory('param'),
1769 - picture: createDOMFactory('picture'),
1770 - pre: createDOMFactory('pre'),
1771 - progress: createDOMFactory('progress'),
1772 - q: createDOMFactory('q'),
1773 - rp: createDOMFactory('rp'),
1774 - rt: createDOMFactory('rt'),
1775 - ruby: createDOMFactory('ruby'),
1776 - s: createDOMFactory('s'),
1777 - samp: createDOMFactory('samp'),
1778 - script: createDOMFactory('script'),
1779 - section: createDOMFactory('section'),
1780 - select: createDOMFactory('select'),
1781 - small: createDOMFactory('small'),
1782 - source: createDOMFactory('source'),
1783 - span: createDOMFactory('span'),
1784 - strong: createDOMFactory('strong'),
1785 - style: createDOMFactory('style'),
1786 - sub: createDOMFactory('sub'),
1787 - summary: createDOMFactory('summary'),
1788 - sup: createDOMFactory('sup'),
1789 - table: createDOMFactory('table'),
1790 - tbody: createDOMFactory('tbody'),
1791 - td: createDOMFactory('td'),
1792 - textarea: createDOMFactory('textarea'),
1793 - tfoot: createDOMFactory('tfoot'),
1794 - th: createDOMFactory('th'),
1795 - thead: createDOMFactory('thead'),
1796 - time: createDOMFactory('time'),
1797 - title: createDOMFactory('title'),
1798 - tr: createDOMFactory('tr'),
1799 - track: createDOMFactory('track'),
1800 - u: createDOMFactory('u'),
1801 - ul: createDOMFactory('ul'),
1802 - 'var': createDOMFactory('var'),
1803 - video: createDOMFactory('video'),
1804 - wbr: createDOMFactory('wbr'),
1805 -
1806 - // SVG
1807 - circle: createDOMFactory('circle'),
1808 - clipPath: createDOMFactory('clipPath'),
1809 - defs: createDOMFactory('defs'),
1810 - ellipse: createDOMFactory('ellipse'),
1811 - g: createDOMFactory('g'),
1812 - image: createDOMFactory('image'),
1813 - line: createDOMFactory('line'),
1814 - linearGradient: createDOMFactory('linearGradient'),
1815 - mask: createDOMFactory('mask'),
1816 - path: createDOMFactory('path'),
1817 - pattern: createDOMFactory('pattern'),
1818 - polygon: createDOMFactory('polygon'),
1819 - polyline: createDOMFactory('polyline'),
1820 - radialGradient: createDOMFactory('radialGradient'),
1821 - rect: createDOMFactory('rect'),
1822 - stop: createDOMFactory('stop'),
1823 - svg: createDOMFactory('svg'),
1824 - text: createDOMFactory('text'),
1825 - tspan: createDOMFactory('tspan')
1826 -};
1827 -
1828 -module.exports = ReactDOMFactories;
1829 -},{"10":10,"12":12}],10:[function(_dereq_,module,exports){
1830 -/**
1831 - * Copyright 2014-present, Facebook, Inc.
1832 - * All rights reserved.
1833 - *
1834 - * This source code is licensed under the BSD-style license found in the
1835 - * LICENSE file in the root directory of this source tree. An additional grant
1836 - * of patent rights can be found in the PATENTS file in the same directory.
1837 - *
1838 - */
1839 -
1840 -'use strict';
1841 -
1842 -var _assign = _dereq_(30);
1843 -
1844 -var ReactCurrentOwner = _dereq_(8);
1845 -
1846 -var warning = _dereq_(29);
1847 -var canDefineProperty = _dereq_(20);
1848 -var hasOwnProperty = Object.prototype.hasOwnProperty;
1849 -
1850 -var REACT_ELEMENT_TYPE = _dereq_(11);
1851 -
1852 -var RESERVED_PROPS = {
1853 - key: true,
1854 - ref: true,
1855 - __self: true,
1856 - __source: true
1857 -};
1858 -
1859 -var specialPropKeyWarningShown, specialPropRefWarningShown;
1860 -
1861 -function hasValidRef(config) {
1862 - if ("development" !== 'production') {
1863 - if (hasOwnProperty.call(config, 'ref')) {
1864 - var getter = Object.getOwnPropertyDescriptor(config, 'ref').get;
1865 - if (getter && getter.isReactWarning) {
1866 - return false;
1867 - }
1868 - }
1869 - }
1870 - return config.ref !== undefined;
1871 -}
1872 -
1873 -function hasValidKey(config) {
1874 - if ("development" !== 'production') {
1875 - if (hasOwnProperty.call(config, 'key')) {
1876 - var getter = Object.getOwnPropertyDescriptor(config, 'key').get;
1877 - if (getter && getter.isReactWarning) {
1878 - return false;
1879 - }
1880 - }
1881 - }
1882 - return config.key !== undefined;
1883 -}
1884 -
1885 -function defineKeyPropWarningGetter(props, displayName) {
1886 - var warnAboutAccessingKey = function () {
1887 - if (!specialPropKeyWarningShown) {
1888 - specialPropKeyWarningShown = true;
1889 - "development" !== '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)', displayName) : void 0;
1890 - }
1891 - };
1892 - warnAboutAccessingKey.isReactWarning = true;
1893 - Object.defineProperty(props, 'key', {
1894 - get: warnAboutAccessingKey,
1895 - configurable: true
1896 - });
1897 -}
1898 -
1899 -function defineRefPropWarningGetter(props, displayName) {
1900 - var warnAboutAccessingRef = function () {
1901 - if (!specialPropRefWarningShown) {
1902 - specialPropRefWarningShown = true;
1903 - "development" !== '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)', displayName) : void 0;
1904 - }
1905 - };
1906 - warnAboutAccessingRef.isReactWarning = true;
1907 - Object.defineProperty(props, 'ref', {
1908 - get: warnAboutAccessingRef,
1909 - configurable: true
1910 - });
1911 -}
1912 -
1913 -/**
1914 - * Factory method to create a new React element. This no longer adheres to
1915 - * the class pattern, so do not use new to call it. Also, no instanceof check
1916 - * will work. Instead test $$typeof field against Symbol.for('react.element') to check
1917 - * if something is a React Element.
1918 - *
1919 - * @param {*} type
1920 - * @param {*} key
1921 - * @param {string|object} ref
1922 - * @param {*} self A *temporary* helper to detect places where `this` is
1923 - * different from the `owner` when React.createElement is called, so that we
1924 - * can warn. We want to get rid of owner and replace string `ref`s with arrow
1925 - * functions, and as long as `this` and owner are the same, there will be no
1926 - * change in behavior.
1927 - * @param {*} source An annotation object (added by a transpiler or otherwise)
1928 - * indicating filename, line number, and/or other information.
1929 - * @param {*} owner
1930 - * @param {*} props
1931 - * @internal
1932 - */
1933 -var ReactElement = function (type, key, ref, self, source, owner, props) {
1934 - var element = {
1935 - // This tag allow us to uniquely identify this as a React Element
1936 - $$typeof: REACT_ELEMENT_TYPE,
1937 -
1938 - // Built-in properties that belong on the element
1939 - type: type,
1940 - key: key,
1941 - ref: ref,
1942 - props: props,
1943 -
1944 - // Record the component responsible for creating this element.
1945 - _owner: owner
1946 - };
1947 -
1948 - if ("development" !== 'production') {
1949 - // The validation flag is currently mutative. We put it on
1950 - // an external backing store so that we can freeze the whole object.
1951 - // This can be replaced with a WeakMap once they are implemented in
1952 - // commonly used development environments.
1953 - element._store = {};
1954 -
1955 - // To make comparing ReactElements easier for testing purposes, we make
1956 - // the validation flag non-enumerable (where possible, which should
1957 - // include every environment we run tests in), so the test framework
1958 - // ignores it.
1959 - if (canDefineProperty) {
1960 - Object.defineProperty(element._store, 'validated', {
1961 - configurable: false,
1962 - enumerable: false,
1963 - writable: true,
1964 - value: false
1965 - });
1966 - // self and source are DEV only properties.
1967 - Object.defineProperty(element, '_self', {
1968 - configurable: false,
1969 - enumerable: false,
1970 - writable: false,
1971 - value: self
1972 - });
1973 - // Two elements created in two different places should be considered
1974 - // equal for testing purposes and therefore we hide it from enumeration.
1975 - Object.defineProperty(element, '_source', {
1976 - configurable: false,
1977 - enumerable: false,
1978 - writable: false,
1979 - value: source
1980 - });
1981 - } else {
1982 - element._store.validated = false;
1983 - element._self = self;
1984 - element._source = source;
1985 - }
1986 - if (Object.freeze) {
1987 - Object.freeze(element.props);
1988 - Object.freeze(element);
1989 - }
1990 - }
1991 -
1992 - return element;
1993 -};
1994 -
1995 -/**
1996 - * Create and return a new ReactElement of the given type.
1997 - * See https://facebook.github.io/react/docs/top-level-api.html#react.createelement
1998 - */
1999 -ReactElement.createElement = function (type, config, children) {
2000 - var propName;
2001 -
2002 - // Reserved names are extracted
2003 - var props = {};
2004 -
2005 - var key = null;
2006 - var ref = null;
2007 - var self = null;
2008 - var source = null;
2009 -
2010 - if (config != null) {
2011 - if (hasValidRef(config)) {
2012 - ref = config.ref;
2013 - }
2014 - if (hasValidKey(config)) {
2015 - key = '' + config.key;
2016 - }
2017 -
2018 - self = config.__self === undefined ? null : config.__self;
2019 - source = config.__source === undefined ? null : config.__source;
2020 - // Remaining properties are added to a new props object
2021 - for (propName in config) {
2022 - if (hasOwnProperty.call(config, propName) && !RESERVED_PROPS.hasOwnProperty(propName)) {
2023 - props[propName] = config[propName];
2024 - }
2025 - }
2026 - }
2027 -
2028 - // Children can be more than one argument, and those are transferred onto
2029 - // the newly allocated props object.
2030 - var childrenLength = arguments.length - 2;
2031 - if (childrenLength === 1) {
2032 - props.children = children;
2033 - } else if (childrenLength > 1) {
2034 - var childArray = Array(childrenLength);
2035 - for (var i = 0; i < childrenLength; i++) {
2036 - childArray[i] = arguments[i + 2];
2037 - }
2038 - if ("development" !== 'production') {
2039 - if (Object.freeze) {
2040 - Object.freeze(childArray);
2041 - }
2042 - }
2043 - props.children = childArray;
2044 - }
2045 -
2046 - // Resolve default props
2047 - if (type && type.defaultProps) {
2048 - var defaultProps = type.defaultProps;
2049 - for (propName in defaultProps) {
2050 - if (props[propName] === undefined) {
2051 - props[propName] = defaultProps[propName];
2052 - }
2053 - }
2054 - }
2055 - if ("development" !== 'production') {
2056 - if (key || ref) {
2057 - if (typeof props.$$typeof === 'undefined' || props.$$typeof !== REACT_ELEMENT_TYPE) {
2058 - var displayName = typeof type === 'function' ? type.displayName || type.name || 'Unknown' : type;
2059 - if (key) {
2060 - defineKeyPropWarningGetter(props, displayName);
2061 - }
2062 - if (ref) {
2063 - defineRefPropWarningGetter(props, displayName);
2064 - }
2065 - }
2066 - }
2067 - }
2068 - return ReactElement(type, key, ref, self, source, ReactCurrentOwner.current, props);
2069 -};
2070 -
2071 -/**
2072 - * Return a function that produces ReactElements of a given type.
2073 - * See https://facebook.github.io/react/docs/top-level-api.html#react.createfactory
2074 - */
2075 -ReactElement.createFactory = function (type) {
2076 - var factory = ReactElement.createElement.bind(null, type);
2077 - // Expose the type on the factory and the prototype so that it can be
2078 - // easily accessed on elements. E.g. `<Foo />.type === Foo`.
2079 - // This should not be named `constructor` since this may not be the function
2080 - // that created the element, and it may not even be a constructor.
2081 - // Legacy hook TODO: Warn if this is accessed
2082 - factory.type = type;
2083 - return factory;
2084 -};
2085 -
2086 -ReactElement.cloneAndReplaceKey = function (oldElement, newKey) {
2087 - var newElement = ReactElement(oldElement.type, newKey, oldElement.ref, oldElement._self, oldElement._source, oldElement._owner, oldElement.props);
2088 -
2089 - return newElement;
2090 -};
2091 -
2092 -/**
2093 - * Clone and return a new ReactElement using element as the starting point.
2094 - * See https://facebook.github.io/react/docs/top-level-api.html#react.cloneelement
2095 - */
2096 -ReactElement.cloneElement = function (element, config, children) {
2097 - var propName;
2098 -
2099 - // Original props are copied
2100 - var props = _assign({}, element.props);
2101 -
2102 - // Reserved names are extracted
2103 - var key = element.key;
2104 - var ref = element.ref;
2105 - // Self is preserved since the owner is preserved.
2106 - var self = element._self;
2107 - // Source is preserved since cloneElement is unlikely to be targeted by a
2108 - // transpiler, and the original source is probably a better indicator of the
2109 - // true owner.
2110 - var source = element._source;
2111 -
2112 - // Owner will be preserved, unless ref is overridden
2113 - var owner = element._owner;
2114 -
2115 - if (config != null) {
2116 - if (hasValidRef(config)) {
2117 - // Silently steal the ref from the parent.
2118 - ref = config.ref;
2119 - owner = ReactCurrentOwner.current;
2120 - }
2121 - if (hasValidKey(config)) {
2122 - key = '' + config.key;
2123 - }
2124 -
2125 - // Remaining properties override existing props
2126 - var defaultProps;
2127 - if (element.type && element.type.defaultProps) {
2128 - defaultProps = element.type.defaultProps;
2129 - }
2130 - for (propName in config) {
2131 - if (hasOwnProperty.call(config, propName) && !RESERVED_PROPS.hasOwnProperty(propName)) {
2132 - if (config[propName] === undefined && defaultProps !== undefined) {
2133 - // Resolve default props
2134 - props[propName] = defaultProps[propName];
2135 - } else {
2136 - props[propName] = config[propName];
2137 - }
2138 - }
2139 - }
2140 - }
2141 -
2142 - // Children can be more than one argument, and those are transferred onto
2143 - // the newly allocated props object.
2144 - var childrenLength = arguments.length - 2;
2145 - if (childrenLength === 1) {
2146 - props.children = children;
2147 - } else if (childrenLength > 1) {
2148 - var childArray = Array(childrenLength);
2149 - for (var i = 0; i < childrenLength; i++) {
2150 - childArray[i] = arguments[i + 2];
2151 - }
2152 - props.children = childArray;
2153 - }
2154 -
2155 - return ReactElement(element.type, key, ref, self, source, owner, props);
2156 -};
2157 -
2158 -/**
2159 - * Verifies the object is a ReactElement.
2160 - * See https://facebook.github.io/react/docs/top-level-api.html#react.isvalidelement
2161 - * @param {?object} object
2162 - * @return {boolean} True if `object` is a valid component.
2163 - * @final
2164 - */
2165 -ReactElement.isValidElement = function (object) {
2166 - return typeof object === 'object' && object !== null && object.$$typeof === REACT_ELEMENT_TYPE;
2167 -};
2168 -
2169 -module.exports = ReactElement;
2170 -},{"11":11,"20":20,"29":29,"30":30,"8":8}],11:[function(_dereq_,module,exports){
2171 -/**
2172 - * Copyright 2014-present, Facebook, Inc.
2173 - * All rights reserved.
2174 - *
2175 - * This source code is licensed under the BSD-style license found in the
2176 - * LICENSE file in the root directory of this source tree. An additional grant
2177 - * of patent rights can be found in the PATENTS file in the same directory.
2178 - *
2179 - *
2180 - */
2181 -
2182 -'use strict';
2183 -
2184 -// The Symbol used to tag the ReactElement type. If there is no native Symbol
2185 -// nor polyfill, then a plain number is used for performance.
2186 -
2187 -var REACT_ELEMENT_TYPE = typeof Symbol === 'function' && Symbol['for'] && Symbol['for']('react.element') || 0xeac7;
2188 -
2189 -module.exports = REACT_ELEMENT_TYPE;
2190 -},{}],12:[function(_dereq_,module,exports){
2191 -/**
2192 - * Copyright 2014-present, Facebook, Inc.
2193 - * All rights reserved.
2194 - *
2195 - * This source code is licensed under the BSD-style license found in the
2196 - * LICENSE file in the root directory of this source tree. An additional grant
2197 - * of patent rights can be found in the PATENTS file in the same directory.
2198 - *
2199 - */
2200 -
2201 -/**
2202 - * ReactElementValidator provides a wrapper around a element factory
2203 - * which validates the props passed to the element. This is intended to be
2204 - * used only in DEV and could be replaced by a static type checker for languages
2205 - * that support it.
2206 - */
2207 -
2208 -'use strict';
2209 -
2210 -var ReactCurrentOwner = _dereq_(8);
2211 -var ReactComponentTreeHook = _dereq_(7);
2212 -var ReactElement = _dereq_(10);
2213 -
2214 -var checkReactTypeSpec = _dereq_(21);
2215 -
2216 -var canDefineProperty = _dereq_(20);
2217 -var getIteratorFn = _dereq_(22);
2218 -var warning = _dereq_(29);
2219 -
2220 -function getDeclarationErrorAddendum() {
2221 - if (ReactCurrentOwner.current) {
2222 - var name = ReactCurrentOwner.current.getName();
2223 - if (name) {
2224 - return ' Check the render method of `' + name + '`.';
2225 - }
2226 - }
2227 - return '';
2228 -}
2229 -
2230 -/**
2231 - * Warn if there's no key explicitly set on dynamic arrays of children or
2232 - * object keys are not valid. This allows us to keep track of children between
2233 - * updates.
2234 - */
2235 -var ownerHasKeyUseWarning = {};
2236 -
2237 -function getCurrentComponentErrorInfo(parentType) {
2238 - var info = getDeclarationErrorAddendum();
2239 -
2240 - if (!info) {
2241 - var parentName = typeof parentType === 'string' ? parentType : parentType.displayName || parentType.name;
2242 - if (parentName) {
2243 - info = ' Check the top-level render call using <' + parentName + '>.';
2244 - }
2245 - }
2246 - return info;
2247 -}
2248 -
2249 -/**
2250 - * Warn if the element doesn't have an explicit key assigned to it.
2251 - * This element is in an array. The array could grow and shrink or be
2252 - * reordered. All children that haven't already been validated are required to
2253 - * have a "key" property assigned to it. Error statuses are cached so a warning
2254 - * will only be shown once.
2255 - *
2256 - * @internal
2257 - * @param {ReactElement} element Element that requires a key.
2258 - * @param {*} parentType element's parent's type.
2259 - */
2260 -function validateExplicitKey(element, parentType) {
2261 - if (!element._store || element._store.validated || element.key != null) {
2262 - return;
2263 - }
2264 - element._store.validated = true;
2265 -
2266 - var memoizer = ownerHasKeyUseWarning.uniqueKey || (ownerHasKeyUseWarning.uniqueKey = {});
2267 -
2268 - var currentComponentErrorInfo = getCurrentComponentErrorInfo(parentType);
2269 - if (memoizer[currentComponentErrorInfo]) {
2270 - return;
2271 - }
2272 - memoizer[currentComponentErrorInfo] = true;
2273 -
2274 - // Usually the current owner is the offender, but if it accepts children as a
2275 - // property, it may be the creator of the child that's responsible for
2276 - // assigning it a key.
2277 - var childOwner = '';
2278 - if (element && element._owner && element._owner !== ReactCurrentOwner.current) {
2279 - // Give the component that originally created this child.
2280 - childOwner = ' It was passed a child from ' + element._owner.getName() + '.';
2281 - }
2282 -
2283 - "development" !== 'production' ? warning(false, 'Each child in an array or iterator should have a unique "key" prop.' + '%s%s See https://fb.me/react-warning-keys for more information.%s', currentComponentErrorInfo, childOwner, ReactComponentTreeHook.getCurrentStackAddendum(element)) : void 0;
2284 -}
2285 -
2286 -/**
2287 - * Ensure that every element either is passed in a static location, in an
2288 - * array with an explicit keys property defined, or in an object literal
2289 - * with valid key property.
2290 - *
2291 - * @internal
2292 - * @param {ReactNode} node Statically passed child of any type.
2293 - * @param {*} parentType node's parent's type.
2294 - */
2295 -function validateChildKeys(node, parentType) {
2296 - if (typeof node !== 'object') {
2297 - return;
2298 - }
2299 - if (Array.isArray(node)) {
2300 - for (var i = 0; i < node.length; i++) {
2301 - var child = node[i];
2302 - if (ReactElement.isValidElement(child)) {
2303 - validateExplicitKey(child, parentType);
2304 - }
2305 - }
2306 - } else if (ReactElement.isValidElement(node)) {
2307 - // This element was passed in a valid location.
2308 - if (node._store) {
2309 - node._store.validated = true;
2310 - }
2311 - } else if (node) {
2312 - var iteratorFn = getIteratorFn(node);
2313 - // Entry iterators provide implicit keys.
2314 - if (iteratorFn) {
2315 - if (iteratorFn !== node.entries) {
2316 - var iterator = iteratorFn.call(node);
2317 - var step;
2318 - while (!(step = iterator.next()).done) {
2319 - if (ReactElement.isValidElement(step.value)) {
2320 - validateExplicitKey(step.value, parentType);
2321 - }
2322 - }
2323 - }
2324 - }
2325 - }
2326 -}
2327 -
2328 -/**
2329 - * Given an element, validate that its props follow the propTypes definition,
2330 - * provided by the type.
2331 - *
2332 - * @param {ReactElement} element
2333 - */
2334 -function validatePropTypes(element) {
2335 - var componentClass = element.type;
2336 - if (typeof componentClass !== 'function') {
2337 - return;
2338 - }
2339 - var name = componentClass.displayName || componentClass.name;
2340 - if (componentClass.propTypes) {
2341 - checkReactTypeSpec(componentClass.propTypes, element.props, 'prop', name, element, null);
2342 - }
2343 - if (typeof componentClass.getDefaultProps === 'function') {
2344 - "development" !== 'production' ? warning(componentClass.getDefaultProps.isReactClassApproved, 'getDefaultProps is only used on classic React.createClass ' + 'definitions. Use a static property named `defaultProps` instead.') : void 0;
2345 - }
2346 -}
2347 -
2348 -var ReactElementValidator = {
2349 -
2350 - createElement: function (type, props, children) {
2351 - var validType = typeof type === 'string' || typeof type === 'function';
2352 - // We warn in this case but don't throw. We expect the element creation to
2353 - // succeed and there will likely be errors in render.
2354 - if (!validType) {
2355 - "development" !== 'production' ? warning(false, '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;
2356 - }
2357 -
2358 - var element = ReactElement.createElement.apply(this, arguments);
2359 -
2360 - // The result can be nullish if a mock or a custom function is used.
2361 - // TODO: Drop this when these are no longer allowed as the type argument.
2362 - if (element == null) {
2363 - return element;
2364 - }
2365 -
2366 - // Skip key warning if the type isn't valid since our key validation logic
2367 - // doesn't expect a non-string/function type and can throw confusing errors.
2368 - // We don't want exception behavior to differ between dev and prod.
2369 - // (Rendering will throw with a helpful message and as soon as the type is
2370 - // fixed, the key warnings will appear.)
2371 - if (validType) {
2372 - for (var i = 2; i < arguments.length; i++) {
2373 - validateChildKeys(arguments[i], type);
2374 - }
2375 - }
2376 -
2377 - validatePropTypes(element);
2378 -
2379 - return element;
2380 - },
2381 -
2382 - createFactory: function (type) {
2383 - var validatedFactory = ReactElementValidator.createElement.bind(null, type);
2384 - // Legacy hook TODO: Warn if this is accessed
2385 - validatedFactory.type = type;
2386 -
2387 - if ("development" !== 'production') {
2388 - if (canDefineProperty) {
2389 - Object.defineProperty(validatedFactory, 'type', {
2390 - enumerable: false,
2391 - get: function () {
2392 - "development" !== 'production' ? warning(false, 'Factory.type is deprecated. Access the class directly ' + 'before passing it to createFactory.') : void 0;
2393 - Object.defineProperty(this, 'type', {
2394 - value: type
2395 - });
2396 - return type;
2397 - }
2398 - });
2399 - }
2400 - }
2401 -
2402 - return validatedFactory;
2403 - },
2404 -
2405 - cloneElement: function (element, props, children) {
2406 - var newElement = ReactElement.cloneElement.apply(this, arguments);
2407 - for (var i = 2; i < arguments.length; i++) {
2408 - validateChildKeys(arguments[i], newElement.type);
2409 - }
2410 - validatePropTypes(newElement);
2411 - return newElement;
2412 - }
2413 -
2414 -};
2415 -
2416 -module.exports = ReactElementValidator;
2417 -},{"10":10,"20":20,"21":21,"22":22,"29":29,"7":7,"8":8}],13:[function(_dereq_,module,exports){
2418 -/**
2419 - * Copyright 2015-present, Facebook, Inc.
2420 - * All rights reserved.
2421 - *
2422 - * This source code is licensed under the BSD-style license found in the
2423 - * LICENSE file in the root directory of this source tree. An additional grant
2424 - * of patent rights can be found in the PATENTS file in the same directory.
2425 - *
2426 - */
2427 -
2428 -'use strict';
2429 -
2430 -var warning = _dereq_(29);
2431 -
2432 -function warnNoop(publicInstance, callerName) {
2433 - if ("development" !== 'production') {
2434 - var constructor = publicInstance.constructor;
2435 - "development" !== '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, constructor && (constructor.displayName || constructor.name) || 'ReactClass') : void 0;
2436 - }
2437 -}
2438 -
2439 -/**
2440 - * This is the abstract API for an update queue.
2441 - */
2442 -var ReactNoopUpdateQueue = {
2443 -
2444 - /**
2445 - * Checks whether or not this composite component is mounted.
2446 - * @param {ReactClass} publicInstance The instance we want to test.
2447 - * @return {boolean} True if mounted, false otherwise.
2448 - * @protected
2449 - * @final
2450 - */
2451 - isMounted: function (publicInstance) {
2452 - return false;
2453 - },
2454 -
2455 - /**
2456 - * Enqueue a callback that will be executed after all the pending updates
2457 - * have processed.
2458 - *
2459 - * @param {ReactClass} publicInstance The instance to use as `this` context.
2460 - * @param {?function} callback Called after state is updated.
2461 - * @internal
2462 - */
2463 - enqueueCallback: function (publicInstance, callback) {},
2464 -
2465 - /**
2466 - * Forces an update. This should only be invoked when it is known with
2467 - * certainty that we are **not** in a DOM transaction.
2468 - *
2469 - * You may want to call this when you know that some deeper aspect of the
2470 - * component's state has changed but `setState` was not called.
2471 - *
2472 - * This will not invoke `shouldComponentUpdate`, but it will invoke
2473 - * `componentWillUpdate` and `componentDidUpdate`.
2474 - *
2475 - * @param {ReactClass} publicInstance The instance that should rerender.
2476 - * @internal
2477 - */
2478 - enqueueForceUpdate: function (publicInstance) {
2479 - warnNoop(publicInstance, 'forceUpdate');
2480 - },
2481 -
2482 - /**
2483 - * Replaces all of the state. Always use this or `setState` to mutate state.
2484 - * You should treat `this.state` as immutable.
2485 - *
2486 - * There is no guarantee that `this.state` will be immediately updated, so
2487 - * accessing `this.state` after calling this method may return the old value.
2488 - *
2489 - * @param {ReactClass} publicInstance The instance that should rerender.
2490 - * @param {object} completeState Next state.
2491 - * @internal
2492 - */
2493 - enqueueReplaceState: function (publicInstance, completeState) {
2494 - warnNoop(publicInstance, 'replaceState');
2495 - },
2496 -
2497 - /**
2498 - * Sets a subset of the state. This only exists because _pendingState is
2499 - * internal. This provides a merging strategy that is not available to deep
2500 - * properties which is confusing. TODO: Expose pendingState or don't use it
2501 - * during the merge.
2502 - *
2503 - * @param {ReactClass} publicInstance The instance that should rerender.
2504 - * @param {object} partialState Next partial state to be merged with state.
2505 - * @internal
2506 - */
2507 - enqueueSetState: function (publicInstance, partialState) {
2508 - warnNoop(publicInstance, 'setState');
2509 - }
2510 -};
2511 -
2512 -module.exports = ReactNoopUpdateQueue;
2513 -},{"29":29}],14:[function(_dereq_,module,exports){
2514 -/**
2515 - * Copyright 2013-present, Facebook, Inc.
2516 - * All rights reserved.
2517 - *
2518 - * This source code is licensed under the BSD-style license found in the
2519 - * LICENSE file in the root directory of this source tree. An additional grant
2520 - * of patent rights can be found in the PATENTS file in the same directory.
2521 - *
2522 - *
2523 - */
2524 -
2525 -'use strict';
2526 -
2527 -var ReactPropTypeLocationNames = {};
2528 -
2529 -if ("development" !== 'production') {
2530 - ReactPropTypeLocationNames = {
2531 - prop: 'prop',
2532 - context: 'context',
2533 - childContext: 'child context'
2534 - };
2535 -}
2536 -
2537 -module.exports = ReactPropTypeLocationNames;
2538 -},{}],15:[function(_dereq_,module,exports){
2539 -/**
2540 - * Copyright 2013-present, Facebook, Inc.
2541 - * All rights reserved.
2542 - *
2543 - * This source code is licensed under the BSD-style license found in the
2544 - * LICENSE file in the root directory of this source tree. An additional grant
2545 - * of patent rights can be found in the PATENTS file in the same directory.
2546 - *
2547 - */
2548 -
2549 -'use strict';
2550 -
2551 -var ReactElement = _dereq_(10);
2552 -var ReactPropTypeLocationNames = _dereq_(14);
2553 -var ReactPropTypesSecret = _dereq_(16);
2554 -
2555 -var emptyFunction = _dereq_(26);
2556 -var getIteratorFn = _dereq_(22);
2557 -var warning = _dereq_(29);
2558 -
2559 -/**
2560 - * Collection of methods that allow declaration and validation of props that are
2561 - * supplied to React components. Example usage:
2562 - *
2563 - * var Props = require('ReactPropTypes');
2564 - * var MyArticle = React.createClass({
2565 - * propTypes: {
2566 - * // An optional string prop named "description".
2567 - * description: Props.string,
2568 - *
2569 - * // A required enum prop named "category".
2570 - * category: Props.oneOf(['News','Photos']).isRequired,
2571 - *
2572 - * // A prop named "dialog" that requires an instance of Dialog.
2573 - * dialog: Props.instanceOf(Dialog).isRequired
2574 - * },
2575 - * render: function() { ... }
2576 - * });
2577 - *
2578 - * A more formal specification of how these methods are used:
2579 - *
2580 - * type := array|bool|func|object|number|string|oneOf([...])|instanceOf(...)
2581 - * decl := ReactPropTypes.{type}(.isRequired)?
2582 - *
2583 - * Each and every declaration produces a function with the same signature. This
2584 - * allows the creation of custom validation functions. For example:
2585 - *
2586 - * var MyLink = React.createClass({
2587 - * propTypes: {
2588 - * // An optional string or URI prop named "href".
2589 - * href: function(props, propName, componentName) {
2590 - * var propValue = props[propName];
2591 - * if (propValue != null && typeof propValue !== 'string' &&
2592 - * !(propValue instanceof URI)) {
2593 - * return new Error(
2594 - * 'Expected a string or an URI for ' + propName + ' in ' +
2595 - * componentName
2596 - * );
2597 - * }
2598 - * }
2599 - * },
2600 - * render: function() {...}
2601 - * });
2602 - *
2603 - * @internal
2604 - */
2605 -
2606 -var ANONYMOUS = '<<anonymous>>';
2607 -
2608 -var ReactPropTypes = {
2609 - array: createPrimitiveTypeChecker('array'),
2610 - bool: createPrimitiveTypeChecker('boolean'),
2611 - func: createPrimitiveTypeChecker('function'),
2612 - number: createPrimitiveTypeChecker('number'),
2613 - object: createPrimitiveTypeChecker('object'),
2614 - string: createPrimitiveTypeChecker('string'),
2615 - symbol: createPrimitiveTypeChecker('symbol'),
2616 -
2617 - any: createAnyTypeChecker(),
2618 - arrayOf: createArrayOfTypeChecker,
2619 - element: createElementTypeChecker(),
2620 - instanceOf: createInstanceTypeChecker,
2621 - node: createNodeChecker(),
2622 - objectOf: createObjectOfTypeChecker,
2623 - oneOf: createEnumTypeChecker,
2624 - oneOfType: createUnionTypeChecker,
2625 - shape: createShapeTypeChecker
2626 -};
2627 -
2628 -/**
2629 - * inlined Object.is polyfill to avoid requiring consumers ship their own
2630 - * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is
2631 - */
2632 -/*eslint-disable no-self-compare*/
2633 -function is(x, y) {
2634 - // SameValue algorithm
2635 - if (x === y) {
2636 - // Steps 1-5, 7-10
2637 - // Steps 6.b-6.e: +0 != -0
2638 - return x !== 0 || 1 / x === 1 / y;
2639 - } else {
2640 - // Step 6.a: NaN == NaN
2641 - return x !== x && y !== y;
2642 - }
2643 -}
2644 -/*eslint-enable no-self-compare*/
2645 -
2646 -/**
2647 - * We use an Error-like object for backward compatibility as people may call
2648 - * PropTypes directly and inspect their output. However we don't use real
2649 - * Errors anymore. We don't inspect their stack anyway, and creating them
2650 - * is prohibitively expensive if they are created too often, such as what
2651 - * happens in oneOfType() for any type before the one that matched.
2652 - */
2653 -function PropTypeError(message) {
2654 - this.message = message;
2655 - this.stack = '';
2656 -}
2657 -// Make `instanceof Error` still work for returned errors.
2658 -PropTypeError.prototype = Error.prototype;
2659 -
2660 -function createChainableTypeChecker(validate) {
2661 - if ("development" !== 'production') {
2662 - var manualPropTypeCallCache = {};
2663 - }
2664 - function checkType(isRequired, props, propName, componentName, location, propFullName, secret) {
2665 - componentName = componentName || ANONYMOUS;
2666 - propFullName = propFullName || propName;
2667 - if ("development" !== 'production') {
2668 - if (secret !== ReactPropTypesSecret && typeof console !== 'undefined') {
2669 - var cacheKey = componentName + ':' + propName;
2670 - if (!manualPropTypeCallCache[cacheKey]) {
2671 - "development" !== 'production' ? warning(false, 'You are manually calling a React.PropTypes validation ' + 'function for the `%s` prop on `%s`. This is deprecated ' + 'and will not work in production with the next major version. ' + 'You may be seeing this warning due to a third-party PropTypes ' + 'library. See https://fb.me/react-warning-dont-call-proptypes ' + 'for details.', propFullName, componentName) : void 0;
2672 - manualPropTypeCallCache[cacheKey] = true;
2673 - }
2674 - }
2675 - }
2676 - if (props[propName] == null) {
2677 - var locationName = ReactPropTypeLocationNames[location];
2678 - if (isRequired) {
2679 - if (props[propName] === null) {
2680 - return new PropTypeError('The ' + locationName + ' `' + propFullName + '` is marked as required ' + ('in `' + componentName + '`, but its value is `null`.'));
2681 - }
2682 - return new PropTypeError('The ' + locationName + ' `' + propFullName + '` is marked as required in ' + ('`' + componentName + '`, but its value is `undefined`.'));
2683 - }
2684 - return null;
2685 - } else {
2686 - return validate(props, propName, componentName, location, propFullName);
2687 - }
2688 - }
2689 -
2690 - var chainedCheckType = checkType.bind(null, false);
2691 - chainedCheckType.isRequired = checkType.bind(null, true);
2692 -
2693 - return chainedCheckType;
2694 -}
2695 -
2696 -function createPrimitiveTypeChecker(expectedType) {
2697 - function validate(props, propName, componentName, location, propFullName, secret) {
2698 - var propValue = props[propName];
2699 - var propType = getPropType(propValue);
2700 - if (propType !== expectedType) {
2701 - var locationName = ReactPropTypeLocationNames[location];
2702 - // `propValue` being instance of, say, date/regexp, pass the 'object'
2703 - // check, but we can offer a more precise error message here rather than
2704 - // 'of type `object`'.
2705 - var preciseType = getPreciseType(propValue);
2706 -
2707 - return new PropTypeError('Invalid ' + locationName + ' `' + propFullName + '` of type ' + ('`' + preciseType + '` supplied to `' + componentName + '`, expected ') + ('`' + expectedType + '`.'));
2708 - }
2709 - return null;
2710 - }
2711 - return createChainableTypeChecker(validate);
2712 -}
2713 -
2714 -function createAnyTypeChecker() {
2715 - return createChainableTypeChecker(emptyFunction.thatReturns(null));
2716 -}
2717 -
2718 -function createArrayOfTypeChecker(typeChecker) {
2719 - function validate(props, propName, componentName, location, propFullName) {
2720 - if (typeof typeChecker !== 'function') {
2721 - return new PropTypeError('Property `' + propFullName + '` of component `' + componentName + '` has invalid PropType notation inside arrayOf.');
2722 - }
2723 - var propValue = props[propName];
2724 - if (!Array.isArray(propValue)) {
2725 - var locationName = ReactPropTypeLocationNames[location];
2726 - var propType = getPropType(propValue);
2727 - return new PropTypeError('Invalid ' + locationName + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected an array.'));
2728 - }
2729 - for (var i = 0; i < propValue.length; i++) {
2730 - var error = typeChecker(propValue, i, componentName, location, propFullName + '[' + i + ']', ReactPropTypesSecret);
2731 - if (error instanceof Error) {
2732 - return error;
2733 - }
2734 - }
2735 - return null;
2736 - }
2737 - return createChainableTypeChecker(validate);
2738 -}
2739 -
2740 -function createElementTypeChecker() {
2741 - function validate(props, propName, componentName, location, propFullName) {
2742 - var propValue = props[propName];
2743 - if (!ReactElement.isValidElement(propValue)) {
2744 - var locationName = ReactPropTypeLocationNames[location];
2745 - var propType = getPropType(propValue);
2746 - return new PropTypeError('Invalid ' + locationName + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected a single ReactElement.'));
2747 - }
2748 - return null;
2749 - }
2750 - return createChainableTypeChecker(validate);
2751 -}
2752 -
2753 -function createInstanceTypeChecker(expectedClass) {
2754 - function validate(props, propName, componentName, location, propFullName) {
2755 - if (!(props[propName] instanceof expectedClass)) {
2756 - var locationName = ReactPropTypeLocationNames[location];
2757 - var expectedClassName = expectedClass.name || ANONYMOUS;
2758 - var actualClassName = getClassName(props[propName]);
2759 - return new PropTypeError('Invalid ' + locationName + ' `' + propFullName + '` of type ' + ('`' + actualClassName + '` supplied to `' + componentName + '`, expected ') + ('instance of `' + expectedClassName + '`.'));
2760 - }
2761 - return null;
2762 - }
2763 - return createChainableTypeChecker(validate);
2764 -}
2765 -
2766 -function createEnumTypeChecker(expectedValues) {
2767 - if (!Array.isArray(expectedValues)) {
2768 - "development" !== 'production' ? warning(false, 'Invalid argument supplied to oneOf, expected an instance of array.') : void 0;
2769 - return emptyFunction.thatReturnsNull;
2770 - }
2771 -
2772 - function validate(props, propName, componentName, location, propFullName) {
2773 - var propValue = props[propName];
2774 - for (var i = 0; i < expectedValues.length; i++) {
2775 - if (is(propValue, expectedValues[i])) {
2776 - return null;
2777 - }
2778 - }
2779 -
2780 - var locationName = ReactPropTypeLocationNames[location];
2781 - var valuesString = JSON.stringify(expectedValues);
2782 - return new PropTypeError('Invalid ' + locationName + ' `' + propFullName + '` of value `' + propValue + '` ' + ('supplied to `' + componentName + '`, expected one of ' + valuesString + '.'));
2783 - }
2784 - return createChainableTypeChecker(validate);
2785 -}
2786 -
2787 -function createObjectOfTypeChecker(typeChecker) {
2788 - function validate(props, propName, componentName, location, propFullName) {
2789 - if (typeof typeChecker !== 'function') {
2790 - return new PropTypeError('Property `' + propFullName + '` of component `' + componentName + '` has invalid PropType notation inside objectOf.');
2791 - }
2792 - var propValue = props[propName];
2793 - var propType = getPropType(propValue);
2794 - if (propType !== 'object') {
2795 - var locationName = ReactPropTypeLocationNames[location];
2796 - return new PropTypeError('Invalid ' + locationName + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected an object.'));
2797 - }
2798 - for (var key in propValue) {
2799 - if (propValue.hasOwnProperty(key)) {
2800 - var error = typeChecker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret);
2801 - if (error instanceof Error) {
2802 - return error;
2803 - }
2804 - }
2805 - }
2806 - return null;
2807 - }
2808 - return createChainableTypeChecker(validate);
2809 -}
2810 -
2811 -function createUnionTypeChecker(arrayOfTypeCheckers) {
2812 - if (!Array.isArray(arrayOfTypeCheckers)) {
2813 - "development" !== 'production' ? warning(false, 'Invalid argument supplied to oneOfType, expected an instance of array.') : void 0;
2814 - return emptyFunction.thatReturnsNull;
2815 - }
2816 -
2817 - function validate(props, propName, componentName, location, propFullName) {
2818 - for (var i = 0; i < arrayOfTypeCheckers.length; i++) {
2819 - var checker = arrayOfTypeCheckers[i];
2820 - if (checker(props, propName, componentName, location, propFullName, ReactPropTypesSecret) == null) {
2821 - return null;
2822 - }
2823 - }
2824 -
2825 - var locationName = ReactPropTypeLocationNames[location];
2826 - return new PropTypeError('Invalid ' + locationName + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`.'));
2827 - }
2828 - return createChainableTypeChecker(validate);
2829 -}
2830 -
2831 -function createNodeChecker() {
2832 - function validate(props, propName, componentName, location, propFullName) {
2833 - if (!isNode(props[propName])) {
2834 - var locationName = ReactPropTypeLocationNames[location];
2835 - return new PropTypeError('Invalid ' + locationName + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`, expected a ReactNode.'));
2836 - }
2837 - return null;
2838 - }
2839 - return createChainableTypeChecker(validate);
2840 -}
2841 -
2842 -function createShapeTypeChecker(shapeTypes) {
2843 - function validate(props, propName, componentName, location, propFullName) {
2844 - var propValue = props[propName];
2845 - var propType = getPropType(propValue);
2846 - if (propType !== 'object') {
2847 - var locationName = ReactPropTypeLocationNames[location];
2848 - return new PropTypeError('Invalid ' + locationName + ' `' + propFullName + '` of type `' + propType + '` ' + ('supplied to `' + componentName + '`, expected `object`.'));
2849 - }
2850 - for (var key in shapeTypes) {
2851 - var checker = shapeTypes[key];
2852 - if (!checker) {
2853 - continue;
2854 - }
2855 - var error = checker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret);
2856 - if (error) {
2857 - return error;
2858 - }
2859 - }
2860 - return null;
2861 - }
2862 - return createChainableTypeChecker(validate);
2863 -}
2864 -
2865 -function isNode(propValue) {
2866 - switch (typeof propValue) {
2867 - case 'number':
2868 - case 'string':
2869 - case 'undefined':
2870 - return true;
2871 - case 'boolean':
2872 - return !propValue;
2873 - case 'object':
2874 - if (Array.isArray(propValue)) {
2875 - return propValue.every(isNode);
2876 - }
2877 - if (propValue === null || ReactElement.isValidElement(propValue)) {
2878 - return true;
2879 - }
2880 -
2881 - var iteratorFn = getIteratorFn(propValue);
2882 - if (iteratorFn) {
2883 - var iterator = iteratorFn.call(propValue);
2884 - var step;
2885 - if (iteratorFn !== propValue.entries) {
2886 - while (!(step = iterator.next()).done) {
2887 - if (!isNode(step.value)) {
2888 - return false;
2889 - }
2890 - }
2891 - } else {
2892 - // Iterator will provide entry [k,v] tuples rather than values.
2893 - while (!(step = iterator.next()).done) {
2894 - var entry = step.value;
2895 - if (entry) {
2896 - if (!isNode(entry[1])) {
2897 - return false;
2898 - }
2899 - }
2900 - }
2901 - }
2902 - } else {
2903 - return false;
2904 - }
2905 -
2906 - return true;
2907 - default:
2908 - return false;
2909 - }
2910 -}
2911 -
2912 -function isSymbol(propType, propValue) {
2913 - // Native Symbol.
2914 - if (propType === 'symbol') {
2915 - return true;
2916 - }
2917 -
2918 - // 19.4.3.5 Symbol.prototype[@@toStringTag] === 'Symbol'
2919 - if (propValue['@@toStringTag'] === 'Symbol') {
2920 - return true;
2921 - }
2922 -
2923 - // Fallback for non-spec compliant Symbols which are polyfilled.
2924 - if (typeof Symbol === 'function' && propValue instanceof Symbol) {
2925 - return true;
2926 - }
2927 -
2928 - return false;
2929 -}
2930 -
2931 -// Equivalent of `typeof` but with special handling for array and regexp.
2932 -function getPropType(propValue) {
2933 - var propType = typeof propValue;
2934 - if (Array.isArray(propValue)) {
2935 - return 'array';
2936 - }
2937 - if (propValue instanceof RegExp) {
2938 - // Old webkits (at least until Android 4.0) return 'function' rather than
2939 - // 'object' for typeof a RegExp. We'll normalize this here so that /bla/
2940 - // passes PropTypes.object.
2941 - return 'object';
2942 - }
2943 - if (isSymbol(propType, propValue)) {
2944 - return 'symbol';
2945 - }
2946 - return propType;
2947 -}
2948 -
2949 -// This handles more types than `getPropType`. Only used for error messages.
2950 -// See `createPrimitiveTypeChecker`.
2951 -function getPreciseType(propValue) {
2952 - var propType = getPropType(propValue);
2953 - if (propType === 'object') {
2954 - if (propValue instanceof Date) {
2955 - return 'date';
2956 - } else if (propValue instanceof RegExp) {
2957 - return 'regexp';
2958 - }
2959 - }
2960 - return propType;
2961 -}
2962 -
2963 -// Returns class name of the object, if any.
2964 -function getClassName(propValue) {
2965 - if (!propValue.constructor || !propValue.constructor.name) {
2966 - return ANONYMOUS;
2967 - }
2968 - return propValue.constructor.name;
2969 -}
2970 -
2971 -module.exports = ReactPropTypes;
2972 -},{"10":10,"14":14,"16":16,"22":22,"26":26,"29":29}],16:[function(_dereq_,module,exports){
2973 -/**
2974 - * Copyright 2013-present, Facebook, Inc.
2975 - * All rights reserved.
2976 - *
2977 - * This source code is licensed under the BSD-style license found in the
2978 - * LICENSE file in the root directory of this source tree. An additional grant
2979 - * of patent rights can be found in the PATENTS file in the same directory.
2980 - *
2981 - *
2982 - */
2983 -
2984 -'use strict';
2985 -
2986 -var ReactPropTypesSecret = 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED';
2987 -
2988 -module.exports = ReactPropTypesSecret;
2989 -},{}],17:[function(_dereq_,module,exports){
2990 -/**
2991 - * Copyright 2013-present, Facebook, Inc.
2992 - * All rights reserved.
2993 - *
2994 - * This source code is licensed under the BSD-style license found in the
2995 - * LICENSE file in the root directory of this source tree. An additional grant
2996 - * of patent rights can be found in the PATENTS file in the same directory.
2997 - *
2998 - */
2999 -
3000 -'use strict';
3001 -
3002 -var _assign = _dereq_(30);
3003 -
3004 -var ReactComponent = _dereq_(6);
3005 -var ReactNoopUpdateQueue = _dereq_(13);
3006 -
3007 -var emptyObject = _dereq_(27);
3008 -
3009 -/**
3010 - * Base class helpers for the updating state of a component.
3011 - */
3012 -function ReactPureComponent(props, context, updater) {
3013 - // Duplicated from ReactComponent.
3014 - this.props = props;
3015 - this.context = context;
3016 - this.refs = emptyObject;
3017 - // We initialize the default updater but the real one gets injected by the
3018 - // renderer.
3019 - this.updater = updater || ReactNoopUpdateQueue;
3020 -}
3021 -
3022 -function ComponentDummy() {}
3023 -ComponentDummy.prototype = ReactComponent.prototype;
3024 -ReactPureComponent.prototype = new ComponentDummy();
3025 -ReactPureComponent.prototype.constructor = ReactPureComponent;
3026 -// Avoid an extra prototype jump for these methods.
3027 -_assign(ReactPureComponent.prototype, ReactComponent.prototype);
3028 -ReactPureComponent.prototype.isPureReactComponent = true;
3029 -
3030 -module.exports = ReactPureComponent;
3031 -},{"13":13,"27":27,"30":30,"6":6}],18:[function(_dereq_,module,exports){
3032 -/**
3033 - * Copyright 2013-present, Facebook, Inc.
3034 - * All rights reserved.
3035 - *
3036 - * This source code is licensed under the BSD-style license found in the
3037 - * LICENSE file in the root directory of this source tree. An additional grant
3038 - * of patent rights can be found in the PATENTS file in the same directory.
3039 - *
3040 - */
3041 -
3042 -'use strict';
3043 -
3044 -var _assign = _dereq_(30);
3045 -
3046 -var React = _dereq_(3);
3047 -
3048 -// `version` will be added here by the React module.
3049 -var ReactUMDEntry = _assign({
3050 - __SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED: {
3051 - ReactCurrentOwner: _dereq_(8)
3052 - }
3053 -}, React);
3054 -
3055 -if ("development" !== 'production') {
3056 - _assign(ReactUMDEntry.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED, {
3057 - // ReactComponentTreeHook should not be included in production.
3058 - ReactComponentTreeHook: _dereq_(7)
3059 - });
3060 -}
3061 -
3062 -module.exports = ReactUMDEntry;
3063 -},{"3":3,"30":30,"7":7,"8":8}],19:[function(_dereq_,module,exports){
3064 -/**
3065 - * Copyright 2013-present, Facebook, Inc.
3066 - * All rights reserved.
3067 - *
3068 - * This source code is licensed under the BSD-style license found in the
3069 - * LICENSE file in the root directory of this source tree. An additional grant
3070 - * of patent rights can be found in the PATENTS file in the same directory.
3071 - *
3072 - */
3073 -
3074 -'use strict';
3075 -
3076 -module.exports = '15.4.0';
3077 -},{}],20:[function(_dereq_,module,exports){
3078 -/**
3079 - * Copyright 2013-present, Facebook, Inc.
3080 - * All rights reserved.
3081 - *
3082 - * This source code is licensed under the BSD-style license found in the
3083 - * LICENSE file in the root directory of this source tree. An additional grant
3084 - * of patent rights can be found in the PATENTS file in the same directory.
3085 - *
3086 - *
3087 - */
3088 -
3089 -'use strict';
3090 -
3091 -var canDefineProperty = false;
3092 -if ("development" !== 'production') {
3093 - try {
3094 - // $FlowFixMe https://github.com/facebook/flow/issues/285
3095 - Object.defineProperty({}, 'x', { get: function () {} });
3096 - canDefineProperty = true;
3097 - } catch (x) {
3098 - // IE will fail on defineProperty
3099 - }
3100 -}
3101 -
3102 -module.exports = canDefineProperty;
3103 -},{}],21:[function(_dereq_,module,exports){
3104 -(function (process){
3105 -/**
3106 - * Copyright 2013-present, Facebook, Inc.
3107 - * All rights reserved.
3108 - *
3109 - * This source code is licensed under the BSD-style license found in the
3110 - * LICENSE file in the root directory of this source tree. An additional grant
3111 - * of patent rights can be found in the PATENTS file in the same directory.
3112 - *
3113 - */
3114 -
3115 -'use strict';
3116 -
3117 -var _prodInvariant = _dereq_(24);
3118 -
3119 -var ReactPropTypeLocationNames = _dereq_(14);
3120 -var ReactPropTypesSecret = _dereq_(16);
3121 -
3122 -var invariant = _dereq_(28);
3123 -var warning = _dereq_(29);
3124 -
3125 -var ReactComponentTreeHook;
3126 -
3127 -if (typeof process !== 'undefined' && process.env && "development" === 'test') {
3128 - // Temporary hack.
3129 - // Inline requires don't work well with Jest:
3130 - // https://github.com/facebook/react/issues/7240
3131 - // Remove the inline requires when we don't need them anymore:
3132 - // https://github.com/facebook/react/pull/7178
3133 - ReactComponentTreeHook = _dereq_(7);
3134 -}
3135 -
3136 -var loggedTypeFailures = {};
3137 -
3138 -/**
3139 - * Assert that the values match with the type specs.
3140 - * Error messages are memorized and will only be shown once.
3141 - *
3142 - * @param {object} typeSpecs Map of name to a ReactPropType
3143 - * @param {object} values Runtime values that need to be type-checked
3144 - * @param {string} location e.g. "prop", "context", "child context"
3145 - * @param {string} componentName Name of the component for error messages.
3146 - * @param {?object} element The React element that is being type-checked
3147 - * @param {?number} debugID The React component instance that is being type-checked
3148 - * @private
3149 - */
3150 -function checkReactTypeSpec(typeSpecs, values, location, componentName, element, debugID) {
3151 - for (var typeSpecName in typeSpecs) {
3152 - if (typeSpecs.hasOwnProperty(typeSpecName)) {
3153 - var error;
3154 - // Prop type validation may throw. In case they do, we don't want to
3155 - // fail the render phase where it didn't fail before. So we log it.
3156 - // After these have been cleaned up, we'll let them throw.
3157 - try {
3158 - // This is intentionally an invariant that gets caught. It's the same
3159 - // behavior as without this statement except with a better message.
3160 - !(typeof typeSpecs[typeSpecName] === 'function') ? "development" !== 'production' ? invariant(false, '%s: %s type `%s` is invalid; it must be a function, usually from React.PropTypes.', componentName || 'React class', ReactPropTypeLocationNames[location], typeSpecName) : _prodInvariant('84', componentName || 'React class', ReactPropTypeLocationNames[location], typeSpecName) : void 0;
3161 - error = typeSpecs[typeSpecName](values, typeSpecName, componentName, location, null, ReactPropTypesSecret);
3162 - } catch (ex) {
3163 - error = ex;
3164 - }
3165 - "development" !== '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], typeSpecName, typeof error) : void 0;
3166 - if (error instanceof Error && !(error.message in loggedTypeFailures)) {
3167 - // Only monitor this failure once because there tends to be a lot of the
3168 - // same error.
3169 - loggedTypeFailures[error.message] = true;
3170 -
3171 - var componentStackInfo = '';
3172 -
3173 - if ("development" !== 'production') {
3174 - if (!ReactComponentTreeHook) {
3175 - ReactComponentTreeHook = _dereq_(7);
3176 - }
3177 - if (debugID !== null) {
3178 - componentStackInfo = ReactComponentTreeHook.getStackAddendumByID(debugID);
3179 - } else if (element !== null) {
3180 - componentStackInfo = ReactComponentTreeHook.getCurrentStackAddendum(element);
3181 - }
3182 - }
3183 -
3184 - "development" !== 'production' ? warning(false, 'Failed %s type: %s%s', location, error.message, componentStackInfo) : void 0;
3185 - }
3186 - }
3187 - }
3188 -}
3189 -
3190 -module.exports = checkReactTypeSpec;
3191 -}).call(this,undefined)
3192 -},{"14":14,"16":16,"24":24,"28":28,"29":29,"7":7}],22:[function(_dereq_,module,exports){
3193 -/**
3194 - * Copyright 2013-present, Facebook, Inc.
3195 - * All rights reserved.
3196 - *
3197 - * This source code is licensed under the BSD-style license found in the
3198 - * LICENSE file in the root directory of this source tree. An additional grant
3199 - * of patent rights can be found in the PATENTS file in the same directory.
3200 - *
3201 - *
3202 - */
3203 -
3204 -'use strict';
3205 -
3206 -/* global Symbol */
3207 -
3208 -var ITERATOR_SYMBOL = typeof Symbol === 'function' && Symbol.iterator;
3209 -var FAUX_ITERATOR_SYMBOL = '@@iterator'; // Before Symbol spec.
3210 -
3211 -/**
3212 - * Returns the iterator method function contained on the iterable object.
3213 - *
3214 - * Be sure to invoke the function with the iterable as context:
3215 - *
3216 - * var iteratorFn = getIteratorFn(myIterable);
3217 - * if (iteratorFn) {
3218 - * var iterator = iteratorFn.call(myIterable);
3219 - * ...
3220 - * }
3221 - *
3222 - * @param {?object} maybeIterable
3223 - * @return {?function}
3224 - */
3225 -function getIteratorFn(maybeIterable) {
3226 - var iteratorFn = maybeIterable && (ITERATOR_SYMBOL && maybeIterable[ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL]);
3227 - if (typeof iteratorFn === 'function') {
3228 - return iteratorFn;
3229 - }
3230 -}
3231 -
3232 -module.exports = getIteratorFn;
3233 -},{}],23:[function(_dereq_,module,exports){
3234 -/**
3235 - * Copyright 2013-present, Facebook, Inc.
3236 - * All rights reserved.
3237 - *
3238 - * This source code is licensed under the BSD-style license found in the
3239 - * LICENSE file in the root directory of this source tree. An additional grant
3240 - * of patent rights can be found in the PATENTS file in the same directory.
3241 - *
3242 - */
3243 -'use strict';
3244 -
3245 -var _prodInvariant = _dereq_(24);
3246 -
3247 -var ReactElement = _dereq_(10);
3248 -
3249 -var invariant = _dereq_(28);
3250 -
3251 -/**
3252 - * Returns the first child in a collection of children and verifies that there
3253 - * is only one child in the collection.
3254 - *
3255 - * See https://facebook.github.io/react/docs/top-level-api.html#react.children.only
3256 - *
3257 - * The current implementation of this function assumes that a single child gets
3258 - * passed without a wrapper, but the purpose of this helper function is to
3259 - * abstract away the particular structure of children.
3260 - *
3261 - * @param {?object} children Child collection structure.
3262 - * @return {ReactElement} The first and only `ReactElement` contained in the
3263 - * structure.
3264 - */
3265 -function onlyChild(children) {
3266 - !ReactElement.isValidElement(children) ? "development" !== 'production' ? invariant(false, 'React.Children.only expected to receive a single React element child.') : _prodInvariant('143') : void 0;
3267 - return children;
3268 -}
3269 -
3270 -module.exports = onlyChild;
3271 -},{"10":10,"24":24,"28":28}],24:[function(_dereq_,module,exports){
3272 -/**
3273 - * Copyright (c) 2013-present, Facebook, Inc.
3274 - * All rights reserved.
3275 - *
3276 - * This source code is licensed under the BSD-style license found in the
3277 - * LICENSE file in the root directory of this source tree. An additional grant
3278 - * of patent rights can be found in the PATENTS file in the same directory.
3279 - *
3280 - *
3281 - */
3282 -'use strict';
3283 -
3284 -/**
3285 - * WARNING: DO NOT manually require this module.
3286 - * This is a replacement for `invariant(...)` used by the error code system
3287 - * and will _only_ be required by the corresponding babel pass.
3288 - * It always throws.
3289 - */
3290 -
3291 -function reactProdInvariant(code) {
3292 - var argCount = arguments.length - 1;
3293 -
3294 - var message = 'Minified React error #' + code + '; visit ' + 'http://facebook.github.io/react/docs/error-decoder.html?invariant=' + code;
3295 -
3296 - for (var argIdx = 0; argIdx < argCount; argIdx++) {
3297 - message += '&args[]=' + encodeURIComponent(arguments[argIdx + 1]);
3298 - }
3299 -
3300 - message += ' for the full message or use the non-minified dev environment' + ' for full errors and additional helpful warnings.';
3301 -
3302 - var error = new Error(message);
3303 - error.name = 'Invariant Violation';
3304 - error.framesToPop = 1; // we don't care about reactProdInvariant's own frame
3305 -
3306 - throw error;
3307 -}
3308 -
3309 -module.exports = reactProdInvariant;
3310 -},{}],25:[function(_dereq_,module,exports){
3311 -/**
3312 - * Copyright 2013-present, Facebook, Inc.
3313 - * All rights reserved.
3314 - *
3315 - * This source code is licensed under the BSD-style license found in the
3316 - * LICENSE file in the root directory of this source tree. An additional grant
3317 - * of patent rights can be found in the PATENTS file in the same directory.
3318 - *
3319 - */
3320 -
3321 -'use strict';
3322 -
3323 -var _prodInvariant = _dereq_(24);
3324 -
3325 -var ReactCurrentOwner = _dereq_(8);
3326 -var REACT_ELEMENT_TYPE = _dereq_(11);
3327 -
3328 -var getIteratorFn = _dereq_(22);
3329 -var invariant = _dereq_(28);
3330 -var KeyEscapeUtils = _dereq_(1);
3331 -var warning = _dereq_(29);
3332 -
3333 -var SEPARATOR = '.';
3334 -var SUBSEPARATOR = ':';
3335 -
3336 -/**
3337 - * This is inlined from ReactElement since this file is shared between
3338 - * isomorphic and renderers. We could extract this to a
3339 - *
3340 - */
3341 -
3342 -/**
3343 - * TODO: Test that a single child and an array with one item have the same key
3344 - * pattern.
3345 - */
3346 -
3347 -var didWarnAboutMaps = false;
3348 -
3349 -/**
3350 - * Generate a key string that identifies a component within a set.
3351 - *
3352 - * @param {*} component A component that could contain a manual key.
3353 - * @param {number} index Index that is used if a manual key is not provided.
3354 - * @return {string}
3355 - */
3356 -function getComponentKey(component, index) {
3357 - // Do some typechecking here since we call this blindly. We want to ensure
3358 - // that we don't block potential future ES APIs.
3359 - if (component && typeof component === 'object' && component.key != null) {
3360 - // Explicit key
3361 - return KeyEscapeUtils.escape(component.key);
3362 - }
3363 - // Implicit key determined by the index in the set
3364 - return index.toString(36);
3365 -}
3366 -
3367 -/**
3368 - * @param {?*} children Children tree container.
3369 - * @param {!string} nameSoFar Name of the key path so far.
3370 - * @param {!function} callback Callback to invoke with each child found.
3371 - * @param {?*} traverseContext Used to pass information throughout the traversal
3372 - * process.
3373 - * @return {!number} The number of children in this subtree.
3374 - */
3375 -function traverseAllChildrenImpl(children, nameSoFar, callback, traverseContext) {
3376 - var type = typeof children;
3377 -
3378 - if (type === 'undefined' || type === 'boolean') {
3379 - // All of the above are perceived as null.
3380 - children = null;
3381 - }
3382 -
3383 - if (children === null || type === 'string' || type === 'number' ||
3384 - // The following is inlined from ReactElement. This means we can optimize
3385 - // some checks. React Fiber also inlines this logic for similar purposes.
3386 - type === 'object' && children.$$typeof === REACT_ELEMENT_TYPE) {
3387 - callback(traverseContext, children,
3388 - // If it's the only child, treat the name as if it was wrapped in an array
3389 - // so that it's consistent if the number of children grows.
3390 - nameSoFar === '' ? SEPARATOR + getComponentKey(children, 0) : nameSoFar);
3391 - return 1;
3392 - }
3393 -
3394 - var child;
3395 - var nextName;
3396 - var subtreeCount = 0; // Count of children found in the current subtree.
3397 - var nextNamePrefix = nameSoFar === '' ? SEPARATOR : nameSoFar + SUBSEPARATOR;
3398 -
3399 - if (Array.isArray(children)) {
3400 - for (var i = 0; i < children.length; i++) {
3401 - child = children[i];
3402 - nextName = nextNamePrefix + getComponentKey(child, i);
3403 - subtreeCount += traverseAllChildrenImpl(child, nextName, callback, traverseContext);
3404 - }
3405 - } else {
3406 - var iteratorFn = getIteratorFn(children);
3407 - if (iteratorFn) {
3408 - var iterator = iteratorFn.call(children);
3409 - var step;
3410 - if (iteratorFn !== children.entries) {
3411 - var ii = 0;
3412 - while (!(step = iterator.next()).done) {
3413 - child = step.value;
3414 - nextName = nextNamePrefix + getComponentKey(child, ii++);
3415 - subtreeCount += traverseAllChildrenImpl(child, nextName, callback, traverseContext);
3416 - }
3417 - } else {
3418 - if ("development" !== 'production') {
3419 - var mapsAsChildrenAddendum = '';
3420 - if (ReactCurrentOwner.current) {
3421 - var mapsAsChildrenOwnerName = ReactCurrentOwner.current.getName();
3422 - if (mapsAsChildrenOwnerName) {
3423 - mapsAsChildrenAddendum = ' Check the render method of `' + mapsAsChildrenOwnerName + '`.';
3424 - }
3425 - }
3426 - "development" !== '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.%s', mapsAsChildrenAddendum) : void 0;
3427 - didWarnAboutMaps = true;
3428 - }
3429 - // Iterator will provide entry [k,v] tuples rather than values.
3430 - while (!(step = iterator.next()).done) {
3431 - var entry = step.value;
3432 - if (entry) {
3433 - child = entry[1];
3434 - nextName = nextNamePrefix + KeyEscapeUtils.escape(entry[0]) + SUBSEPARATOR + getComponentKey(child, 0);
3435 - subtreeCount += traverseAllChildrenImpl(child, nextName, callback, traverseContext);
3436 - }
3437 - }
3438 - }
3439 - } else if (type === 'object') {
3440 - var addendum = '';
3441 - if ("development" !== 'production') {
3442 - 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.';
3443 - if (children._isReactElement) {
3444 - 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.';
3445 - }
3446 - if (ReactCurrentOwner.current) {
3447 - var name = ReactCurrentOwner.current.getName();
3448 - if (name) {
3449 - addendum += ' Check the render method of `' + name + '`.';
3450 - }
3451 - }
3452 - }
3453 - var childrenString = String(children);
3454 - !false ? "development" !== '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) : _prodInvariant('31', childrenString === '[object Object]' ? 'object with keys {' + Object.keys(children).join(', ') + '}' : childrenString, addendum) : void 0;
3455 - }
3456 - }
3457 -
3458 - return subtreeCount;
3459 -}
3460 -
3461 -/**
3462 - * Traverses children that are typically specified as `props.children`, but
3463 - * might also be specified through attributes:
3464 - *
3465 - * - `traverseAllChildren(this.props.children, ...)`
3466 - * - `traverseAllChildren(this.props.leftPanelChildren, ...)`
3467 - *
3468 - * The `traverseContext` is an optional argument that is passed through the
3469 - * entire traversal. It can be used to store accumulations or anything else that
3470 - * the callback might find relevant.
3471 - *
3472 - * @param {?*} children Children tree object.
3473 - * @param {!function} callback To invoke upon traversing each child.
3474 - * @param {?*} traverseContext Context for traversal.
3475 - * @return {!number} The number of children in this subtree.
3476 - */
3477 -function traverseAllChildren(children, callback, traverseContext) {
3478 - if (children == null) {
3479 - return 0;
3480 - }
3481 -
3482 - return traverseAllChildrenImpl(children, '', callback, traverseContext);
3483 -}
3484 -
3485 -module.exports = traverseAllChildren;
3486 -},{"1":1,"11":11,"22":22,"24":24,"28":28,"29":29,"8":8}],26:[function(_dereq_,module,exports){
3487 -"use strict";
3488 -
3489 -/**
3490 - * Copyright (c) 2013-present, Facebook, Inc.
3491 - * All rights reserved.
3492 - *
3493 - * This source code is licensed under the BSD-style license found in the
3494 - * LICENSE file in the root directory of this source tree. An additional grant
3495 - * of patent rights can be found in the PATENTS file in the same directory.
3496 - *
3497 - *
3498 - */
3499 -
3500 -function makeEmptyFunction(arg) {
3501 - return function () {
3502 - return arg;
3503 - };
3504 -}
3505 -
3506 -/**
3507 - * This function accepts and discards inputs; it has no side effects. This is
3508 - * primarily useful idiomatically for overridable function endpoints which
3509 - * always need to be callable, since JS lacks a null-call idiom ala Cocoa.
3510 - */
3511 -var emptyFunction = function emptyFunction() {};
3512 -
3513 -emptyFunction.thatReturns = makeEmptyFunction;
3514 -emptyFunction.thatReturnsFalse = makeEmptyFunction(false);
3515 -emptyFunction.thatReturnsTrue = makeEmptyFunction(true);
3516 -emptyFunction.thatReturnsNull = makeEmptyFunction(null);
3517 -emptyFunction.thatReturnsThis = function () {
3518 - return this;
3519 -};
3520 -emptyFunction.thatReturnsArgument = function (arg) {
3521 - return arg;
3522 -};
3523 -
3524 -module.exports = emptyFunction;
3525 -},{}],27:[function(_dereq_,module,exports){
3526 -/**
3527 - * Copyright (c) 2013-present, Facebook, Inc.
3528 - * All rights reserved.
3529 - *
3530 - * This source code is licensed under the BSD-style license found in the
3531 - * LICENSE file in the root directory of this source tree. An additional grant
3532 - * of patent rights can be found in the PATENTS file in the same directory.
3533 - *
3534 - */
3535 -
3536 -'use strict';
3537 -
3538 -var emptyObject = {};
3539 -
3540 -if ("development" !== 'production') {
3541 - Object.freeze(emptyObject);
3542 -}
3543 -
3544 -module.exports = emptyObject;
3545 -},{}],28:[function(_dereq_,module,exports){
3546 -/**
3547 - * Copyright (c) 2013-present, Facebook, Inc.
3548 - * All rights reserved.
3549 - *
3550 - * This source code is licensed under the BSD-style license found in the
3551 - * LICENSE file in the root directory of this source tree. An additional grant
3552 - * of patent rights can be found in the PATENTS file in the same directory.
3553 - *
3554 - */
3555 -
3556 -'use strict';
3557 -
3558 -/**
3559 - * Use invariant() to assert state which your program assumes to be true.
3560 - *
3561 - * Provide sprintf-style format (only %s is supported) and arguments
3562 - * to provide information about what broke and what you were
3563 - * expecting.
3564 - *
3565 - * The invariant message will be stripped in production, but the invariant
3566 - * will remain to ensure logic does not differ in production.
3567 - */
3568 -
3569 -function invariant(condition, format, a, b, c, d, e, f) {
3570 - if ("development" !== 'production') {
3571 - if (format === undefined) {
3572 - throw new Error('invariant requires an error message argument');
3573 - }
3574 - }
3575 -
3576 - if (!condition) {
3577 - var error;
3578 - if (format === undefined) {
3579 - error = new Error('Minified exception occurred; use the non-minified dev environment ' + 'for the full error message and additional helpful warnings.');
3580 - } else {
3581 - var args = [a, b, c, d, e, f];
3582 - var argIndex = 0;
3583 - error = new Error(format.replace(/%s/g, function () {
3584 - return args[argIndex++];
3585 - }));
3586 - error.name = 'Invariant Violation';
3587 - }
3588 -
3589 - error.framesToPop = 1; // we don't care about invariant's own frame
3590 - throw error;
3591 - }
3592 -}
3593 -
3594 -module.exports = invariant;
3595 -},{}],29:[function(_dereq_,module,exports){
3596 -/**
3597 - * Copyright 2014-2015, Facebook, Inc.
3598 - * All rights reserved.
3599 - *
3600 - * This source code is licensed under the BSD-style license found in the
3601 - * LICENSE file in the root directory of this source tree. An additional grant
3602 - * of patent rights can be found in the PATENTS file in the same directory.
3603 - *
3604 - */
3605 -
3606 -'use strict';
3607 -
3608 -var emptyFunction = _dereq_(26);
3609 -
3610 -/**
3611 - * Similar to invariant but only logs a warning if the condition is not met.
3612 - * This can be used to log issues in development environments in critical
3613 - * paths. Removing the logging code for production environments will keep the
3614 - * same logic and follow the same code paths.
3615 - */
3616 -
3617 -var warning = emptyFunction;
3618 -
3619 -if ("development" !== 'production') {
3620 - (function () {
3621 - var printWarning = function printWarning(format) {
3622 - for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
3623 - args[_key - 1] = arguments[_key];
3624 - }
3625 -
3626 - var argIndex = 0;
3627 - var message = 'Warning: ' + format.replace(/%s/g, function () {
3628 - return args[argIndex++];
3629 - });
3630 - if (typeof console !== 'undefined') {
3631 - console.error(message);
3632 - }
3633 - try {
3634 - // --- Welcome to debugging React ---
3635 - // This error was thrown as a convenience so that you can use this stack
3636 - // to find the callsite that caused this warning to fire.
3637 - throw new Error(message);
3638 - } catch (x) {}
3639 - };
3640 -
3641 - warning = function warning(condition, format) {
3642 - if (format === undefined) {
3643 - throw new Error('`warning(condition, format, ...args)` requires a warning ' + 'message argument');
3644 - }
3645 -
3646 - if (format.indexOf('Failed Composite propType: ') === 0) {
3647 - return; // Ignore CompositeComponent proptype check.
3648 - }
3649 -
3650 - if (!condition) {
3651 - for (var _len2 = arguments.length, args = Array(_len2 > 2 ? _len2 - 2 : 0), _key2 = 2; _key2 < _len2; _key2++) {
3652 - args[_key2 - 2] = arguments[_key2];
3653 - }
3654 -
3655 - printWarning.apply(undefined, [format].concat(args));
3656 - }
3657 - };
3658 - })();
3659 -}
3660 -
3661 -module.exports = warning;
3662 -},{"26":26}],30:[function(_dereq_,module,exports){
3663 -'use strict';
3664 -/* eslint-disable no-unused-vars */
3665 -var hasOwnProperty = Object.prototype.hasOwnProperty;
3666 -var propIsEnumerable = Object.prototype.propertyIsEnumerable;
3667 -
3668 -function toObject(val) {
3669 - if (val === null || val === undefined) {
3670 - throw new TypeError('Object.assign cannot be called with null or undefined');
3671 - }
3672 -
3673 - return Object(val);
3674 -}
3675 -
3676 -function shouldUseNative() {
3677 - try {
3678 - if (!Object.assign) {
3679 - return false;
3680 - }
3681 -
3682 - // Detect buggy property enumeration order in older V8 versions.
3683 -
3684 - // https://bugs.chromium.org/p/v8/issues/detail?id=4118
3685 - var test1 = new String('abc'); // eslint-disable-line
3686 - test1[5] = 'de';
3687 - if (Object.getOwnPropertyNames(test1)[0] === '5') {
3688 - return false;
3689 - }
3690 -
3691 - // https://bugs.chromium.org/p/v8/issues/detail?id=3056
3692 - var test2 = {};
3693 - for (var i = 0; i < 10; i++) {
3694 - test2['_' + String.fromCharCode(i)] = i;
3695 - }
3696 - var order2 = Object.getOwnPropertyNames(test2).map(function (n) {
3697 - return test2[n];
3698 - });
3699 - if (order2.join('') !== '0123456789') {
3700 - return false;
3701 - }
3702 -
3703 - // https://bugs.chromium.org/p/v8/issues/detail?id=3056
3704 - var test3 = {};
3705 - 'abcdefghijklmnopqrst'.split('').forEach(function (letter) {
3706 - test3[letter] = letter;
3707 - });
3708 - if (Object.keys(Object.assign({}, test3)).join('') !==
3709 - 'abcdefghijklmnopqrst') {
3710 - return false;
3711 - }
3712 -
3713 - return true;
3714 - } catch (e) {
3715 - // We don't expect any of the above to throw, but better to be safe.
3716 - return false;
3717 - }
3718 -}
3719 -
3720 -module.exports = shouldUseNative() ? Object.assign : function (target, source) {
3721 - var from;
3722 - var to = toObject(target);
3723 - var symbols;
3724 -
3725 - for (var s = 1; s < arguments.length; s++) {
3726 - from = Object(arguments[s]);
3727 -
3728 - for (var key in from) {
3729 - if (hasOwnProperty.call(from, key)) {
3730 - to[key] = from[key];
3731 - }
3732 - }
3733 -
3734 - if (Object.getOwnPropertySymbols) {
3735 - symbols = Object.getOwnPropertySymbols(from);
3736 - for (var i = 0; i < symbols.length; i++) {
3737 - if (propIsEnumerable.call(from, symbols[i])) {
3738 - to[symbols[i]] = from[symbols[i]];
3739 - }
3740 - }
3741 - }
3742 - }
3743 -
3744 - return to;
3745 -};
3746 -
3747 -},{}]},{},[18])(18)
3748 -});
\ No newline at end of file
docs/js/remarkable.min.js deleted
-4
@@ -1,4 +0,0 @@
1 -/*! remarkable 1.7.1 https://github.com/jonschlinkert/remarkable @license MIT */
2 -!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var t;t="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,t.Remarkable=e()}}(function(){var e;return function t(e,r,n){function s(i,l){if(!r[i]){if(!e[i]){var a="function"==typeof require&&require;if(!l&&a)return a(i,!0);if(o)return o(i,!0);var c=new Error("Cannot find module '"+i+"'");throw c.code="MODULE_NOT_FOUND",c}var u=r[i]={exports:{}};e[i][0].call(u.exports,function(t){var r=e[i][1][t];return s(r?r:t)},u,u.exports,t,e,r,n)}return r[i].exports}for(var o="function"==typeof require&&require,i=0;i<n.length;i++)s(n[i]);return s}({1:[function(e,t){"use strict";t.exports={Aacute:"Á",aacute:"á",Abreve:"Ă",abreve:"ă",ac:"∾",acd:"∿",acE:"∾̳",Acirc:"Â",acirc:"â",acute:"´",Acy:"А",acy:"а",AElig:"Æ",aelig:"æ",af:"⁡",Afr:"𝔄",afr:"𝔞",Agrave:"À",agrave:"à",alefsym:"ℵ",aleph:"ℵ",Alpha:"Α",alpha:"α",Amacr:"Ā",amacr:"ā",amalg:"⨿",AMP:"&",amp:"&",And:"⩓",and:"∧",andand:"⩕",andd:"⩜",andslope:"⩘",andv:"⩚",ang:"∠",ange:"⦤",angle:"∠",angmsd:"∡",angmsdaa:"⦨",angmsdab:"⦩",angmsdac:"⦪",angmsdad:"⦫",angmsdae:"⦬",angmsdaf:"⦭",angmsdag:"⦮",angmsdah:"⦯",angrt:"∟",angrtvb:"⊾",angrtvbd:"⦝",angsph:"∢",angst:"Å",angzarr:"⍼",Aogon:"Ą",aogon:"ą",Aopf:"𝔸",aopf:"𝕒",ap:"≈",apacir:"⩯",apE:"⩰",ape:"≊",apid:"≋",apos:"'",ApplyFunction:"⁡",approx:"≈",approxeq:"≊",Aring:"Å",aring:"å",Ascr:"𝒜",ascr:"𝒶",Assign:"≔",ast:"*",asymp:"≈",asympeq:"≍",Atilde:"Ã",atilde:"ã",Auml:"Ä",auml:"ä",awconint:"∳",awint:"⨑",backcong:"≌",backepsilon:"϶",backprime:"‵",backsim:"∽",backsimeq:"⋍",Backslash:"∖",Barv:"⫧",barvee:"⊽",Barwed:"⌆",barwed:"⌅",barwedge:"⌅",bbrk:"⎵",bbrktbrk:"⎶",bcong:"≌",Bcy:"Б",bcy:"б",bdquo:"„",becaus:"∵",Because:"∵",because:"∵",bemptyv:"⦰",bepsi:"϶",bernou:"ℬ",Bernoullis:"ℬ",Beta:"Β",beta:"β",beth:"ℶ",between:"≬",Bfr:"𝔅",bfr:"𝔟",bigcap:"⋂",bigcirc:"◯",bigcup:"⋃",bigodot:"⨀",bigoplus:"⨁",bigotimes:"⨂",bigsqcup:"⨆",bigstar:"★",bigtriangledown:"▽",bigtriangleup:"△",biguplus:"⨄",bigvee:"⋁",bigwedge:"⋀",bkarow:"⤍",blacklozenge:"⧫",blacksquare:"▪",blacktriangle:"▴",blacktriangledown:"▾",blacktriangleleft:"◂",blacktriangleright:"▸",blank:"␣",blk12:"▒",blk14:"░",blk34:"▓",block:"█",bne:"=⃥",bnequiv:"≡⃥",bNot:"⫭",bnot:"⌐",Bopf:"𝔹",bopf:"𝕓",bot:"⊥",bottom:"⊥",bowtie:"⋈",boxbox:"⧉",boxDL:"╗",boxDl:"╖",boxdL:"╕",boxdl:"┐",boxDR:"╔",boxDr:"╓",boxdR:"╒",boxdr:"┌",boxH:"═",boxh:"─",boxHD:"╦",boxHd:"╤",boxhD:"╥",boxhd:"┬",boxHU:"╩",boxHu:"╧",boxhU:"╨",boxhu:"┴",boxminus:"⊟",boxplus:"⊞",boxtimes:"⊠",boxUL:"╝",boxUl:"╜",boxuL:"╛",boxul:"┘",boxUR:"╚",boxUr:"╙",boxuR:"╘",boxur:"└",boxV:"║",boxv:"│",boxVH:"╬",boxVh:"╫",boxvH:"╪",boxvh:"┼",boxVL:"╣",boxVl:"╢",boxvL:"╡",boxvl:"┤",boxVR:"╠",boxVr:"╟",boxvR:"╞",boxvr:"├",bprime:"‵",Breve:"˘",breve:"˘",brvbar:"¦",Bscr:"ℬ",bscr:"𝒷",bsemi:"⁏",bsim:"∽",bsime:"⋍",bsol:"\\",bsolb:"⧅",bsolhsub:"⟈",bull:"•",bullet:"•",bump:"≎",bumpE:"⪮",bumpe:"≏",Bumpeq:"≎",bumpeq:"≏",Cacute:"Ć",cacute:"ć",Cap:"⋒",cap:"∩",capand:"⩄",capbrcup:"⩉",capcap:"⩋",capcup:"⩇",capdot:"⩀",CapitalDifferentialD:"ⅅ",caps:"∩︀",caret:"⁁",caron:"ˇ",Cayleys:"ℭ",ccaps:"⩍",Ccaron:"Č",ccaron:"č",Ccedil:"Ç",ccedil:"ç",Ccirc:"Ĉ",ccirc:"ĉ",Cconint:"∰",ccups:"⩌",ccupssm:"⩐",Cdot:"Ċ",cdot:"ċ",cedil:"¸",Cedilla:"¸",cemptyv:"⦲",cent:"¢",CenterDot:"·",centerdot:"·",Cfr:"ℭ",cfr:"𝔠",CHcy:"Ч",chcy:"ч",check:"✓",checkmark:"✓",Chi:"Χ",chi:"χ",cir:"○",circ:"ˆ",circeq:"≗",circlearrowleft:"↺",circlearrowright:"↻",circledast:"⊛",circledcirc:"⊚",circleddash:"⊝",CircleDot:"⊙",circledR:"®",circledS:"Ⓢ",CircleMinus:"⊖",CirclePlus:"⊕",CircleTimes:"⊗",cirE:"⧃",cire:"≗",cirfnint:"⨐",cirmid:"⫯",cirscir:"⧂",ClockwiseContourIntegral:"∲",CloseCurlyDoubleQuote:"”",CloseCurlyQuote:"’",clubs:"♣",clubsuit:"♣",Colon:"∷",colon:":",Colone:"⩴",colone:"≔",coloneq:"≔",comma:",",commat:"@",comp:"∁",compfn:"∘",complement:"∁",complexes:"ℂ",cong:"≅",congdot:"⩭",Congruent:"≡",Conint:"∯",conint:"∮",ContourIntegral:"∮",Copf:"ℂ",copf:"𝕔",coprod:"∐",Coproduct:"∐",COPY:"©",copy:"©",copysr:"℗",CounterClockwiseContourIntegral:"∳",crarr:"↵",Cross:"⨯",cross:"✗",Cscr:"𝒞",cscr:"𝒸",csub:"⫏",csube:"⫑",csup:"⫐",csupe:"⫒",ctdot:"⋯",cudarrl:"⤸",cudarrr:"⤵",cuepr:"⋞",cuesc:"⋟",cularr:"↶",cularrp:"⤽",Cup:"⋓",cup:"∪",cupbrcap:"⩈",CupCap:"≍",cupcap:"⩆",cupcup:"⩊",cupdot:"⊍",cupor:"⩅",cups:"∪︀",curarr:"↷",curarrm:"⤼",curlyeqprec:"⋞",curlyeqsucc:"⋟",curlyvee:"⋎",curlywedge:"⋏",curren:"¤",curvearrowleft:"↶",curvearrowright:"↷",cuvee:"⋎",cuwed:"⋏",cwconint:"∲",cwint:"∱",cylcty:"⌭",Dagger:"‡",dagger:"†",daleth:"ℸ",Darr:"↡",dArr:"⇓",darr:"↓",dash:"‐",Dashv:"⫤",dashv:"⊣",dbkarow:"⤏",dblac:"˝",Dcaron:"Ď",dcaron:"ď",Dcy:"Д",dcy:"д",DD:"ⅅ",dd:"ⅆ",ddagger:"‡",ddarr:"⇊",DDotrahd:"⤑",ddotseq:"⩷",deg:"°",Del:"∇",Delta:"Δ",delta:"δ",demptyv:"⦱",dfisht:"⥿",Dfr:"𝔇",dfr:"𝔡",dHar:"⥥",dharl:"⇃",dharr:"⇂",DiacriticalAcute:"´",DiacriticalDot:"˙",DiacriticalDoubleAcute:"˝",DiacriticalGrave:"`",DiacriticalTilde:"˜",diam:"⋄",Diamond:"⋄",diamond:"⋄",diamondsuit:"♦",diams:"♦",die:"¨",DifferentialD:"ⅆ",digamma:"ϝ",disin:"⋲",div:"÷",divide:"÷",divideontimes:"⋇",divonx:"⋇",DJcy:"Ђ",djcy:"ђ",dlcorn:"⌞",dlcrop:"⌍",dollar:"$",Dopf:"𝔻",dopf:"𝕕",Dot:"¨",dot:"˙",DotDot:"⃜",doteq:"≐",doteqdot:"≑",DotEqual:"≐",dotminus:"∸",dotplus:"∔",dotsquare:"⊡",doublebarwedge:"⌆",DoubleContourIntegral:"∯",DoubleDot:"¨",DoubleDownArrow:"⇓",DoubleLeftArrow:"⇐",DoubleLeftRightArrow:"⇔",DoubleLeftTee:"⫤",DoubleLongLeftArrow:"⟸",DoubleLongLeftRightArrow:"⟺",DoubleLongRightArrow:"⟹",DoubleRightArrow:"⇒",DoubleRightTee:"⊨",DoubleUpArrow:"⇑",DoubleUpDownArrow:"⇕",DoubleVerticalBar:"∥",DownArrow:"↓",Downarrow:"⇓",downarrow:"↓",DownArrowBar:"⤓",DownArrowUpArrow:"⇵",DownBreve:"̑",downdownarrows:"⇊",downharpoonleft:"⇃",downharpoonright:"⇂",DownLeftRightVector:"⥐",DownLeftTeeVector:"⥞",DownLeftVector:"↽",DownLeftVectorBar:"⥖",DownRightTeeVector:"⥟",DownRightVector:"⇁",DownRightVectorBar:"⥗",DownTee:"⊤",DownTeeArrow:"↧",drbkarow:"⤐",drcorn:"⌟",drcrop:"⌌",Dscr:"𝒟",dscr:"𝒹",DScy:"Ѕ",dscy:"ѕ",dsol:"⧶",Dstrok:"Đ",dstrok:"đ",dtdot:"⋱",dtri:"▿",dtrif:"▾",duarr:"⇵",duhar:"⥯",dwangle:"⦦",DZcy:"Џ",dzcy:"џ",dzigrarr:"⟿",Eacute:"É",eacute:"é",easter:"⩮",Ecaron:"Ě",ecaron:"ě",ecir:"≖",Ecirc:"Ê",ecirc:"ê",ecolon:"≕",Ecy:"Э",ecy:"э",eDDot:"⩷",Edot:"Ė",eDot:"≑",edot:"ė",ee:"ⅇ",efDot:"≒",Efr:"𝔈",efr:"𝔢",eg:"⪚",Egrave:"È",egrave:"è",egs:"⪖",egsdot:"⪘",el:"⪙",Element:"∈",elinters:"⏧",ell:"ℓ",els:"⪕",elsdot:"⪗",Emacr:"Ē",emacr:"ē",empty:"∅",emptyset:"∅",EmptySmallSquare:"◻",emptyv:"∅",EmptyVerySmallSquare:"▫",emsp:" ",emsp13:" ",emsp14:" ",ENG:"Ŋ",eng:"ŋ",ensp:" ",Eogon:"Ę",eogon:"ę",Eopf:"𝔼",eopf:"𝕖",epar:"⋕",eparsl:"⧣",eplus:"⩱",epsi:"ε",Epsilon:"Ε",epsilon:"ε",epsiv:"ϵ",eqcirc:"≖",eqcolon:"≕",eqsim:"≂",eqslantgtr:"⪖",eqslantless:"⪕",Equal:"⩵",equals:"=",EqualTilde:"≂",equest:"≟",Equilibrium:"⇌",equiv:"≡",equivDD:"⩸",eqvparsl:"⧥",erarr:"⥱",erDot:"≓",Escr:"ℰ",escr:"ℯ",esdot:"≐",Esim:"⩳",esim:"≂",Eta:"Η",eta:"η",ETH:"Ð",eth:"ð",Euml:"Ë",euml:"ë",euro:"€",excl:"!",exist:"∃",Exists:"∃",expectation:"ℰ",ExponentialE:"ⅇ",exponentiale:"ⅇ",fallingdotseq:"≒",Fcy:"Ф",fcy:"ф",female:"♀",ffilig:"ffi",fflig:"ff",ffllig:"ffl",Ffr:"𝔉",ffr:"𝔣",filig:"fi",FilledSmallSquare:"◼",FilledVerySmallSquare:"▪",fjlig:"fj",flat:"♭",fllig:"fl",fltns:"▱",fnof:"ƒ",Fopf:"𝔽",fopf:"𝕗",ForAll:"∀",forall:"∀",fork:"⋔",forkv:"⫙",Fouriertrf:"ℱ",fpartint:"⨍",frac12:"½",frac13:"⅓",frac14:"¼",frac15:"⅕",frac16:"⅙",frac18:"⅛",frac23:"⅔",frac25:"⅖",frac34:"¾",frac35:"⅗",frac38:"⅜",frac45:"⅘",frac56:"⅚",frac58:"⅝",frac78:"⅞",frasl:"⁄",frown:"⌢",Fscr:"ℱ",fscr:"𝒻",gacute:"ǵ",Gamma:"Γ",gamma:"γ",Gammad:"Ϝ",gammad:"ϝ",gap:"⪆",Gbreve:"Ğ",gbreve:"ğ",Gcedil:"Ģ",Gcirc:"Ĝ",gcirc:"ĝ",Gcy:"Г",gcy:"г",Gdot:"Ġ",gdot:"ġ",gE:"≧",ge:"≥",gEl:"⪌",gel:"⋛",geq:"≥",geqq:"≧",geqslant:"⩾",ges:"⩾",gescc:"⪩",gesdot:"⪀",gesdoto:"⪂",gesdotol:"⪄",gesl:"⋛︀",gesles:"⪔",Gfr:"𝔊",gfr:"𝔤",Gg:"⋙",gg:"≫",ggg:"⋙",gimel:"ℷ",GJcy:"Ѓ",gjcy:"ѓ",gl:"≷",gla:"⪥",glE:"⪒",glj:"⪤",gnap:"⪊",gnapprox:"⪊",gnE:"≩",gne:"⪈",gneq:"⪈",gneqq:"≩",gnsim:"⋧",Gopf:"𝔾",gopf:"𝕘",grave:"`",GreaterEqual:"≥",GreaterEqualLess:"⋛",GreaterFullEqual:"≧",GreaterGreater:"⪢",GreaterLess:"≷",GreaterSlantEqual:"⩾",GreaterTilde:"≳",Gscr:"𝒢",gscr:"ℊ",gsim:"≳",gsime:"⪎",gsiml:"⪐",GT:">",Gt:"≫",gt:">",gtcc:"⪧",gtcir:"⩺",gtdot:"⋗",gtlPar:"⦕",gtquest:"⩼",gtrapprox:"⪆",gtrarr:"⥸",gtrdot:"⋗",gtreqless:"⋛",gtreqqless:"⪌",gtrless:"≷",gtrsim:"≳",gvertneqq:"≩︀",gvnE:"≩︀",Hacek:"ˇ",hairsp:" ",half:"½",hamilt:"ℋ",HARDcy:"Ъ",hardcy:"ъ",hArr:"⇔",harr:"↔",harrcir:"⥈",harrw:"↭",Hat:"^",hbar:"ℏ",Hcirc:"Ĥ",hcirc:"ĥ",hearts:"♥",heartsuit:"♥",hellip:"…",hercon:"⊹",Hfr:"ℌ",hfr:"𝔥",HilbertSpace:"ℋ",hksearow:"⤥",hkswarow:"⤦",hoarr:"⇿",homtht:"∻",hookleftarrow:"↩",hookrightarrow:"↪",Hopf:"ℍ",hopf:"𝕙",horbar:"―",HorizontalLine:"─",Hscr:"ℋ",hscr:"𝒽",hslash:"ℏ",Hstrok:"Ħ",hstrok:"ħ",HumpDownHump:"≎",HumpEqual:"≏",hybull:"⁃",hyphen:"‐",Iacute:"Í",iacute:"í",ic:"⁣",Icirc:"Î",icirc:"î",Icy:"И",icy:"и",Idot:"İ",IEcy:"Е",iecy:"е",iexcl:"¡",iff:"⇔",Ifr:"ℑ",ifr:"𝔦",Igrave:"Ì",igrave:"ì",ii:"ⅈ",iiiint:"⨌",iiint:"∭",iinfin:"⧜",iiota:"℩",IJlig:"IJ",ijlig:"ij",Im:"ℑ",Imacr:"Ī",imacr:"ī",image:"ℑ",ImaginaryI:"ⅈ",imagline:"ℐ",imagpart:"ℑ",imath:"ı",imof:"⊷",imped:"Ƶ",Implies:"⇒","in":"∈",incare:"℅",infin:"∞",infintie:"⧝",inodot:"ı",Int:"∬","int":"∫",intcal:"⊺",integers:"ℤ",Integral:"∫",intercal:"⊺",Intersection:"⋂",intlarhk:"⨗",intprod:"⨼",InvisibleComma:"⁣",InvisibleTimes:"⁢",IOcy:"Ё",iocy:"ё",Iogon:"Į",iogon:"į",Iopf:"𝕀",iopf:"𝕚",Iota:"Ι",iota:"ι",iprod:"⨼",iquest:"¿",Iscr:"ℐ",iscr:"𝒾",isin:"∈",isindot:"⋵",isinE:"⋹",isins:"⋴",isinsv:"⋳",isinv:"∈",it:"⁢",Itilde:"Ĩ",itilde:"ĩ",Iukcy:"І",iukcy:"і",Iuml:"Ï",iuml:"ï",Jcirc:"Ĵ",jcirc:"ĵ",Jcy:"Й",jcy:"й",Jfr:"𝔍",jfr:"𝔧",jmath:"ȷ",Jopf:"𝕁",jopf:"𝕛",Jscr:"𝒥",jscr:"𝒿",Jsercy:"Ј",jsercy:"ј",Jukcy:"Є",jukcy:"є",Kappa:"Κ",kappa:"κ",kappav:"ϰ",Kcedil:"Ķ",kcedil:"ķ",Kcy:"К",kcy:"к",Kfr:"𝔎",kfr:"𝔨",kgreen:"ĸ",KHcy:"Х",khcy:"х",KJcy:"Ќ",kjcy:"ќ",Kopf:"𝕂",kopf:"𝕜",Kscr:"𝒦",kscr:"𝓀",lAarr:"⇚",Lacute:"Ĺ",lacute:"ĺ",laemptyv:"⦴",lagran:"ℒ",Lambda:"Λ",lambda:"λ",Lang:"⟪",lang:"⟨",langd:"⦑",langle:"⟨",lap:"⪅",Laplacetrf:"ℒ",laquo:"«",Larr:"↞",lArr:"⇐",larr:"←",larrb:"⇤",larrbfs:"⤟",larrfs:"⤝",larrhk:"↩",larrlp:"↫",larrpl:"⤹",larrsim:"⥳",larrtl:"↢",lat:"⪫",lAtail:"⤛",latail:"⤙",late:"⪭",lates:"⪭︀",lBarr:"⤎",lbarr:"⤌",lbbrk:"❲",lbrace:"{",lbrack:"[",lbrke:"⦋",lbrksld:"⦏",lbrkslu:"⦍",Lcaron:"Ľ",lcaron:"ľ",Lcedil:"Ļ",lcedil:"ļ",lceil:"⌈",lcub:"{",Lcy:"Л",lcy:"л",ldca:"⤶",ldquo:"“",ldquor:"„",ldrdhar:"⥧",ldrushar:"⥋",ldsh:"↲",lE:"≦",le:"≤",LeftAngleBracket:"⟨",LeftArrow:"←",Leftarrow:"⇐",leftarrow:"←",LeftArrowBar:"⇤",LeftArrowRightArrow:"⇆",leftarrowtail:"↢",LeftCeiling:"⌈",LeftDoubleBracket:"⟦",LeftDownTeeVector:"⥡",LeftDownVector:"⇃",LeftDownVectorBar:"⥙",LeftFloor:"⌊",leftharpoondown:"↽",leftharpoonup:"↼",leftleftarrows:"⇇",LeftRightArrow:"↔",Leftrightarrow:"⇔",leftrightarrow:"↔",leftrightarrows:"⇆",leftrightharpoons:"⇋",leftrightsquigarrow:"↭",LeftRightVector:"⥎",LeftTee:"⊣",LeftTeeArrow:"↤",LeftTeeVector:"⥚",leftthreetimes:"⋋",LeftTriangle:"⊲",LeftTriangleBar:"⧏",LeftTriangleEqual:"⊴",LeftUpDownVector:"⥑",LeftUpTeeVector:"⥠",LeftUpVector:"↿",LeftUpVectorBar:"⥘",LeftVector:"↼",LeftVectorBar:"⥒",lEg:"⪋",leg:"⋚",leq:"≤",leqq:"≦",leqslant:"⩽",les:"⩽",lescc:"⪨",lesdot:"⩿",lesdoto:"⪁",lesdotor:"⪃",lesg:"⋚︀",lesges:"⪓",lessapprox:"⪅",lessdot:"⋖",lesseqgtr:"⋚",lesseqqgtr:"⪋",LessEqualGreater:"⋚",LessFullEqual:"≦",LessGreater:"≶",lessgtr:"≶",LessLess:"⪡",lesssim:"≲",LessSlantEqual:"⩽",LessTilde:"≲",lfisht:"⥼",lfloor:"⌊",Lfr:"𝔏",lfr:"𝔩",lg:"≶",lgE:"⪑",lHar:"⥢",lhard:"↽",lharu:"↼",lharul:"⥪",lhblk:"▄",LJcy:"Љ",ljcy:"љ",Ll:"⋘",ll:"≪",llarr:"⇇",llcorner:"⌞",Lleftarrow:"⇚",llhard:"⥫",lltri:"◺",Lmidot:"Ŀ",lmidot:"ŀ",lmoust:"⎰",lmoustache:"⎰",lnap:"⪉",lnapprox:"⪉",lnE:"≨",lne:"⪇",lneq:"⪇",lneqq:"≨",lnsim:"⋦",loang:"⟬",loarr:"⇽",lobrk:"⟦",LongLeftArrow:"⟵",Longleftarrow:"⟸",longleftarrow:"⟵",LongLeftRightArrow:"⟷",Longleftrightarrow:"⟺",longleftrightarrow:"⟷",longmapsto:"⟼",LongRightArrow:"⟶",Longrightarrow:"⟹",longrightarrow:"⟶",looparrowleft:"↫",looparrowright:"↬",lopar:"⦅",Lopf:"𝕃",lopf:"𝕝",loplus:"⨭",lotimes:"⨴",lowast:"∗",lowbar:"_",LowerLeftArrow:"↙",LowerRightArrow:"↘",loz:"◊",lozenge:"◊",lozf:"⧫",lpar:"(",lparlt:"⦓",lrarr:"⇆",lrcorner:"⌟",lrhar:"⇋",lrhard:"⥭",lrm:"‎",lrtri:"⊿",lsaquo:"‹",Lscr:"ℒ",lscr:"𝓁",Lsh:"↰",lsh:"↰",lsim:"≲",lsime:"⪍",lsimg:"⪏",lsqb:"[",lsquo:"‘",lsquor:"‚",Lstrok:"Ł",lstrok:"ł",LT:"<",Lt:"≪",lt:"<",ltcc:"⪦",ltcir:"⩹",ltdot:"⋖",lthree:"⋋",ltimes:"⋉",ltlarr:"⥶",ltquest:"⩻",ltri:"◃",ltrie:"⊴",ltrif:"◂",ltrPar:"⦖",lurdshar:"⥊",luruhar:"⥦",lvertneqq:"≨︀",lvnE:"≨︀",macr:"¯",male:"♂",malt:"✠",maltese:"✠",Map:"⤅",map:"↦",mapsto:"↦",mapstodown:"↧",mapstoleft:"↤",mapstoup:"↥",marker:"▮",mcomma:"⨩",Mcy:"М",mcy:"м",mdash:"—",mDDot:"∺",measuredangle:"∡",MediumSpace:" ",Mellintrf:"ℳ",Mfr:"𝔐",mfr:"𝔪",mho:"℧",micro:"µ",mid:"∣",midast:"*",midcir:"⫰",middot:"·",minus:"−",minusb:"⊟",minusd:"∸",minusdu:"⨪",MinusPlus:"∓",mlcp:"⫛",mldr:"…",mnplus:"∓",models:"⊧",Mopf:"𝕄",mopf:"𝕞",mp:"∓",Mscr:"ℳ",mscr:"𝓂",mstpos:"∾",Mu:"Μ",mu:"μ",multimap:"⊸",mumap:"⊸",nabla:"∇",Nacute:"Ń",nacute:"ń",nang:"∠⃒",nap:"≉",napE:"⩰̸",napid:"≋̸",napos:"ʼn",napprox:"≉",natur:"♮",natural:"♮",naturals:"ℕ",nbsp:" ",nbump:"≎̸",nbumpe:"≏̸",ncap:"⩃",Ncaron:"Ň",ncaron:"ň",Ncedil:"Ņ",ncedil:"ņ",ncong:"≇",ncongdot:"⩭̸",ncup:"⩂",Ncy:"Н",ncy:"н",ndash:"–",ne:"≠",nearhk:"⤤",neArr:"⇗",nearr:"↗",nearrow:"↗",nedot:"≐̸",NegativeMediumSpace:"​",NegativeThickSpace:"​",NegativeThinSpace:"​",NegativeVeryThinSpace:"​",nequiv:"≢",nesear:"⤨",nesim:"≂̸",NestedGreaterGreater:"≫",NestedLessLess:"≪",NewLine:"\n",nexist:"∄",nexists:"∄",Nfr:"𝔑",nfr:"𝔫",ngE:"≧̸",nge:"≱",ngeq:"≱",ngeqq:"≧̸",ngeqslant:"⩾̸",nges:"⩾̸",nGg:"⋙̸",ngsim:"≵",nGt:"≫⃒",ngt:"≯",ngtr:"≯",nGtv:"≫̸",nhArr:"⇎",nharr:"↮",nhpar:"⫲",ni:"∋",nis:"⋼",nisd:"⋺",niv:"∋",NJcy:"Њ",njcy:"њ",nlArr:"⇍",nlarr:"↚",nldr:"‥",nlE:"≦̸",nle:"≰",nLeftarrow:"⇍",nleftarrow:"↚",nLeftrightarrow:"⇎",nleftrightarrow:"↮",nleq:"≰",nleqq:"≦̸",nleqslant:"⩽̸",nles:"⩽̸",nless:"≮",nLl:"⋘̸",nlsim:"≴",nLt:"≪⃒",nlt:"≮",nltri:"⋪",nltrie:"⋬",nLtv:"≪̸",nmid:"∤",NoBreak:"⁠",NonBreakingSpace:" ",Nopf:"ℕ",nopf:"𝕟",Not:"⫬",not:"¬",NotCongruent:"≢",NotCupCap:"≭",NotDoubleVerticalBar:"∦",NotElement:"∉",NotEqual:"≠",NotEqualTilde:"≂̸",NotExists:"∄",NotGreater:"≯",NotGreaterEqual:"≱",NotGreaterFullEqual:"≧̸",NotGreaterGreater:"≫̸",NotGreaterLess:"≹",NotGreaterSlantEqual:"⩾̸",NotGreaterTilde:"≵",NotHumpDownHump:"≎̸",NotHumpEqual:"≏̸",notin:"∉",notindot:"⋵̸",notinE:"⋹̸",notinva:"∉",notinvb:"⋷",notinvc:"⋶",NotLeftTriangle:"⋪",NotLeftTriangleBar:"⧏̸",NotLeftTriangleEqual:"⋬",NotLess:"≮",NotLessEqual:"≰",NotLessGreater:"≸",NotLessLess:"≪̸",NotLessSlantEqual:"⩽̸",NotLessTilde:"≴",NotNestedGreaterGreater:"⪢̸",NotNestedLessLess:"⪡̸",notni:"∌",notniva:"∌",notnivb:"⋾",notnivc:"⋽",NotPrecedes:"⊀",NotPrecedesEqual:"⪯̸",NotPrecedesSlantEqual:"⋠",NotReverseElement:"∌",NotRightTriangle:"⋫",NotRightTriangleBar:"⧐̸",NotRightTriangleEqual:"⋭",NotSquareSubset:"⊏̸",NotSquareSubsetEqual:"⋢",NotSquareSuperset:"⊐̸",NotSquareSupersetEqual:"⋣",NotSubset:"⊂⃒",NotSubsetEqual:"⊈",NotSucceeds:"⊁",NotSucceedsEqual:"⪰̸",NotSucceedsSlantEqual:"⋡",NotSucceedsTilde:"≿̸",NotSuperset:"⊃⃒",NotSupersetEqual:"⊉",NotTilde:"≁",NotTildeEqual:"≄",NotTildeFullEqual:"≇",NotTildeTilde:"≉",NotVerticalBar:"∤",npar:"∦",nparallel:"∦",nparsl:"⫽⃥",npart:"∂̸",npolint:"⨔",npr:"⊀",nprcue:"⋠",npre:"⪯̸",nprec:"⊀",npreceq:"⪯̸",nrArr:"⇏",nrarr:"↛",nrarrc:"⤳̸",nrarrw:"↝̸",nRightarrow:"⇏",nrightarrow:"↛",nrtri:"⋫",nrtrie:"⋭",nsc:"⊁",nsccue:"⋡",nsce:"⪰̸",Nscr:"𝒩",nscr:"𝓃",nshortmid:"∤",nshortparallel:"∦",nsim:"≁",nsime:"≄",nsimeq:"≄",nsmid:"∤",nspar:"∦",nsqsube:"⋢",nsqsupe:"⋣",nsub:"⊄",nsubE:"⫅̸",nsube:"⊈",nsubset:"⊂⃒",nsubseteq:"⊈",nsubseteqq:"⫅̸",nsucc:"⊁",nsucceq:"⪰̸",nsup:"⊅",nsupE:"⫆̸",nsupe:"⊉",nsupset:"⊃⃒",nsupseteq:"⊉",nsupseteqq:"⫆̸",ntgl:"≹",Ntilde:"Ñ",ntilde:"ñ",ntlg:"≸",ntriangleleft:"⋪",ntrianglelefteq:"⋬",ntriangleright:"⋫",ntrianglerighteq:"⋭",Nu:"Ν",nu:"ν",num:"#",numero:"№",numsp:" ",nvap:"≍⃒",nVDash:"⊯",nVdash:"⊮",nvDash:"⊭",nvdash:"⊬",nvge:"≥⃒",nvgt:">⃒",nvHarr:"⤄",nvinfin:"⧞",nvlArr:"⤂",nvle:"≤⃒",nvlt:"<⃒",nvltrie:"⊴⃒",nvrArr:"⤃",nvrtrie:"⊵⃒",nvsim:"∼⃒",nwarhk:"⤣",nwArr:"⇖",nwarr:"↖",nwarrow:"↖",nwnear:"⤧",Oacute:"Ó",oacute:"ó",oast:"⊛",ocir:"⊚",Ocirc:"Ô",ocirc:"ô",Ocy:"О",ocy:"о",odash:"⊝",Odblac:"Ő",odblac:"ő",odiv:"⨸",odot:"⊙",odsold:"⦼",OElig:"Œ",oelig:"œ",ofcir:"⦿",Ofr:"𝔒",ofr:"𝔬",ogon:"˛",Ograve:"Ò",ograve:"ò",ogt:"⧁",ohbar:"⦵",ohm:"Ω",oint:"∮",olarr:"↺",olcir:"⦾",olcross:"⦻",oline:"‾",olt:"⧀",Omacr:"Ō",omacr:"ō",Omega:"Ω",omega:"ω",Omicron:"Ο",omicron:"ο",omid:"⦶",ominus:"⊖",Oopf:"𝕆",oopf:"𝕠",opar:"⦷",OpenCurlyDoubleQuote:"“",OpenCurlyQuote:"‘",operp:"⦹",oplus:"⊕",Or:"⩔",or:"∨",orarr:"↻",ord:"⩝",order:"ℴ",orderof:"ℴ",ordf:"ª",ordm:"º",origof:"⊶",oror:"⩖",orslope:"⩗",orv:"⩛",oS:"Ⓢ",Oscr:"𝒪",oscr:"ℴ",Oslash:"Ø",oslash:"ø",osol:"⊘",Otilde:"Õ",otilde:"õ",Otimes:"⨷",otimes:"⊗",otimesas:"⨶",Ouml:"Ö",ouml:"ö",ovbar:"⌽",OverBar:"‾",OverBrace:"⏞",OverBracket:"⎴",OverParenthesis:"⏜",par:"∥",para:"¶",parallel:"∥",parsim:"⫳",parsl:"⫽",part:"∂",PartialD:"∂",Pcy:"П",pcy:"п",percnt:"%",period:".",permil:"‰",perp:"⊥",pertenk:"‱",Pfr:"𝔓",pfr:"𝔭",Phi:"Φ",phi:"φ",phiv:"ϕ",phmmat:"ℳ",phone:"☎",Pi:"Π",pi:"π",pitchfork:"⋔",piv:"ϖ",planck:"ℏ",planckh:"ℎ",plankv:"ℏ",plus:"+",plusacir:"⨣",plusb:"⊞",pluscir:"⨢",plusdo:"∔",plusdu:"⨥",pluse:"⩲",PlusMinus:"±",plusmn:"±",plussim:"⨦",plustwo:"⨧",pm:"±",Poincareplane:"ℌ",pointint:"⨕",Popf:"ℙ",popf:"𝕡",pound:"£",Pr:"⪻",pr:"≺",prap:"⪷",prcue:"≼",prE:"⪳",pre:"⪯",prec:"≺",precapprox:"⪷",preccurlyeq:"≼",Precedes:"≺",PrecedesEqual:"⪯",PrecedesSlantEqual:"≼",PrecedesTilde:"≾",preceq:"⪯",precnapprox:"⪹",precneqq:"⪵",precnsim:"⋨",precsim:"≾",Prime:"″",prime:"′",primes:"ℙ",prnap:"⪹",prnE:"⪵",prnsim:"⋨",prod:"∏",Product:"∏",profalar:"⌮",profline:"⌒",profsurf:"⌓",prop:"∝",Proportion:"∷",Proportional:"∝",propto:"∝",prsim:"≾",prurel:"⊰",Pscr:"𝒫",pscr:"𝓅",Psi:"Ψ",psi:"ψ",puncsp:" ",Qfr:"𝔔",qfr:"𝔮",qint:"⨌",Qopf:"ℚ",qopf:"𝕢",qprime:"⁗",Qscr:"𝒬",qscr:"𝓆",quaternions:"ℍ",quatint:"⨖",quest:"?",questeq:"≟",QUOT:'"',quot:'"',rAarr:"⇛",race:"∽̱",Racute:"Ŕ",racute:"ŕ",radic:"√",raemptyv:"⦳",Rang:"⟫",rang:"⟩",rangd:"⦒",range:"⦥",rangle:"⟩",raquo:"»",Rarr:"↠",rArr:"⇒",rarr:"→",rarrap:"⥵",rarrb:"⇥",rarrbfs:"⤠",rarrc:"⤳",rarrfs:"⤞",rarrhk:"↪",rarrlp:"↬",rarrpl:"⥅",rarrsim:"⥴",Rarrtl:"⤖",rarrtl:"↣",rarrw:"↝",rAtail:"⤜",ratail:"⤚",ratio:"∶",rationals:"ℚ",RBarr:"⤐",rBarr:"⤏",rbarr:"⤍",rbbrk:"❳",rbrace:"}",rbrack:"]",rbrke:"⦌",rbrksld:"⦎",rbrkslu:"⦐",Rcaron:"Ř",rcaron:"ř",Rcedil:"Ŗ",rcedil:"ŗ",rceil:"⌉",rcub:"}",Rcy:"Р",rcy:"р",rdca:"⤷",rdldhar:"⥩",rdquo:"”",rdquor:"”",rdsh:"↳",Re:"ℜ",real:"ℜ",realine:"ℛ",realpart:"ℜ",reals:"ℝ",rect:"▭",REG:"®",reg:"®",ReverseElement:"∋",ReverseEquilibrium:"⇋",ReverseUpEquilibrium:"⥯",rfisht:"⥽",rfloor:"⌋",Rfr:"ℜ",rfr:"𝔯",rHar:"⥤",rhard:"⇁",rharu:"⇀",rharul:"⥬",Rho:"Ρ",rho:"ρ",rhov:"ϱ",RightAngleBracket:"⟩",RightArrow:"→",Rightarrow:"⇒",rightarrow:"→",RightArrowBar:"⇥",RightArrowLeftArrow:"⇄",rightarrowtail:"↣",RightCeiling:"⌉",RightDoubleBracket:"⟧",RightDownTeeVector:"⥝",RightDownVector:"⇂",RightDownVectorBar:"⥕",RightFloor:"⌋",rightharpoondown:"⇁",rightharpoonup:"⇀",rightleftarrows:"⇄",rightleftharpoons:"⇌",rightrightarrows:"⇉",rightsquigarrow:"↝",RightTee:"⊢",RightTeeArrow:"↦",RightTeeVector:"⥛",rightthreetimes:"⋌",RightTriangle:"⊳",RightTriangleBar:"⧐",RightTriangleEqual:"⊵",RightUpDownVector:"⥏",RightUpTeeVector:"⥜",RightUpVector:"↾",RightUpVectorBar:"⥔",RightVector:"⇀",RightVectorBar:"⥓",ring:"˚",risingdotseq:"≓",rlarr:"⇄",rlhar:"⇌",rlm:"‏",rmoust:"⎱",rmoustache:"⎱",rnmid:"⫮",roang:"⟭",roarr:"⇾",robrk:"⟧",ropar:"⦆",Ropf:"ℝ",ropf:"𝕣",roplus:"⨮",rotimes:"⨵",RoundImplies:"⥰",rpar:")",rpargt:"⦔",rppolint:"⨒",rrarr:"⇉",Rrightarrow:"⇛",rsaquo:"›",Rscr:"ℛ",rscr:"𝓇",Rsh:"↱",rsh:"↱",rsqb:"]",rsquo:"’",rsquor:"’",rthree:"⋌",rtimes:"⋊",rtri:"▹",rtrie:"⊵",rtrif:"▸",rtriltri:"⧎",RuleDelayed:"⧴",ruluhar:"⥨",rx:"℞",Sacute:"Ś",sacute:"ś",sbquo:"‚",Sc:"⪼",sc:"≻",scap:"⪸",Scaron:"Š",scaron:"š",sccue:"≽",scE:"⪴",sce:"⪰",Scedil:"Ş",scedil:"ş",Scirc:"Ŝ",scirc:"ŝ",scnap:"⪺",scnE:"⪶",scnsim:"⋩",scpolint:"⨓",scsim:"≿",Scy:"С",scy:"с",sdot:"⋅",sdotb:"⊡",sdote:"⩦",searhk:"⤥",seArr:"⇘",searr:"↘",searrow:"↘",sect:"§",semi:";",seswar:"⤩",setminus:"∖",setmn:"∖",sext:"✶",Sfr:"𝔖",sfr:"𝔰",sfrown:"⌢",sharp:"♯",SHCHcy:"Щ",shchcy:"щ",SHcy:"Ш",shcy:"ш",ShortDownArrow:"↓",ShortLeftArrow:"←",shortmid:"∣",shortparallel:"∥",ShortRightArrow:"→",ShortUpArrow:"↑",shy:"­",Sigma:"Σ",sigma:"σ",sigmaf:"ς",sigmav:"ς",sim:"∼",simdot:"⩪",sime:"≃",simeq:"≃",simg:"⪞",simgE:"⪠",siml:"⪝",simlE:"⪟",simne:"≆",simplus:"⨤",simrarr:"⥲",slarr:"←",SmallCircle:"∘",smallsetminus:"∖",smashp:"⨳",smeparsl:"⧤",smid:"∣",smile:"⌣",smt:"⪪",smte:"⪬",smtes:"⪬︀",SOFTcy:"Ь",softcy:"ь",sol:"/",solb:"⧄",solbar:"⌿",Sopf:"𝕊",sopf:"𝕤",spades:"♠",spadesuit:"♠",spar:"∥",sqcap:"⊓",sqcaps:"⊓︀",sqcup:"⊔",sqcups:"⊔︀",Sqrt:"√",sqsub:"⊏",sqsube:"⊑",sqsubset:"⊏",sqsubseteq:"⊑",sqsup:"⊐",sqsupe:"⊒",sqsupset:"⊐",sqsupseteq:"⊒",squ:"□",Square:"□",square:"□",SquareIntersection:"⊓",SquareSubset:"⊏",SquareSubsetEqual:"⊑",SquareSuperset:"⊐",SquareSupersetEqual:"⊒",SquareUnion:"⊔",squarf:"▪",squf:"▪",srarr:"→",Sscr:"𝒮",sscr:"𝓈",ssetmn:"∖",ssmile:"⌣",sstarf:"⋆",Star:"⋆",star:"☆",starf:"★",straightepsilon:"ϵ",straightphi:"ϕ",strns:"¯",Sub:"⋐",sub:"⊂",subdot:"⪽",subE:"⫅",sube:"⊆",subedot:"⫃",submult:"⫁",subnE:"⫋",subne:"⊊",subplus:"⪿",subrarr:"⥹",Subset:"⋐",subset:"⊂",subseteq:"⊆",subseteqq:"⫅",SubsetEqual:"⊆",subsetneq:"⊊",subsetneqq:"⫋",subsim:"⫇",subsub:"⫕",subsup:"⫓",succ:"≻",succapprox:"⪸",succcurlyeq:"≽",Succeeds:"≻",SucceedsEqual:"⪰",SucceedsSlantEqual:"≽",SucceedsTilde:"≿",succeq:"⪰",succnapprox:"⪺",succneqq:"⪶",succnsim:"⋩",succsim:"≿",SuchThat:"∋",Sum:"∑",sum:"∑",sung:"♪",Sup:"⋑",sup:"⊃",sup1:"¹",sup2:"²",sup3:"³",supdot:"⪾",supdsub:"⫘",supE:"⫆",supe:"⊇",supedot:"⫄",Superset:"⊃",SupersetEqual:"⊇",suphsol:"⟉",suphsub:"⫗",suplarr:"⥻",supmult:"⫂",supnE:"⫌",supne:"⊋",supplus:"⫀",Supset:"⋑",supset:"⊃",supseteq:"⊇",supseteqq:"⫆",supsetneq:"⊋",supsetneqq:"⫌",supsim:"⫈",supsub:"⫔",supsup:"⫖",swarhk:"⤦",swArr:"⇙",swarr:"↙",swarrow:"↙",swnwar:"⤪",szlig:"ß",Tab:" ",target:"⌖",Tau:"Τ",tau:"τ",tbrk:"⎴",Tcaron:"Ť",tcaron:"ť",Tcedil:"Ţ",tcedil:"ţ",Tcy:"Т",tcy:"т",tdot:"⃛",telrec:"⌕",Tfr:"𝔗",tfr:"𝔱",there4:"∴",Therefore:"∴",therefore:"∴",Theta:"Θ",theta:"θ",thetasym:"ϑ",thetav:"ϑ",thickapprox:"≈",thicksim:"∼",ThickSpace:"  ",thinsp:" ",ThinSpace:" ",thkap:"≈",thksim:"∼",THORN:"Þ",thorn:"þ",Tilde:"∼",tilde:"˜",TildeEqual:"≃",TildeFullEqual:"≅",TildeTilde:"≈",times:"×",timesb:"⊠",timesbar:"⨱",timesd:"⨰",tint:"∭",toea:"⤨",top:"⊤",topbot:"⌶",topcir:"⫱",Topf:"𝕋",topf:"𝕥",topfork:"⫚",tosa:"⤩",tprime:"‴",TRADE:"™",trade:"™",triangle:"▵",triangledown:"▿",triangleleft:"◃",trianglelefteq:"⊴",triangleq:"≜",triangleright:"▹",trianglerighteq:"⊵",tridot:"◬",trie:"≜",triminus:"⨺",TripleDot:"⃛",triplus:"⨹",trisb:"⧍",tritime:"⨻",trpezium:"⏢",Tscr:"𝒯",tscr:"𝓉",TScy:"Ц",tscy:"ц",TSHcy:"Ћ",tshcy:"ћ",Tstrok:"Ŧ",tstrok:"ŧ",twixt:"≬",twoheadleftarrow:"↞",twoheadrightarrow:"↠",Uacute:"Ú",uacute:"ú",Uarr:"↟",uArr:"⇑",uarr:"↑",Uarrocir:"⥉",Ubrcy:"Ў",ubrcy:"ў",Ubreve:"Ŭ",ubreve:"ŭ",Ucirc:"Û",ucirc:"û",Ucy:"У",ucy:"у",udarr:"⇅",Udblac:"Ű",udblac:"ű",udhar:"⥮",ufisht:"⥾",Ufr:"𝔘",ufr:"𝔲",Ugrave:"Ù",ugrave:"ù",uHar:"⥣",uharl:"↿",uharr:"↾",uhblk:"▀",ulcorn:"⌜",ulcorner:"⌜",ulcrop:"⌏",ultri:"◸",Umacr:"Ū",umacr:"ū",uml:"¨",UnderBar:"_",UnderBrace:"⏟",UnderBracket:"⎵",UnderParenthesis:"⏝",Union:"⋃",UnionPlus:"⊎",Uogon:"Ų",uogon:"ų",Uopf:"𝕌",uopf:"𝕦",UpArrow:"↑",Uparrow:"⇑",uparrow:"↑",UpArrowBar:"⤒",UpArrowDownArrow:"⇅",UpDownArrow:"↕",Updownarrow:"⇕",updownarrow:"↕",UpEquilibrium:"⥮",upharpoonleft:"↿",upharpoonright:"↾",uplus:"⊎",UpperLeftArrow:"↖",UpperRightArrow:"↗",Upsi:"ϒ",upsi:"υ",upsih:"ϒ",Upsilon:"Υ",upsilon:"υ",UpTee:"⊥",UpTeeArrow:"↥",upuparrows:"⇈",urcorn:"⌝",urcorner:"⌝",urcrop:"⌎",Uring:"Ů",uring:"ů",urtri:"◹",Uscr:"𝒰",uscr:"𝓊",utdot:"⋰",Utilde:"Ũ",utilde:"ũ",utri:"▵",utrif:"▴",uuarr:"⇈",Uuml:"Ü",uuml:"ü",uwangle:"⦧",vangrt:"⦜",varepsilon:"ϵ",varkappa:"ϰ",varnothing:"∅",varphi:"ϕ",varpi:"ϖ",varpropto:"∝",vArr:"⇕",varr:"↕",varrho:"ϱ",varsigma:"ς",varsubsetneq:"⊊︀",varsubsetneqq:"⫋︀",varsupsetneq:"⊋︀",varsupsetneqq:"⫌︀",vartheta:"ϑ",vartriangleleft:"⊲",vartriangleright:"⊳",Vbar:"⫫",vBar:"⫨",vBarv:"⫩",Vcy:"В",vcy:"в",VDash:"⊫",Vdash:"⊩",vDash:"⊨",vdash:"⊢",Vdashl:"⫦",Vee:"⋁",vee:"∨",veebar:"⊻",veeeq:"≚",vellip:"⋮",Verbar:"‖",verbar:"|",Vert:"‖",vert:"|",VerticalBar:"∣",VerticalLine:"|",VerticalSeparator:"❘",VerticalTilde:"≀",VeryThinSpace:" ",Vfr:"𝔙",vfr:"𝔳",vltri:"⊲",vnsub:"⊂⃒",vnsup:"⊃⃒",Vopf:"𝕍",vopf:"𝕧",vprop:"∝",vrtri:"⊳",Vscr:"𝒱",vscr:"𝓋",vsubnE:"⫋︀",vsubne:"⊊︀",vsupnE:"⫌︀",vsupne:"⊋︀",Vvdash:"⊪",vzigzag:"⦚",Wcirc:"Ŵ",wcirc:"ŵ",wedbar:"⩟",Wedge:"⋀",wedge:"∧",wedgeq:"≙",weierp:"℘",Wfr:"𝔚",wfr:"𝔴",Wopf:"𝕎",wopf:"𝕨",wp:"℘",wr:"≀",wreath:"≀",Wscr:"𝒲",wscr:"𝓌",xcap:"⋂",xcirc:"◯",xcup:"⋃",xdtri:"▽",Xfr:"𝔛",xfr:"𝔵",xhArr:"⟺",xharr:"⟷",Xi:"Ξ",xi:"ξ",xlArr:"⟸",xlarr:"⟵",xmap:"⟼",xnis:"⋻",xodot:"⨀",Xopf:"𝕏",xopf:"𝕩",xoplus:"⨁",xotime:"⨂",xrArr:"⟹",xrarr:"⟶",Xscr:"𝒳",xscr:"𝓍",xsqcup:"⨆",xuplus:"⨄",xutri:"△",xvee:"⋁",xwedge:"⋀",Yacute:"Ý",yacute:"ý",YAcy:"Я",yacy:"я",Ycirc:"Ŷ",ycirc:"ŷ",Ycy:"Ы",ycy:"ы",yen:"¥",Yfr:"𝔜",yfr:"𝔶",YIcy:"Ї",yicy:"ї",Yopf:"𝕐",yopf:"𝕪",Yscr:"𝒴",yscr:"𝓎",YUcy:"Ю",yucy:"ю",Yuml:"Ÿ",yuml:"ÿ",Zacute:"Ź",zacute:"ź",Zcaron:"Ž",zcaron:"ž",Zcy:"З",zcy:"з",Zdot:"Ż",zdot:"ż",zeetrf:"ℨ",ZeroWidthSpace:"​",Zeta:"Ζ",zeta:"ζ",Zfr:"ℨ",zfr:"𝔷",ZHcy:"Ж",zhcy:"ж",zigrarr:"⇝",Zopf:"ℤ",zopf:"𝕫",Zscr:"𝒵",zscr:"𝓏",zwj:"‍",zwnj:"‌"}},{}],2:[function(e,t){"use strict";var r={};["article","aside","button","blockquote","body","canvas","caption","col","colgroup","dd","div","dl","dt","embed","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hgroup","hr","iframe","li","map","object","ol","output","p","pre","progress","script","section","style","table","tbody","td","textarea","tfoot","th","tr","thead","ul","video"].forEach(function(e){r[e]=!0}),t.exports=r},{}],3:[function(e,t){"use strict";function r(e,t){return e=e.source,t=t||"",function r(n,s){return n?(s=s.source||s,e=e.replace(n,s),r):new RegExp(e,t)}}var n=/[a-zA-Z_:][a-zA-Z0-9:._-]*/,s=/[^"'=<>`\x00-\x20]+/,o=/'[^']*'/,i=/"[^"]*"/,l=r(/(?:unquoted|single_quoted|double_quoted)/)("unquoted",s)("single_quoted",o)("double_quoted",i)(),a=r(/(?:\s+attr_name(?:\s*=\s*attr_value)?)/)("attr_name",n)("attr_value",l)(),c=r(/<[A-Za-z][A-Za-z0-9]*attribute*\s*\/?>/)("attribute",a)(),u=/<\/[A-Za-z][A-Za-z0-9]*\s*>/,p=/<!--([^-]+|[-][^-]+)*-->/,h=/<[?].*?[?]>/,f=/<![A-Z]+\s+[^>]*>/,d=/<!\[CDATA\[([^\]]+|\][^\]]|\]\][^>])*\]\]>/,g=r(/^(?:open_tag|close_tag|comment|processing|declaration|cdata)/)("open_tag",c)("close_tag",u)("comment",p)("processing",h)("declaration",f)("cdata",d)();t.exports.HTML_TAG_RE=g},{}],4:[function(e,t){"use strict";t.exports=["coap","doi","javascript","aaa","aaas","about","acap","cap","cid","crid","data","dav","dict","dns","file","ftp","geo","go","gopher","h323","http","https","iax","icap","im","imap","info","ipp","iris","iris.beep","iris.xpc","iris.xpcs","iris.lwz","ldap","mailto","mid","msrp","msrps","mtqp","mupdate","news","nfs","ni","nih","nntp","opaquelocktoken","pop","pres","rtsp","service","session","shttp","sieve","sip","sips","sms","snmp","soap.beep","soap.beeps","tag","tel","telnet","tftp","thismessage","tn3270","tip","tv","urn","vemmi","ws","wss","xcon","xcon-userid","xmlrpc.beep","xmlrpc.beeps","xmpp","z39.50r","z39.50s","adiumxtra","afp","afs","aim","apt","attachment","aw","beshare","bitcoin","bolo","callto","chrome","chrome-extension","com-eventbrite-attendee","content","cvs","dlna-playsingle","dlna-playcontainer","dtn","dvb","ed2k","facetime","feed","finger","fish","gg","git","gizmoproject","gtalk","hcp","icon","ipn","irc","irc6","ircs","itms","jar","jms","keyparc","lastfm","ldaps","magnet","maps","market","message","mms","ms-help","msnim","mumble","mvn","notes","oid","palm","paparazzi","platform","proxy","psyc","query","res","resource","rmi","rsync","rtmp","secondlife","sftp","sgn","skype","smb","soldat","spotify","ssh","steam","svn","teamspeak","things","udp","unreal","ut2004","ventrilo","view-source","webcal","wtai","wyciwyg","xfire","xri","ymsgr"]},{}],5:[function(e,t,r){"use strict";function n(e){return Object.prototype.toString.call(e)}function s(e){return"[object String]"===n(e)}function o(e,t){return e?d.call(e,t):!1}function i(e){var t=[].slice.call(arguments,1);return t.forEach(function(t){if(t){if("object"!=typeof t)throw new TypeError(t+"must be object");Object.keys(t).forEach(function(r){e[r]=t[r]})}}),e}function l(e){return e.indexOf("\\")<0?e:e.replace(g,"$1")}function a(e){return e>=55296&&57343>=e?!1:e>=64976&&65007>=e?!1:65535===(65535&e)||65534===(65535&e)?!1:e>=0&&8>=e?!1:11===e?!1:e>=14&&31>=e?!1:e>=127&&159>=e?!1:e>1114111?!1:!0}function c(e){if(e>65535){e-=65536;var t=55296+(e>>10),r=56320+(1023&e);return String.fromCharCode(t,r)}return String.fromCharCode(e)}function u(e,t){var r=0;return o(v,t)?v[t]:35===t.charCodeAt(0)&&b.test(t)&&(r="x"===t[1].toLowerCase()?parseInt(t.slice(2),16):parseInt(t.slice(1),10),a(r))?c(r):e}function p(e){return e.indexOf("&")<0?e:e.replace(m,u)}function h(e){return y[e]}function f(e){return k.test(e)?e.replace(_,h):e}var d=Object.prototype.hasOwnProperty,g=/\\([\\!"#$%&'()*+,.\/:;<=>?@[\]^_`{|}~-])/g,m=/&([a-z#][a-z0-9]{1,31});/gi,b=/^#((?:x[a-f0-9]{1,8}|[0-9]{1,8}))/i,v=e("./entities"),k=/[&<>"]/,_=/[&<>"]/g,y={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;"};r.assign=i,r.isString=s,r.has=o,r.unescapeMd=l,r.isValidEntityCode=a,r.fromCodePoint=c,r.replaceEntities=p,r.escapeHtml=f},{"./entities":1}],6:[function(e,t){"use strict";t.exports={options:{html:!0,xhtmlOut:!0,breaks:!1,langPrefix:"language-",linkify:!1,linkTarget:"",typographer:!1,quotes:"“”‘’",highlight:null,maxNesting:20},components:{core:{rules:["block","inline","references","abbr2"]},block:{rules:["blockquote","code","fences","heading","hr","htmlblock","lheading","list","paragraph"]},inline:{rules:["autolink","backticks","emphasis","entity","escape","htmltag","links","newline","text"]}}}},{}],7:[function(e,t){"use strict";t.exports={options:{html:!1,xhtmlOut:!1,breaks:!1,langPrefix:"language-",linkify:!1,linkTarget:"",typographer:!1,quotes:"“”‘’",highlight:null,maxNesting:20},components:{core:{rules:["block","inline","references","replacements","linkify","smartquotes","references","abbr2","footnote_tail"]},block:{rules:["blockquote","code","fences","footnote","heading","hr","htmlblock","lheading","list","paragraph","table"]},inline:{rules:["autolink","backticks","del","emphasis","entity","escape","footnote_ref","htmltag","links","newline","text"]}}}},{}],8:[function(e,t){"use strict";t.exports={options:{html:!1,xhtmlOut:!1,breaks:!1,langPrefix:"language-",linkify:!1,linkTarget:"",typographer:!1,quotes:"“”‘’",highlight:null,maxNesting:20},components:{core:{},block:{},inline:{}}}},{}],9:[function(e,t){"use strict";var r=e("../common/utils").replaceEntities;t.exports=function(e){var t=r(e);try{t=decodeURI(t)}catch(n){}return encodeURI(t)}},{"../common/utils":5}],10:[function(e,t){"use strict";t.exports=function(e){return e.trim().replace(/\s+/g," ").toUpperCase()}},{}],11:[function(e,t){"use strict";var r=e("./normalize_link"),n=e("../common/utils").unescapeMd;t.exports=function(e,t){var s,o,i,l=t,a=e.posMax;if(60===e.src.charCodeAt(t)){for(t++;a>t;){if(s=e.src.charCodeAt(t),10===s)return!1;if(62===s)return i=r(n(e.src.slice(l+1,t))),e.parser.validateLink(i)?(e.pos=t+1,e.linkContent=i,!0):!1;92===s&&a>t+1?t+=2:t++}return!1}for(o=0;a>t&&(s=e.src.charCodeAt(t),32!==s)&&!(s>8&&14>s);)if(92===s&&a>t+1)t+=2;else{if(40===s&&(o++,o>1))break;if(41===s&&(o--,0>o))break;t++}return l===t?!1:(i=n(e.src.slice(l,t)),e.parser.validateLink(i)?(e.linkContent=i,e.pos=t,!0):!1)}},{"../common/utils":5,"./normalize_link":9}],12:[function(e,t){"use strict";t.exports=function(e,t){
3 -var r,n,s,o=-1,i=e.posMax,l=e.pos,a=e.isInLabel;if(e.isInLabel)return-1;if(e.labelUnmatchedScopes)return e.labelUnmatchedScopes--,-1;for(e.pos=t+1,e.isInLabel=!0,r=1;e.pos<i;){if(s=e.src.charCodeAt(e.pos),91===s)r++;else if(93===s&&(r--,0===r)){n=!0;break}e.parser.skipToken(e)}return n?(o=e.pos,e.labelUnmatchedScopes=0):e.labelUnmatchedScopes=r-1,e.pos=l,e.isInLabel=a,o}},{}],13:[function(e,t){"use strict";var r=e("../common/utils").unescapeMd;t.exports=function(e,t){var n,s=t,o=e.posMax,i=e.src.charCodeAt(t);if(34!==i&&39!==i&&40!==i)return!1;for(t++,40===i&&(i=41);o>t;){if(n=e.src.charCodeAt(t),n===i)return e.pos=t+1,e.linkContent=r(e.src.slice(s+1,t)),!0;92===n&&o>t+1?t+=2:t++}return!1}},{"../common/utils":5}],14:[function(e,t){"use strict";function r(e,t,r){this.src=t,this.env=r,this.options=e.options,this.tokens=[],this.inlineMode=!1,this.inline=e.inline,this.block=e.block,this.renderer=e.renderer,this.typographer=e.typographer}function n(e,t){"string"!=typeof e&&(t=e,e="default"),this.inline=new a,this.block=new l,this.core=new i,this.renderer=new o,this.ruler=new c,this.options={},this.configure(u[e]),this.set(t||{})}var s=e("./common/utils").assign,o=e("./renderer"),i=e("./parser_core"),l=e("./parser_block"),a=e("./parser_inline"),c=e("./ruler"),u={"default":e("./configs/default"),full:e("./configs/full"),commonmark:e("./configs/commonmark")};n.prototype.set=function(e){s(this.options,e)},n.prototype.configure=function(e){var t=this;if(!e)throw new Error("Wrong `remarkable` preset, check name/content");e.options&&t.set(e.options),e.components&&Object.keys(e.components).forEach(function(r){e.components[r].rules&&t[r].ruler.enable(e.components[r].rules,!0)})},n.prototype.use=function(e,t){return e(this,t),this},n.prototype.parse=function(e,t){var n=new r(this,e,t);return this.core.process(n),n.tokens},n.prototype.render=function(e,t){return t=t||{},this.renderer.render(this.parse(e,t),this.options,t)},n.prototype.parseInline=function(e,t){var n=new r(this,e,t);return n.inlineMode=!0,this.core.process(n),n.tokens},n.prototype.renderInline=function(e,t){return t=t||{},this.renderer.render(this.parseInline(e,t),this.options,t)},t.exports=n,t.exports.utils=e("./common/utils")},{"./common/utils":5,"./configs/commonmark":6,"./configs/default":7,"./configs/full":8,"./parser_block":15,"./parser_core":16,"./parser_inline":17,"./renderer":18,"./ruler":19}],15:[function(e,t){"use strict";function r(){this.ruler=new n;for(var e=0;e<o.length;e++)this.ruler.push(o[e][0],o[e][1],{alt:(o[e][2]||[]).slice()})}var n=e("./ruler"),s=e("./rules_block/state_block"),o=[["code",e("./rules_block/code")],["fences",e("./rules_block/fences"),["paragraph","blockquote","list"]],["blockquote",e("./rules_block/blockquote"),["paragraph","blockquote","list"]],["hr",e("./rules_block/hr"),["paragraph","blockquote","list"]],["list",e("./rules_block/list"),["paragraph","blockquote"]],["footnote",e("./rules_block/footnote"),["paragraph"]],["heading",e("./rules_block/heading"),["paragraph","blockquote"]],["lheading",e("./rules_block/lheading")],["htmlblock",e("./rules_block/htmlblock"),["paragraph","blockquote"]],["table",e("./rules_block/table"),["paragraph"]],["deflist",e("./rules_block/deflist"),["paragraph"]],["paragraph",e("./rules_block/paragraph")]];r.prototype.tokenize=function(e,t,r){for(var n,s,o=this.ruler.getRules(""),i=o.length,l=t,a=!1;r>l&&(e.line=l=e.skipEmptyLines(l),!(l>=r))&&!(e.tShift[l]<e.blkIndent);){for(s=0;i>s&&!(n=o[s](e,l,r,!1));s++);if(e.tight=!a,e.isEmpty(e.line-1)&&(a=!0),l=e.line,r>l&&e.isEmpty(l)){if(a=!0,l++,r>l&&"list"===e.parentType&&e.isEmpty(l))break;e.line=l}}};var i=/[\n\t]/g,l=/\r[\n\u0085]|[\u2424\u2028\u0085]/g,a=/\u00a0/g;r.prototype.parse=function(e,t,r,n){var o,c=0,u=0;return e?(e=e.replace(a," "),e=e.replace(l,"\n"),e.indexOf(" ")>=0&&(e=e.replace(i,function(t,r){var n;return 10===e.charCodeAt(r)?(c=r+1,u=0,t):(n=" ".slice((r-c-u)%4),u=r-c+1,n)})),o=new s(e,this,t,r,n),void this.tokenize(o,o.line,o.lineMax)):[]},t.exports=r},{"./ruler":19,"./rules_block/blockquote":21,"./rules_block/code":22,"./rules_block/deflist":23,"./rules_block/fences":24,"./rules_block/footnote":25,"./rules_block/heading":26,"./rules_block/hr":27,"./rules_block/htmlblock":28,"./rules_block/lheading":29,"./rules_block/list":30,"./rules_block/paragraph":31,"./rules_block/state_block":32,"./rules_block/table":33}],16:[function(e,t){"use strict";function r(){this.options={},this.ruler=new n;for(var e=0;e<s.length;e++)this.ruler.push(s[e][0],s[e][1])}var n=e("./ruler"),s=[["block",e("./rules_core/block")],["abbr",e("./rules_core/abbr")],["references",e("./rules_core/references")],["inline",e("./rules_core/inline")],["footnote_tail",e("./rules_core/footnote_tail")],["abbr2",e("./rules_core/abbr2")],["replacements",e("./rules_core/replacements")],["smartquotes",e("./rules_core/smartquotes")],["linkify",e("./rules_core/linkify")]];r.prototype.process=function(e){var t,r,n;for(n=this.ruler.getRules(""),t=0,r=n.length;r>t;t++)n[t](e)},t.exports=r},{"./ruler":19,"./rules_core/abbr":34,"./rules_core/abbr2":35,"./rules_core/block":36,"./rules_core/footnote_tail":37,"./rules_core/inline":38,"./rules_core/linkify":39,"./rules_core/references":40,"./rules_core/replacements":41,"./rules_core/smartquotes":42}],17:[function(e,t){"use strict";function r(){this.ruler=new s;for(var e=0;e<l.length;e++)this.ruler.push(l[e][0],l[e][1]);this.validateLink=n}function n(e){var t=["vbscript","javascript","file","data"],r=e.trim().toLowerCase();return r=i.replaceEntities(r),-1!==r.indexOf(":")&&-1!==t.indexOf(r.split(":")[0])?!1:!0}var s=e("./ruler"),o=e("./rules_inline/state_inline"),i=e("./common/utils"),l=[["text",e("./rules_inline/text")],["newline",e("./rules_inline/newline")],["escape",e("./rules_inline/escape")],["backticks",e("./rules_inline/backticks")],["del",e("./rules_inline/del")],["ins",e("./rules_inline/ins")],["mark",e("./rules_inline/mark")],["emphasis",e("./rules_inline/emphasis")],["sub",e("./rules_inline/sub")],["sup",e("./rules_inline/sup")],["links",e("./rules_inline/links")],["footnote_inline",e("./rules_inline/footnote_inline")],["footnote_ref",e("./rules_inline/footnote_ref")],["autolink",e("./rules_inline/autolink")],["htmltag",e("./rules_inline/htmltag")],["entity",e("./rules_inline/entity")]];r.prototype.skipToken=function(e){var t,r,n=this.ruler.getRules(""),s=n.length,o=e.pos;if((r=e.cacheGet(o))>0)return void(e.pos=r);for(t=0;s>t;t++)if(n[t](e,!0))return void e.cacheSet(o,e.pos);e.pos++,e.cacheSet(o,e.pos)},r.prototype.tokenize=function(e){for(var t,r,n=this.ruler.getRules(""),s=n.length,o=e.posMax;e.pos<o;){for(r=0;s>r&&!(t=n[r](e,!1));r++);if(t){if(e.pos>=o)break}else e.pending+=e.src[e.pos++]}e.pending&&e.pushPending()},r.prototype.parse=function(e,t,r,n){var s=new o(e,this,t,r,n);this.tokenize(s)},t.exports=r},{"./common/utils":5,"./ruler":19,"./rules_inline/autolink":43,"./rules_inline/backticks":44,"./rules_inline/del":45,"./rules_inline/emphasis":46,"./rules_inline/entity":47,"./rules_inline/escape":48,"./rules_inline/footnote_inline":49,"./rules_inline/footnote_ref":50,"./rules_inline/htmltag":51,"./rules_inline/ins":52,"./rules_inline/links":53,"./rules_inline/mark":54,"./rules_inline/newline":55,"./rules_inline/state_inline":56,"./rules_inline/sub":57,"./rules_inline/sup":58,"./rules_inline/text":59}],18:[function(e,t){"use strict";function r(){this.rules=n.assign({},s),this.getBreak=s.getBreak}var n=e("./common/utils"),s=e("./rules");t.exports=r,r.prototype.renderInline=function(e,t,r){for(var n=this.rules,s=e.length,o=0,i="";s--;)i+=n[e[o].type](e,o++,t,r,this);return i},r.prototype.render=function(e,t,r){for(var n=this.rules,s=e.length,o=-1,i="";++o<s;)i+="inline"===e[o].type?this.renderInline(e[o].children,t,r):n[e[o].type](e,o,t,r,this);return i}},{"./common/utils":5,"./rules":20}],19:[function(e,t){"use strict";function r(){this.__rules__=[],this.__cache__=null}r.prototype.__find__=function(e){for(var t=this.__rules__.length,r=-1;t--;)if(this.__rules__[++r].name===e)return r;return-1},r.prototype.__compile__=function(){var e=this,t=[""];e.__rules__.forEach(function(e){e.enabled&&e.alt.forEach(function(e){t.indexOf(e)<0&&t.push(e)})}),e.__cache__={},t.forEach(function(t){e.__cache__[t]=[],e.__rules__.forEach(function(r){r.enabled&&(t&&r.alt.indexOf(t)<0||e.__cache__[t].push(r.fn))})})},r.prototype.at=function(e,t,r){var n=this.__find__(e),s=r||{};if(-1===n)throw new Error("Parser rule not found: "+e);this.__rules__[n].fn=t,this.__rules__[n].alt=s.alt||[],this.__cache__=null},r.prototype.before=function(e,t,r,n){var s=this.__find__(e),o=n||{};if(-1===s)throw new Error("Parser rule not found: "+e);this.__rules__.splice(s,0,{name:t,enabled:!0,fn:r,alt:o.alt||[]}),this.__cache__=null},r.prototype.after=function(e,t,r,n){var s=this.__find__(e),o=n||{};if(-1===s)throw new Error("Parser rule not found: "+e);this.__rules__.splice(s+1,0,{name:t,enabled:!0,fn:r,alt:o.alt||[]}),this.__cache__=null},r.prototype.push=function(e,t,r){var n=r||{};this.__rules__.push({name:e,enabled:!0,fn:t,alt:n.alt||[]}),this.__cache__=null},r.prototype.enable=function(e,t){e=Array.isArray(e)?e:[e],t&&this.__rules__.forEach(function(e){e.enabled=!1}),e.forEach(function(e){var t=this.__find__(e);if(0>t)throw new Error("Rules manager: invalid rule name "+e);this.__rules__[t].enabled=!0},this),this.__cache__=null},r.prototype.disable=function(e){e=Array.isArray(e)?e:[e],e.forEach(function(e){var t=this.__find__(e);if(0>t)throw new Error("Rules manager: invalid rule name "+e);this.__rules__[t].enabled=!1},this),this.__cache__=null},r.prototype.getRules=function(e){return null===this.__cache__&&this.__compile__(),this.__cache__[e]||[]},t.exports=r},{}],20:[function(e,t){"use strict";function r(e,t){return++t>=e.length-2?t:"paragraph_open"===e[t].type&&e[t].tight&&"inline"===e[t+1].type&&0===e[t+1].content.length&&"paragraph_close"===e[t+2].type&&e[t+2].tight?r(e,t+2):t}var n=e("./common/utils").has,s=e("./common/utils").unescapeMd,o=e("./common/utils").replaceEntities,i=e("./common/utils").escapeHtml,l={};l.blockquote_open=function(){return"<blockquote>\n"},l.blockquote_close=function(e,t){return"</blockquote>"+a(e,t)},l.code=function(e,t){return e[t].block?"<pre><code>"+i(e[t].content)+"</code></pre>"+a(e,t):"<code>"+i(e[t].content)+"</code>"},l.fence=function(e,t,r,l,c){var u,p,h,f=e[t],d="",g=r.langPrefix,m="";if(f.params){if(u=f.params.split(/\s+/g),p=u.join(" "),n(c.rules.fence_custom,u[0]))return c.rules.fence_custom[u[0]](e,t,r,l,c);m=i(o(s(p))),d=' class="'+g+m+'"'}return h=r.highlight?r.highlight.apply(r.highlight,[f.content].concat(u))||i(f.content):i(f.content),"<pre><code"+d+">"+h+"</code></pre>"+a(e,t)},l.fence_custom={},l.heading_open=function(e,t){return"<h"+e[t].hLevel+">"},l.heading_close=function(e,t){return"</h"+e[t].hLevel+">\n"},l.hr=function(e,t,r){return(r.xhtmlOut?"<hr />":"<hr>")+a(e,t)},l.bullet_list_open=function(){return"<ul>\n"},l.bullet_list_close=function(e,t){return"</ul>"+a(e,t)},l.list_item_open=function(){return"<li>"},l.list_item_close=function(){return"</li>\n"},l.ordered_list_open=function(e,t){var r=e[t],n=r.order>1?' start="'+r.order+'"':"";return"<ol"+n+">\n"},l.ordered_list_close=function(e,t){return"</ol>"+a(e,t)},l.paragraph_open=function(e,t){return e[t].tight?"":"<p>"},l.paragraph_close=function(e,t){var r=!(e[t].tight&&t&&"inline"===e[t-1].type&&!e[t-1].content);return(e[t].tight?"":"</p>")+(r?a(e,t):"")},l.link_open=function(e,t,r){var n=e[t].title?' title="'+i(o(e[t].title))+'"':"",s=r.linkTarget?' target="'+r.linkTarget+'"':"";return'<a href="'+i(e[t].href)+'"'+n+s+">"},l.link_close=function(){return"</a>"},l.image=function(e,t,r){var n=' src="'+i(e[t].src)+'"',l=e[t].title?' title="'+i(o(e[t].title))+'"':"",a=' alt="'+(e[t].alt?i(o(s(e[t].alt))):"")+'"',c=r.xhtmlOut?" /":"";return"<img"+n+a+l+c+">"},l.table_open=function(){return"<table>\n"},l.table_close=function(){return"</table>\n"},l.thead_open=function(){return"<thead>\n"},l.thead_close=function(){return"</thead>\n"},l.tbody_open=function(){return"<tbody>\n"},l.tbody_close=function(){return"</tbody>\n"},l.tr_open=function(){return"<tr>"},l.tr_close=function(){return"</tr>\n"},l.th_open=function(e,t){var r=e[t];return"<th"+(r.align?' style="text-align:'+r.align+'"':"")+">"},l.th_close=function(){return"</th>"},l.td_open=function(e,t){var r=e[t];return"<td"+(r.align?' style="text-align:'+r.align+'"':"")+">"},l.td_close=function(){return"</td>"},l.strong_open=function(){return"<strong>"},l.strong_close=function(){return"</strong>"},l.em_open=function(){return"<em>"},l.em_close=function(){return"</em>"},l.del_open=function(){return"<del>"},l.del_close=function(){return"</del>"},l.ins_open=function(){return"<ins>"},l.ins_close=function(){return"</ins>"},l.mark_open=function(){return"<mark>"},l.mark_close=function(){return"</mark>"},l.sub=function(e,t){return"<sub>"+i(e[t].content)+"</sub>"},l.sup=function(e,t){return"<sup>"+i(e[t].content)+"</sup>"},l.hardbreak=function(e,t,r){return r.xhtmlOut?"<br />\n":"<br>\n"},l.softbreak=function(e,t,r){return r.breaks?r.xhtmlOut?"<br />\n":"<br>\n":"\n"},l.text=function(e,t){return i(e[t].content)},l.htmlblock=function(e,t){return e[t].content},l.htmltag=function(e,t){return e[t].content},l.abbr_open=function(e,t){return'<abbr title="'+i(o(e[t].title))+'">'},l.abbr_close=function(){return"</abbr>"},l.footnote_ref=function(e,t){var r=Number(e[t].id+1).toString(),n="fnref"+r;return e[t].subId>0&&(n+=":"+e[t].subId),'<sup class="footnote-ref"><a href="#fn'+r+'" id="'+n+'">['+r+"]</a></sup>"},l.footnote_block_open=function(e,t,r){var n=r.xhtmlOut?'<hr class="footnotes-sep" />\n':'<hr class="footnotes-sep">\n';return n+'<section class="footnotes">\n<ol class="footnotes-list">\n'},l.footnote_block_close=function(){return"</ol>\n</section>\n"},l.footnote_open=function(e,t){var r=Number(e[t].id+1).toString();return'<li id="fn'+r+'" class="footnote-item">'},l.footnote_close=function(){return"</li>\n"},l.footnote_anchor=function(e,t){var r=Number(e[t].id+1).toString(),n="fnref"+r;return e[t].subId>0&&(n+=":"+e[t].subId),' <a href="#'+n+'" class="footnote-backref">↩</a>'},l.dl_open=function(){return"<dl>\n"},l.dt_open=function(){return"<dt>"},l.dd_open=function(){return"<dd>"},l.dl_close=function(){return"</dl>\n"},l.dt_close=function(){return"</dt>\n"},l.dd_close=function(){return"</dd>\n"};var a=l.getBreak=function(e,t){return t=r(e,t),t<e.length&&"list_item_close"===e[t].type?"":"\n"};t.exports=l},{"./common/utils":5}],21:[function(e,t){"use strict";t.exports=function(e,t,r,n){var s,o,i,l,a,c,u,p,h,f,d,g=e.bMarks[t]+e.tShift[t],m=e.eMarks[t];if(g>m)return!1;if(62!==e.src.charCodeAt(g++))return!1;if(e.level>=e.options.maxNesting)return!1;if(n)return!0;for(32===e.src.charCodeAt(g)&&g++,a=e.blkIndent,e.blkIndent=0,l=[e.bMarks[t]],e.bMarks[t]=g,g=m>g?e.skipSpaces(g):g,o=g>=m,i=[e.tShift[t]],e.tShift[t]=g-e.bMarks[t],p=e.parser.ruler.getRules("blockquote"),s=t+1;r>s&&(g=e.bMarks[s]+e.tShift[s],m=e.eMarks[s],!(g>=m));s++)if(62!==e.src.charCodeAt(g++)){if(o)break;for(d=!1,h=0,f=p.length;f>h;h++)if(p[h](e,s,r,!0)){d=!0;break}if(d)break;l.push(e.bMarks[s]),i.push(e.tShift[s]),e.tShift[s]=-1337}else 32===e.src.charCodeAt(g)&&g++,l.push(e.bMarks[s]),e.bMarks[s]=g,g=m>g?e.skipSpaces(g):g,o=g>=m,i.push(e.tShift[s]),e.tShift[s]=g-e.bMarks[s];for(c=e.parentType,e.parentType="blockquote",e.tokens.push({type:"blockquote_open",lines:u=[t,0],level:e.level++}),e.parser.tokenize(e,t,s),e.tokens.push({type:"blockquote_close",level:--e.level}),e.parentType=c,u[1]=e.line,h=0;h<i.length;h++)e.bMarks[h+t]=l[h],e.tShift[h+t]=i[h];return e.blkIndent=a,!0}},{}],22:[function(e,t){"use strict";t.exports=function(e,t,r){var n,s;if(e.tShift[t]-e.blkIndent<4)return!1;for(s=n=t+1;r>n;)if(e.isEmpty(n))n++;else{if(!(e.tShift[n]-e.blkIndent>=4))break;n++,s=n}return e.line=n,e.tokens.push({type:"code",content:e.getLines(t,s,4+e.blkIndent,!0),block:!0,lines:[t,e.line],level:e.level}),!0}},{}],23:[function(e,t){"use strict";function r(e,t){var r,n,s=e.bMarks[t]+e.tShift[t],o=e.eMarks[t];return s>=o?-1:(n=e.src.charCodeAt(s++),126!==n&&58!==n?-1:(r=e.skipSpaces(s),s===r?-1:r>=o?-1:r))}function n(e,t){var r,n,s=e.level+2;for(r=t+2,n=e.tokens.length-2;n>r;r++)e.tokens[r].level===s&&"paragraph_open"===e.tokens[r].type&&(e.tokens[r+2].tight=!0,e.tokens[r].tight=!0,r+=2)}t.exports=function(e,t,s,o){var i,l,a,c,u,p,h,f,d,g,m,b,v,k;if(o)return e.ddIndent<0?!1:r(e,t)>=0;if(h=t+1,e.isEmpty(h)&&++h>s)return!1;if(e.tShift[h]<e.blkIndent)return!1;if(i=r(e,h),0>i)return!1;if(e.level>=e.options.maxNesting)return!1;p=e.tokens.length,e.tokens.push({type:"dl_open",lines:u=[t,0],level:e.level++}),a=t,l=h;e:for(;;){for(k=!0,v=!1,e.tokens.push({type:"dt_open",lines:[a,a],level:e.level++}),e.tokens.push({type:"inline",content:e.getLines(a,a+1,e.blkIndent,!1).trim(),level:e.level+1,lines:[a,a],children:[]}),e.tokens.push({type:"dt_close",level:--e.level});;){if(e.tokens.push({type:"dd_open",lines:c=[h,0],level:e.level++}),b=e.tight,d=e.ddIndent,f=e.blkIndent,m=e.tShift[l],g=e.parentType,e.blkIndent=e.ddIndent=e.tShift[l]+2,e.tShift[l]=i-e.bMarks[l],e.tight=!0,e.parentType="deflist",e.parser.tokenize(e,l,s,!0),(!e.tight||v)&&(k=!1),v=e.line-l>1&&e.isEmpty(e.line-1),e.tShift[l]=m,e.tight=b,e.parentType=g,e.blkIndent=f,e.ddIndent=d,e.tokens.push({type:"dd_close",level:--e.level}),c[1]=h=e.line,h>=s)break e;if(e.tShift[h]<e.blkIndent)break e;if(i=r(e,h),0>i)break;l=h}if(h>=s)break;if(a=h,e.isEmpty(a))break;if(e.tShift[a]<e.blkIndent)break;if(l=a+1,l>=s)break;if(e.isEmpty(l)&&l++,l>=s)break;if(e.tShift[l]<e.blkIndent)break;if(i=r(e,l),0>i)break}return e.tokens.push({type:"dl_close",level:--e.level}),u[1]=h,e.line=h,k&&n(e,p),!0}},{}],24:[function(e,t){"use strict";t.exports=function(e,t,r,n){var s,o,i,l,a,c=!1,u=e.bMarks[t]+e.tShift[t],p=e.eMarks[t];if(u+3>p)return!1;if(s=e.src.charCodeAt(u),126!==s&&96!==s)return!1;if(a=u,u=e.skipChars(u,s),o=u-a,3>o)return!1;if(i=e.src.slice(u,p).trim(),i.indexOf("`")>=0)return!1;if(n)return!0;for(l=t;(l++,!(l>=r))&&(u=a=e.bMarks[l]+e.tShift[l],p=e.eMarks[l],!(p>u&&e.tShift[l]<e.blkIndent));)if(e.src.charCodeAt(u)===s&&!(e.tShift[l]-e.blkIndent>=4||(u=e.skipChars(u,s),o>u-a||(u=e.skipSpaces(u),p>u)))){c=!0;break}return o=e.tShift[t],e.line=l+(c?1:0),e.tokens.push({type:"fence",params:i,content:e.getLines(t+1,l,o,!0),lines:[t,e.line],level:e.level}),!0}},{}],25:[function(e,t){"use strict";t.exports=function(e,t,r,n){var s,o,i,l,a,c=e.bMarks[t]+e.tShift[t],u=e.eMarks[t];if(c+4>u)return!1;if(91!==e.src.charCodeAt(c))return!1;if(94!==e.src.charCodeAt(c+1))return!1;if(e.level>=e.options.maxNesting)return!1;for(l=c+2;u>l;l++){if(32===e.src.charCodeAt(l))return!1;if(93===e.src.charCodeAt(l))break}return l===c+2?!1:l+1>=u||58!==e.src.charCodeAt(++l)?!1:n?!0:(l++,e.env.footnotes||(e.env.footnotes={}),e.env.footnotes.refs||(e.env.footnotes.refs={}),a=e.src.slice(c+2,l-2),e.env.footnotes.refs[":"+a]=-1,e.tokens.push({type:"footnote_reference_open",label:a,level:e.level++}),s=e.bMarks[t],o=e.tShift[t],i=e.parentType,e.tShift[t]=e.skipSpaces(l)-l,e.bMarks[t]=l,e.blkIndent+=4,e.parentType="footnote",e.tShift[t]<e.blkIndent&&(e.tShift[t]+=e.blkIndent,e.bMarks[t]-=e.blkIndent),e.parser.tokenize(e,t,r,!0),e.parentType=i,e.blkIndent-=4,e.tShift[t]=o,e.bMarks[t]=s,e.tokens.push({type:"footnote_reference_close",level:--e.level}),!0)}},{}],26:[function(e,t){"use strict";t.exports=function(e,t,r,n){var s,o,i,l=e.bMarks[t]+e.tShift[t],a=e.eMarks[t];if(l>=a)return!1;if(s=e.src.charCodeAt(l),35!==s||l>=a)return!1;for(o=1,s=e.src.charCodeAt(++l);35===s&&a>l&&6>=o;)o++,s=e.src.charCodeAt(++l);return o>6||a>l&&32!==s?!1:n?!0:(a=e.skipCharsBack(a,32,l),i=e.skipCharsBack(a,35,l),i>l&&32===e.src.charCodeAt(i-1)&&(a=i),e.line=t+1,e.tokens.push({type:"heading_open",hLevel:o,lines:[t,e.line],level:e.level}),a>l&&e.tokens.push({type:"inline",content:e.src.slice(l,a).trim(),level:e.level+1,lines:[t,e.line],children:[]}),e.tokens.push({type:"heading_close",hLevel:o,level:e.level}),!0)}},{}],27:[function(e,t){"use strict";t.exports=function(e,t,r,n){var s,o,i,l=e.bMarks[t],a=e.eMarks[t];if(l+=e.tShift[t],l>a)return!1;if(s=e.src.charCodeAt(l++),42!==s&&45!==s&&95!==s)return!1;for(o=1;a>l;){if(i=e.src.charCodeAt(l++),i!==s&&32!==i)return!1;i===s&&o++}return 3>o?!1:n?!0:(e.line=t+1,e.tokens.push({type:"hr",lines:[t,e.line],level:e.level}),!0)}},{}],28:[function(e,t){"use strict";function r(e){var t=32|e;return t>=97&&122>=t}var n=e("../common/html_blocks"),s=/^<([a-zA-Z]{1,15})[\s\/>]/,o=/^<\/([a-zA-Z]{1,15})[\s>]/;t.exports=function(e,t,i,l){var a,c,u,p=e.bMarks[t],h=e.eMarks[t],f=e.tShift[t];if(p+=f,!e.options.html)return!1;if(f>3||p+2>=h)return!1;if(60!==e.src.charCodeAt(p))return!1;if(a=e.src.charCodeAt(p+1),33===a||63===a){if(l)return!0}else{if(47!==a&&!r(a))return!1;if(47===a){if(c=e.src.slice(p,h).match(o),!c)return!1}else if(c=e.src.slice(p,h).match(s),!c)return!1;if(n[c[1].toLowerCase()]!==!0)return!1;if(l)return!0}for(u=t+1;u<e.lineMax&&!e.isEmpty(u);)u++;return e.line=u,e.tokens.push({type:"htmlblock",level:e.level,lines:[t,e.line],content:e.getLines(t,u,0,!0)}),!0}},{"../common/html_blocks":2}],29:[function(e,t){"use strict";t.exports=function(e,t,r){var n,s,o,i=t+1;return i>=r?!1:e.tShift[i]<e.blkIndent?!1:e.tShift[i]-e.blkIndent>3?!1:(s=e.bMarks[i]+e.tShift[i],o=e.eMarks[i],s>=o?!1:(n=e.src.charCodeAt(s),45!==n&&61!==n?!1:(s=e.skipChars(s,n),s=e.skipSpaces(s),o>s?!1:(s=e.bMarks[t]+e.tShift[t],e.line=i+1,e.tokens.push({type:"heading_open",hLevel:61===n?1:2,lines:[t,e.line],level:e.level}),e.tokens.push({type:"inline",content:e.src.slice(s,e.eMarks[t]).trim(),level:e.level+1,lines:[t,e.line-1],children:[]}),e.tokens.push({type:"heading_close",hLevel:61===n?1:2,level:e.level}),!0))))}},{}],30:[function(e,t){"use strict";function r(e,t){var r,n,s;return n=e.bMarks[t]+e.tShift[t],s=e.eMarks[t],n>=s?-1:(r=e.src.charCodeAt(n++),42!==r&&45!==r&&43!==r?-1:s>n&&32!==e.src.charCodeAt(n)?-1:n)}function n(e,t){var r,n=e.bMarks[t]+e.tShift[t],s=e.eMarks[t];if(n+1>=s)return-1;if(r=e.src.charCodeAt(n++),48>r||r>57)return-1;for(;;){if(n>=s)return-1;if(r=e.src.charCodeAt(n++),!(r>=48&&57>=r)){if(41===r||46===r)break;return-1}}return s>n&&32!==e.src.charCodeAt(n)?-1:n}function s(e,t){var r,n,s=e.level+2;for(r=t+2,n=e.tokens.length-2;n>r;r++)e.tokens[r].level===s&&"paragraph_open"===e.tokens[r].type&&(e.tokens[r+2].tight=!0,e.tokens[r].tight=!0,r+=2)}t.exports=function(e,t,o,i){var l,a,c,u,p,h,f,d,g,m,b,v,k,_,y,x,w,A,q,C,S,E,M=!0;if((d=n(e,t))>=0)k=!0;else{if(!((d=r(e,t))>=0))return!1;k=!1}if(e.level>=e.options.maxNesting)return!1;if(v=e.src.charCodeAt(d-1),i)return!0;for(y=e.tokens.length,k?(f=e.bMarks[t]+e.tShift[t],b=Number(e.src.substr(f,d-f-1)),e.tokens.push({type:"ordered_list_open",order:b,lines:w=[t,0],level:e.level++})):e.tokens.push({type:"bullet_list_open",lines:w=[t,0],level:e.level++}),l=t,x=!1,q=e.parser.ruler.getRules("list");!(!(o>l)||(_=e.skipSpaces(d),g=e.eMarks[l],m=_>=g?1:_-d,m>4&&(m=1),1>m&&(m=1),a=d-e.bMarks[l]+m,e.tokens.push({type:"list_item_open",lines:A=[t,0],level:e.level++}),u=e.blkIndent,p=e.tight,c=e.tShift[t],h=e.parentType,e.tShift[t]=_-e.bMarks[t],e.blkIndent=a,e.tight=!0,e.parentType="list",e.parser.tokenize(e,t,o,!0),(!e.tight||x)&&(M=!1),x=e.line-t>1&&e.isEmpty(e.line-1),e.blkIndent=u,e.tShift[t]=c,e.tight=p,e.parentType=h,e.tokens.push({type:"list_item_close",level:--e.level}),l=t=e.line,A[1]=l,_=e.bMarks[t],l>=o)||e.isEmpty(l)||e.tShift[l]<e.blkIndent);){for(E=!1,C=0,S=q.length;S>C;C++)if(q[C](e,l,o,!0)){E=!0;break}if(E)break;if(k){if(d=n(e,l),0>d)break}else if(d=r(e,l),0>d)break;if(v!==e.src.charCodeAt(d-1))break}return e.tokens.push({type:k?"ordered_list_close":"bullet_list_close",level:--e.level}),w[1]=l,e.line=l,M&&s(e,y),!0}},{}],31:[function(e,t){"use strict";t.exports=function(e,t){var r,n,s,o,i,l,a=t+1;if(r=e.lineMax,r>a&&!e.isEmpty(a))for(l=e.parser.ruler.getRules("paragraph");r>a&&!e.isEmpty(a);a++)if(!(e.tShift[a]-e.blkIndent>3)){for(s=!1,o=0,i=l.length;i>o;o++)if(l[o](e,a,r,!0)){s=!0;break}if(s)break}return n=e.getLines(t,a,e.blkIndent,!1).trim(),e.line=a,n.length&&(e.tokens.push({type:"paragraph_open",tight:!1,lines:[t,e.line],level:e.level}),e.tokens.push({type:"inline",content:n,level:e.level+1,lines:[t,e.line],children:[]}),e.tokens.push({type:"paragraph_close",tight:!1,level:e.level})),!0}},{}],32:[function(e,t){"use strict";function r(e,t,r,n,s){var o,i,l,a,c,u,p;for(this.src=e,this.parser=t,this.options=r,this.env=n,this.tokens=s,this.bMarks=[],this.eMarks=[],this.tShift=[],this.blkIndent=0,this.line=0,this.lineMax=0,this.tight=!1,this.parentType="root",this.ddIndent=-1,this.level=0,this.result="",i=this.src,u=0,p=!1,l=a=u=0,c=i.length;c>a;a++){if(o=i.charCodeAt(a),!p){if(32===o){u++;continue}p=!0}(10===o||a===c-1)&&(10!==o&&a++,this.bMarks.push(l),this.eMarks.push(a),this.tShift.push(u),p=!1,u=0,l=a+1)}this.bMarks.push(i.length),this.eMarks.push(i.length),this.tShift.push(0),this.lineMax=this.bMarks.length-1}r.prototype.isEmpty=function(e){return this.bMarks[e]+this.tShift[e]>=this.eMarks[e]},r.prototype.skipEmptyLines=function(e){for(var t=this.lineMax;t>e&&!(this.bMarks[e]+this.tShift[e]<this.eMarks[e]);e++);return e},r.prototype.skipSpaces=function(e){for(var t=this.src.length;t>e&&32===this.src.charCodeAt(e);e++);return e},r.prototype.skipChars=function(e,t){for(var r=this.src.length;r>e&&this.src.charCodeAt(e)===t;e++);return e},r.prototype.skipCharsBack=function(e,t,r){if(r>=e)return e;for(;e>r;)if(t!==this.src.charCodeAt(--e))return e+1;return e},r.prototype.getLines=function(e,t,r,n){var s,o,i,l,a,c=e;if(e>=t)return"";if(c+1===t)return o=this.bMarks[c]+Math.min(this.tShift[c],r),i=n?this.eMarks[c]+1:this.eMarks[c],this.src.slice(o,i);for(l=new Array(t-e),s=0;t>c;c++,s++)a=this.tShift[c],a>r&&(a=r),0>a&&(a=0),o=this.bMarks[c]+a,i=t>c+1||n?this.eMarks[c]+1:this.eMarks[c],l[s]=this.src.slice(o,i);return l.join("")},t.exports=r},{}],33:[function(e,t){"use strict";function r(e,t){var r=e.bMarks[t]+e.blkIndent,n=e.eMarks[t];return e.src.substr(r,n-r)}t.exports=function(e,t,n,s){var o,i,l,a,c,u,p,h,f,d,g;if(t+2>n)return!1;if(c=t+1,e.tShift[c]<e.blkIndent)return!1;if(l=e.bMarks[c]+e.tShift[c],l>=e.eMarks[c])return!1;if(o=e.src.charCodeAt(l),124!==o&&45!==o&&58!==o)return!1;if(i=r(e,t+1),!/^[-:| ]+$/.test(i))return!1;if(u=i.split("|"),2>=u)return!1;for(h=[],a=0;a<u.length;a++){if(f=u[a].trim(),!f){if(0===a||a===u.length-1)continue;return!1}if(!/^:?-+:?$/.test(f))return!1;h.push(58===f.charCodeAt(f.length-1)?58===f.charCodeAt(0)?"center":"right":58===f.charCodeAt(0)?"left":"")}if(i=r(e,t).trim(),-1===i.indexOf("|"))return!1;if(u=i.replace(/^\||\|$/g,"").split("|"),h.length!==u.length)return!1;if(s)return!0;for(e.tokens.push({type:"table_open",lines:d=[t,0],level:e.level++}),e.tokens.push({type:"thead_open",lines:[t,t+1],level:e.level++}),e.tokens.push({type:"tr_open",lines:[t,t+1],level:e.level++}),a=0;a<u.length;a++)e.tokens.push({type:"th_open",align:h[a],lines:[t,t+1],level:e.level++}),e.tokens.push({type:"inline",content:u[a].trim(),lines:[t,t+1],level:e.level,children:[]}),e.tokens.push({type:"th_close",level:--e.level});for(e.tokens.push({type:"tr_close",level:--e.level}),e.tokens.push({type:"thead_close",level:--e.level}),e.tokens.push({type:"tbody_open",lines:g=[t+2,0],level:e.level++}),c=t+2;n>c&&!(e.tShift[c]<e.blkIndent)&&(i=r(e,c).trim(),-1!==i.indexOf("|"));c++){for(u=i.replace(/^\||\|$/g,"").split("|"),e.tokens.push({type:"tr_open",level:e.level++}),a=0;a<u.length;a++)e.tokens.push({type:"td_open",align:h[a],level:e.level++}),p=u[a].substring(124===u[a].charCodeAt(0)?1:0,124===u[a].charCodeAt(u[a].length-1)?u[a].length-1:u[a].length).trim(),e.tokens.push({type:"inline",content:p,level:e.level,children:[]}),e.tokens.push({type:"td_close",level:--e.level});e.tokens.push({type:"tr_close",level:--e.level})}return e.tokens.push({type:"tbody_close",level:--e.level}),e.tokens.push({type:"table_close",level:--e.level}),d[1]=g[1]=c,e.line=c,!0}},{}],34:[function(e,t){"use strict";function r(e,t,r,o){var i,l,a,c,u,p;if(42!==e.charCodeAt(0))return-1;if(91!==e.charCodeAt(1))return-1;if(-1===e.indexOf("]:"))return-1;if(i=new n(e,t,r,o,[]),l=s(i,1),0>l||58!==e.charCodeAt(l+1))return-1;for(c=i.posMax,a=l+2;c>a&&10!==i.src.charCodeAt(a);a++);return u=e.slice(2,l),p=e.slice(l+2,a).trim(),0===p.length?-1:(o.abbreviations||(o.abbreviations={}),"undefined"==typeof o.abbreviations[":"+u]&&(o.abbreviations[":"+u]=p),a)}var n=e("../rules_inline/state_inline"),s=e("../helpers/parse_link_label");t.exports=function(e){var t,n,s,o,i=e.tokens;if(!e.inlineMode)for(t=1,n=i.length-1;n>t;t++)if("paragraph_open"===i[t-1].type&&"inline"===i[t].type&&"paragraph_close"===i[t+1].type){for(s=i[t].content;s.length&&(o=r(s,e.inline,e.options,e.env),!(0>o));)s=s.slice(o).trim();i[t].content=s,s.length||(i[t-1].tight=!0,i[t+1].tight=!0)}}},{"../helpers/parse_link_label":12,"../rules_inline/state_inline":56}],35:[function(e,t){"use strict";function r(e){return e.replace(/([-()\[\]{}+?*.$\^|,:#<!\\])/g,"\\$1")}var n=" \n()[]'\".,!?-";t.exports=function(e){var t,s,o,i,l,a,c,u,p,h,f,d,g=e.tokens;if(e.env.abbreviations)for(e.env.abbrRegExp||(d="(^|["+n.split("").map(r).join("")+"])("+Object.keys(e.env.abbreviations).map(function(e){return e.substr(1)}).sort(function(e,t){return t.length-e.length}).map(r).join("|")+")($|["+n.split("").map(r).join("")+"])",e.env.abbrRegExp=new RegExp(d,"g")),h=e.env.abbrRegExp,s=0,o=g.length;o>s;s++)if("inline"===g[s].type)for(i=g[s].children,t=i.length-1;t>=0;t--)if(l=i[t],"text"===l.type){for(u=0,a=l.content,h.lastIndex=0,p=l.level,c=[];f=h.exec(a);)h.lastIndex>u&&c.push({type:"text",content:a.slice(u,f.index+f[1].length),level:p}),c.push({type:"abbr_open",title:e.env.abbreviations[":"+f[2]],level:p++}),c.push({type:"text",content:f[2],level:p}),c.push({type:"abbr_close",level:--p}),u=h.lastIndex-f[3].length;c.length&&(u<a.length&&c.push({type:"text",content:a.slice(u),level:p}),g[s].children=i=[].concat(i.slice(0,t),c,i.slice(t+1)))}}},{}],36:[function(e,t){"use strict";t.exports=function(e){e.inlineMode?e.tokens.push({type:"inline",content:e.src.replace(/\n/g," ").trim(),level:0,lines:[0,1],children:[]}):e.block.parse(e.src,e.options,e.env,e.tokens)}},{}],37:[function(e,t){"use strict";t.exports=function(e){var t,r,n,s,o,i,l,a,c,u=0,p=!1,h={};if(e.env.footnotes&&(e.tokens=e.tokens.filter(function(e){return"footnote_reference_open"===e.type?(p=!0,a=[],c=e.label,!1):"footnote_reference_close"===e.type?(p=!1,h[":"+c]=a,!1):(p&&a.push(e),!p)}),e.env.footnotes.list)){for(i=e.env.footnotes.list,e.tokens.push({type:"footnote_block_open",level:u++}),t=0,r=i.length;r>t;t++){for(e.tokens.push({type:"footnote_open",id:t,level:u++}),i[t].tokens?(l=[],l.push({type:"paragraph_open",tight:!1,level:u++}),l.push({type:"inline",content:"",level:u,children:i[t].tokens}),l.push({type:"paragraph_close",tight:!1,level:--u})):i[t].label&&(l=h[":"+i[t].label]),e.tokens=e.tokens.concat(l),o="paragraph_close"===e.tokens[e.tokens.length-1].type?e.tokens.pop():null,s=i[t].count>0?i[t].count:1,n=0;s>n;n++)e.tokens.push({type:"footnote_anchor",id:t,subId:n,level:u});o&&e.tokens.push(o),e.tokens.push({type:"footnote_close",level:--u})}e.tokens.push({type:"footnote_block_close",level:--u})}}},{}],38:[function(e,t){"use strict";t.exports=function(e){var t,r,n,s=e.tokens;for(r=0,n=s.length;n>r;r++)t=s[r],"inline"===t.type&&e.inline.parse(t.content,e.options,e.env,t.children)}},{}],39:[function(e,t){"use strict";function r(e){return/^<a[>\s]/i.test(e)}function n(e){return/^<\/a\s*>/i.test(e)}function s(){var e=[],t=new o({stripPrefix:!1,url:!0,email:!0,twitter:!1,replaceFn:function(t,r){switch(r.getType()){case"url":e.push({text:r.matchedText,url:r.getUrl()});break;case"email":e.push({text:r.matchedText,url:"mailto:"+r.getEmail().replace(/^mailto:/i,"")})}return!1}});return{links:e,autolinker:t}}var o=e("autolinker"),i=/www|@|\:\/\//;t.exports=function(e){var t,o,l,a,c,u,p,h,f,d,g,m,b,v=e.tokens,k=null;if(e.options.linkify)for(o=0,l=v.length;l>o;o++)if("inline"===v[o].type)for(a=v[o].children,
4 -g=0,t=a.length-1;t>=0;t--)if(c=a[t],"link_close"!==c.type){if("htmltag"===c.type&&(r(c.content)&&g>0&&g--,n(c.content)&&g++),!(g>0)&&"text"===c.type&&i.test(c.content)){if(k||(k=s(),m=k.links,b=k.autolinker),u=c.content,m.length=0,b.link(u),!m.length)continue;for(p=[],d=c.level,h=0;h<m.length;h++)e.inline.validateLink(m[h].url)&&(f=u.indexOf(m[h].text),f&&(d=d,p.push({type:"text",content:u.slice(0,f),level:d})),p.push({type:"link_open",href:m[h].url,title:"",level:d++}),p.push({type:"text",content:m[h].text,level:d}),p.push({type:"link_close",level:--d}),u=u.slice(f+m[h].text.length));u.length&&p.push({type:"text",content:u,level:d}),v[o].children=a=[].concat(a.slice(0,t),p,a.slice(t+1))}}else for(t--;a[t].level!==c.level&&"link_open"!==a[t].type;)t--}},{autolinker:60}],40:[function(e,t){"use strict";function r(e,t,r,a){var c,u,p,h,f,d,g,m,b;if(91!==e.charCodeAt(0))return-1;if(-1===e.indexOf("]:"))return-1;if(c=new n(e,t,r,a,[]),u=s(c,0),0>u||58!==e.charCodeAt(u+1))return-1;for(h=c.posMax,p=u+2;h>p&&(f=c.src.charCodeAt(p),32===f||10===f);p++);if(!o(c,p))return-1;for(g=c.linkContent,p=c.pos,d=p,p+=1;h>p&&(f=c.src.charCodeAt(p),32===f||10===f);p++);for(h>p&&d!==p&&i(c,p)?(m=c.linkContent,p=c.pos):(m="",p=d);h>p&&32===c.src.charCodeAt(p);)p++;return h>p&&10!==c.src.charCodeAt(p)?-1:(b=l(e.slice(1,u)),"undefined"==typeof a.references[b]&&(a.references[b]={title:m,href:g}),p)}var n=e("../rules_inline/state_inline"),s=e("../helpers/parse_link_label"),o=e("../helpers/parse_link_destination"),i=e("../helpers/parse_link_title"),l=e("../helpers/normalize_reference");t.exports=function(e){var t,n,s,o,i=e.tokens;if(e.env.references=e.env.references||{},!e.inlineMode)for(t=1,n=i.length-1;n>t;t++)if("inline"===i[t].type&&"paragraph_open"===i[t-1].type&&"paragraph_close"===i[t+1].type){for(s=i[t].content;s.length&&(o=r(s,e.inline,e.options,e.env),!(0>o));)s=s.slice(o).trim();i[t].content=s,s.length||(i[t-1].tight=!0,i[t+1].tight=!0)}}},{"../helpers/normalize_reference":10,"../helpers/parse_link_destination":11,"../helpers/parse_link_label":12,"../helpers/parse_link_title":13,"../rules_inline/state_inline":56}],41:[function(e,t){"use strict";function r(e){return e.indexOf("(")<0?e:e.replace(s,function(e,t){return o[t.toLowerCase()]})}var n=/\+-|\.\.|\?\?\?\?|!!!!|,,|--/,s=/\((c|tm|r|p)\)/gi,o={c:"©",r:"®",p:"§",tm:"™"};t.exports=function(e){var t,s,o,i,l;if(e.options.typographer)for(l=e.tokens.length-1;l>=0;l--)if("inline"===e.tokens[l].type)for(i=e.tokens[l].children,t=i.length-1;t>=0;t--)s=i[t],"text"===s.type&&(o=s.content,o=r(o),n.test(o)&&(o=o.replace(/\+-/g,"±").replace(/\.{2,}/g,"…").replace(/([?!])…/g,"$1..").replace(/([?!]){4,}/g,"$1$1$1").replace(/,{2,}/g,",").replace(/(^|[^-])---([^-]|$)/gm,"$1—$2").replace(/(^|\s)--(\s|$)/gm,"$1–$2").replace(/(^|[^-\s])--([^-\s]|$)/gm,"$1–$2")),s.content=o)}},{}],42:[function(e,t){"use strict";function r(e,t){return 0>t||t>=e.length?!1:!i.test(e[t])}function n(e,t,r){return e.substr(0,t)+r+e.substr(t+1)}var s=/['"]/,o=/['"]/g,i=/[-\s()\[\]]/,l="’";t.exports=function(e){var t,i,a,c,u,p,h,f,d,g,m,b,v,k,_,y,x;if(e.options.typographer)for(x=[],_=e.tokens.length-1;_>=0;_--)if("inline"===e.tokens[_].type)for(y=e.tokens[_].children,x.length=0,t=0;t<y.length;t++)if(i=y[t],"text"===i.type&&!s.test(i.text)){for(h=y[t].level,v=x.length-1;v>=0&&!(x[v].level<=h);v--);x.length=v+1,a=i.content,u=0,p=a.length;e:for(;p>u&&(o.lastIndex=u,c=o.exec(a));)if(f=!r(a,c.index-1),u=c.index+1,k="'"===c[0],d=!r(a,u),d||f){if(m=!d,b=!f)for(v=x.length-1;v>=0&&(g=x[v],!(x[v].level<h));v--)if(g.single===k&&x[v].level===h){g=x[v],k?(y[g.token].content=n(y[g.token].content,g.pos,e.options.quotes[2]),i.content=n(i.content,c.index,e.options.quotes[3])):(y[g.token].content=n(y[g.token].content,g.pos,e.options.quotes[0]),i.content=n(i.content,c.index,e.options.quotes[1])),x.length=v;continue e}m?x.push({token:t,pos:c.index,single:k,level:h}):b&&k&&(i.content=n(i.content,c.index,l))}else k&&(i.content=n(i.content,c.index,l))}}},{}],43:[function(e,t){"use strict";var r=e("../common/url_schemas"),n=e("../helpers/normalize_link"),s=/^<([a-zA-Z0-9.!#$%&'*+\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*)>/,o=/^<([a-zA-Z.\-]{1,25}):([^<>\x00-\x20]*)>/;t.exports=function(e,t){var i,l,a,c,u,p=e.pos;return 60!==e.src.charCodeAt(p)?!1:(i=e.src.slice(p),i.indexOf(">")<0?!1:(l=i.match(o))?r.indexOf(l[1].toLowerCase())<0?!1:(c=l[0].slice(1,-1),u=n(c),e.parser.validateLink(c)?(t||(e.push({type:"link_open",href:u,level:e.level}),e.push({type:"text",content:c,level:e.level+1}),e.push({type:"link_close",level:e.level})),e.pos+=l[0].length,!0):!1):(a=i.match(s),a?(c=a[0].slice(1,-1),u=n("mailto:"+c),e.parser.validateLink(u)?(t||(e.push({type:"link_open",href:u,level:e.level}),e.push({type:"text",content:c,level:e.level+1}),e.push({type:"link_close",level:e.level})),e.pos+=a[0].length,!0):!1):!1))}},{"../common/url_schemas":4,"../helpers/normalize_link":9}],44:[function(e,t){"use strict";t.exports=function(e,t){var r,n,s,o,i,l=e.pos,a=e.src.charCodeAt(l);if(96!==a)return!1;for(r=l,l++,n=e.posMax;n>l&&96===e.src.charCodeAt(l);)l++;for(s=e.src.slice(r,l),o=i=l;-1!==(o=e.src.indexOf("`",i));){for(i=o+1;n>i&&96===e.src.charCodeAt(i);)i++;if(i-o===s.length)return t||e.push({type:"code",content:e.src.slice(l,o).replace(/[ \n]+/g," ").trim(),block:!1,level:e.level}),e.pos=i,!0}return t||(e.pending+=s),e.pos+=s.length,!0}},{}],45:[function(e,t){"use strict";t.exports=function(e,t){var r,n,s,o,i,l=e.posMax,a=e.pos;if(126!==e.src.charCodeAt(a))return!1;if(t)return!1;if(a+4>=l)return!1;if(126!==e.src.charCodeAt(a+1))return!1;if(e.level>=e.options.maxNesting)return!1;if(o=a>0?e.src.charCodeAt(a-1):-1,i=e.src.charCodeAt(a+2),126===o)return!1;if(126===i)return!1;if(32===i||10===i)return!1;for(n=a+2;l>n&&126===e.src.charCodeAt(n);)n++;if(n>a+3)return e.pos+=n-a,t||(e.pending+=e.src.slice(a,n)),!0;for(e.pos=a+2,s=1;e.pos+1<l;){if(126===e.src.charCodeAt(e.pos)&&126===e.src.charCodeAt(e.pos+1)&&(o=e.src.charCodeAt(e.pos-1),i=e.pos+2<l?e.src.charCodeAt(e.pos+2):-1,126!==i&&126!==o&&(32!==o&&10!==o?s--:32!==i&&10!==i&&s++,0>=s))){r=!0;break}e.parser.skipToken(e)}return r?(e.posMax=e.pos,e.pos=a+2,t||(e.push({type:"del_open",level:e.level++}),e.parser.tokenize(e),e.push({type:"del_close",level:--e.level})),e.pos=e.posMax+2,e.posMax=l,!0):(e.pos=a,!1)}},{}],46:[function(e,t){"use strict";function r(e){return e>=48&&57>=e||e>=65&&90>=e||e>=97&&122>=e}function n(e,t){var n,s,o,i=t,l=!0,a=!0,c=e.posMax,u=e.src.charCodeAt(t);for(n=t>0?e.src.charCodeAt(t-1):-1;c>i&&e.src.charCodeAt(i)===u;)i++;return i>=c&&(l=!1),o=i-t,o>=4?l=a=!1:(s=c>i?e.src.charCodeAt(i):-1,(32===s||10===s)&&(l=!1),(32===n||10===n)&&(a=!1),95===u&&(r(n)&&(l=!1),r(s)&&(a=!1))),{can_open:l,can_close:a,delims:o}}t.exports=function(e,t){var r,s,o,i,l,a,c,u=e.posMax,p=e.pos,h=e.src.charCodeAt(p);if(95!==h&&42!==h)return!1;if(t)return!1;if(c=n(e,p),r=c.delims,!c.can_open)return e.pos+=r,t||(e.pending+=e.src.slice(p,e.pos)),!0;if(e.level>=e.options.maxNesting)return!1;for(e.pos=p+r,a=[r];e.pos<u;)if(e.src.charCodeAt(e.pos)!==h)e.parser.skipToken(e);else{if(c=n(e,e.pos),s=c.delims,c.can_close){for(i=a.pop(),l=s;i!==l;){if(i>l){a.push(i-l);break}if(l-=i,0===a.length)break;e.pos+=i,i=a.pop()}if(0===a.length){r=i,o=!0;break}e.pos+=s;continue}c.can_open&&a.push(s),e.pos+=s}return o?(e.posMax=e.pos,e.pos=p+r,t||((2===r||3===r)&&e.push({type:"strong_open",level:e.level++}),(1===r||3===r)&&e.push({type:"em_open",level:e.level++}),e.parser.tokenize(e),(1===r||3===r)&&e.push({type:"em_close",level:--e.level}),(2===r||3===r)&&e.push({type:"strong_close",level:--e.level})),e.pos=e.posMax+r,e.posMax=u,!0):(e.pos=p,!1)}},{}],47:[function(e,t){"use strict";var r=e("../common/entities"),n=e("../common/utils").has,s=e("../common/utils").isValidEntityCode,o=e("../common/utils").fromCodePoint,i=/^&#((?:x[a-f0-9]{1,8}|[0-9]{1,8}));/i,l=/^&([a-z][a-z0-9]{1,31});/i;t.exports=function(e,t){var a,c,u,p=e.pos,h=e.posMax;if(38!==e.src.charCodeAt(p))return!1;if(h>p+1)if(a=e.src.charCodeAt(p+1),35===a){if(u=e.src.slice(p).match(i))return t||(c="x"===u[1][0].toLowerCase()?parseInt(u[1].slice(1),16):parseInt(u[1],10),e.pending+=o(s(c)?c:65533)),e.pos+=u[0].length,!0}else if(u=e.src.slice(p).match(l),u&&n(r,u[1]))return t||(e.pending+=r[u[1]]),e.pos+=u[0].length,!0;return t||(e.pending+="&"),e.pos++,!0}},{"../common/entities":1,"../common/utils":5}],48:[function(e,t){"use strict";for(var r=[],n=0;256>n;n++)r.push(0);"\\!\"#$%&'()*+,./:;<=>?@[]^_`{|}~-".split("").forEach(function(e){r[e.charCodeAt(0)]=1}),t.exports=function(e,t){var n,s=e.pos,o=e.posMax;if(92!==e.src.charCodeAt(s))return!1;if(s++,o>s){if(n=e.src.charCodeAt(s),256>n&&0!==r[n])return t||(e.pending+=e.src[s]),e.pos+=2,!0;if(10===n){for(t||e.push({type:"hardbreak",level:e.level}),s++;o>s&&32===e.src.charCodeAt(s);)s++;return e.pos=s,!0}}return t||(e.pending+="\\"),e.pos++,!0}},{}],49:[function(e,t){"use strict";var r=e("../helpers/parse_link_label");t.exports=function(e,t){var n,s,o,i,l=e.posMax,a=e.pos;return a+2>=l?!1:94!==e.src.charCodeAt(a)?!1:91!==e.src.charCodeAt(a+1)?!1:e.level>=e.options.maxNesting?!1:(n=a+2,s=r(e,a+1),0>s?!1:(t||(e.env.footnotes||(e.env.footnotes={}),e.env.footnotes.list||(e.env.footnotes.list=[]),o=e.env.footnotes.list.length,e.pos=n,e.posMax=s,e.push({type:"footnote_ref",id:o,level:e.level}),e.linkLevel++,i=e.tokens.length,e.parser.tokenize(e),e.env.footnotes.list[o]={tokens:e.tokens.splice(i)},e.linkLevel--),e.pos=s+1,e.posMax=l,!0))}},{"../helpers/parse_link_label":12}],50:[function(e,t){"use strict";t.exports=function(e,t){var r,n,s,o,i=e.posMax,l=e.pos;if(l+3>i)return!1;if(!e.env.footnotes||!e.env.footnotes.refs)return!1;if(91!==e.src.charCodeAt(l))return!1;if(94!==e.src.charCodeAt(l+1))return!1;if(e.level>=e.options.maxNesting)return!1;for(n=l+2;i>n;n++){if(32===e.src.charCodeAt(n))return!1;if(10===e.src.charCodeAt(n))return!1;if(93===e.src.charCodeAt(n))break}return n===l+2?!1:n>=i?!1:(n++,r=e.src.slice(l+2,n-1),"undefined"==typeof e.env.footnotes.refs[":"+r]?!1:(t||(e.env.footnotes.list||(e.env.footnotes.list=[]),e.env.footnotes.refs[":"+r]<0?(s=e.env.footnotes.list.length,e.env.footnotes.list[s]={label:r,count:0},e.env.footnotes.refs[":"+r]=s):s=e.env.footnotes.refs[":"+r],o=e.env.footnotes.list[s].count,e.env.footnotes.list[s].count++,e.push({type:"footnote_ref",id:s,subId:o,level:e.level})),e.pos=n,e.posMax=i,!0))}},{}],51:[function(e,t){"use strict";function r(e){var t=32|e;return t>=97&&122>=t}var n=e("../common/html_re").HTML_TAG_RE;t.exports=function(e,t){var s,o,i,l=e.pos;return e.options.html?(i=e.posMax,60!==e.src.charCodeAt(l)||l+2>=i?!1:(s=e.src.charCodeAt(l+1),(33===s||63===s||47===s||r(s))&&(o=e.src.slice(l).match(n))?(t||e.push({type:"htmltag",content:e.src.slice(l,l+o[0].length),level:e.level}),e.pos+=o[0].length,!0):!1)):!1}},{"../common/html_re":3}],52:[function(e,t){"use strict";t.exports=function(e,t){var r,n,s,o,i,l=e.posMax,a=e.pos;if(43!==e.src.charCodeAt(a))return!1;if(t)return!1;if(a+4>=l)return!1;if(43!==e.src.charCodeAt(a+1))return!1;if(e.level>=e.options.maxNesting)return!1;if(o=a>0?e.src.charCodeAt(a-1):-1,i=e.src.charCodeAt(a+2),43===o)return!1;if(43===i)return!1;if(32===i||10===i)return!1;for(n=a+2;l>n&&43===e.src.charCodeAt(n);)n++;if(n!==a+2)return e.pos+=n-a,t||(e.pending+=e.src.slice(a,n)),!0;for(e.pos=a+2,s=1;e.pos+1<l;){if(43===e.src.charCodeAt(e.pos)&&43===e.src.charCodeAt(e.pos+1)&&(o=e.src.charCodeAt(e.pos-1),i=e.pos+2<l?e.src.charCodeAt(e.pos+2):-1,43!==i&&43!==o&&(32!==o&&10!==o?s--:32!==i&&10!==i&&s++,0>=s))){r=!0;break}e.parser.skipToken(e)}return r?(e.posMax=e.pos,e.pos=a+2,t||(e.push({type:"ins_open",level:e.level++}),e.parser.tokenize(e),e.push({type:"ins_close",level:--e.level})),e.pos=e.posMax+2,e.posMax=l,!0):(e.pos=a,!1)}},{}],53:[function(e,t){"use strict";var r=e("../helpers/parse_link_label"),n=e("../helpers/parse_link_destination"),s=e("../helpers/parse_link_title"),o=e("../helpers/normalize_reference");t.exports=function(e,t){var i,l,a,c,u,p,h,f,d=!1,g=e.pos,m=e.posMax,b=e.pos,v=e.src.charCodeAt(b);if(33===v&&(d=!0,v=e.src.charCodeAt(++b)),91!==v)return!1;if(e.level>=e.options.maxNesting)return!1;if(i=b+1,l=r(e,b),0>l)return!1;if(p=l+1,m>p&&40===e.src.charCodeAt(p)){for(p++;m>p&&(f=e.src.charCodeAt(p),32===f||10===f);p++);if(p>=m)return!1;for(b=p,n(e,p)?(c=e.linkContent,p=e.pos):c="",b=p;m>p&&(f=e.src.charCodeAt(p),32===f||10===f);p++);if(m>p&&b!==p&&s(e,p))for(u=e.linkContent,p=e.pos;m>p&&(f=e.src.charCodeAt(p),32===f||10===f);p++);else u="";if(p>=m||41!==e.src.charCodeAt(p))return e.pos=g,!1;p++}else{if(e.linkLevel>0)return!1;for(;m>p&&(f=e.src.charCodeAt(p),32===f||10===f);p++);if(m>p&&91===e.src.charCodeAt(p)&&(b=p+1,p=r(e,p),p>=0?a=e.src.slice(b,p++):p=b-1),a||("undefined"==typeof a&&(p=l+1),a=e.src.slice(i,l)),h=e.env.references[o(a)],!h)return e.pos=g,!1;c=h.href,u=h.title}return t||(e.pos=i,e.posMax=l,d?e.push({type:"image",src:c,title:u,alt:e.src.substr(i,l-i),level:e.level}):(e.push({type:"link_open",href:c,title:u,level:e.level++}),e.linkLevel++,e.parser.tokenize(e),e.linkLevel--,e.push({type:"link_close",level:--e.level}))),e.pos=p,e.posMax=m,!0}},{"../helpers/normalize_reference":10,"../helpers/parse_link_destination":11,"../helpers/parse_link_label":12,"../helpers/parse_link_title":13}],54:[function(e,t){"use strict";t.exports=function(e,t){var r,n,s,o,i,l=e.posMax,a=e.pos;if(61!==e.src.charCodeAt(a))return!1;if(t)return!1;if(a+4>=l)return!1;if(61!==e.src.charCodeAt(a+1))return!1;if(e.level>=e.options.maxNesting)return!1;if(o=a>0?e.src.charCodeAt(a-1):-1,i=e.src.charCodeAt(a+2),61===o)return!1;if(61===i)return!1;if(32===i||10===i)return!1;for(n=a+2;l>n&&61===e.src.charCodeAt(n);)n++;if(n!==a+2)return e.pos+=n-a,t||(e.pending+=e.src.slice(a,n)),!0;for(e.pos=a+2,s=1;e.pos+1<l;){if(61===e.src.charCodeAt(e.pos)&&61===e.src.charCodeAt(e.pos+1)&&(o=e.src.charCodeAt(e.pos-1),i=e.pos+2<l?e.src.charCodeAt(e.pos+2):-1,61!==i&&61!==o&&(32!==o&&10!==o?s--:32!==i&&10!==i&&s++,0>=s))){r=!0;break}e.parser.skipToken(e)}return r?(e.posMax=e.pos,e.pos=a+2,t||(e.push({type:"mark_open",level:e.level++}),e.parser.tokenize(e),e.push({type:"mark_close",level:--e.level})),e.pos=e.posMax+2,e.posMax=l,!0):(e.pos=a,!1)}},{}],55:[function(e,t){"use strict";t.exports=function(e,t){var r,n,s=e.pos;if(10!==e.src.charCodeAt(s))return!1;if(r=e.pending.length-1,n=e.posMax,!t)if(r>=0&&32===e.pending.charCodeAt(r))if(r>=1&&32===e.pending.charCodeAt(r-1)){for(var o=r-2;o>=0;o--)if(32!==e.pending.charCodeAt(o)){e.pending=e.pending.substring(0,o+1);break}e.push({type:"hardbreak",level:e.level})}else e.pending=e.pending.slice(0,-1),e.push({type:"softbreak",level:e.level});else e.push({type:"softbreak",level:e.level});for(s++;n>s&&32===e.src.charCodeAt(s);)s++;return e.pos=s,!0}},{}],56:[function(e,t){"use strict";function r(e,t,r,n,s){this.src=e,this.env=n,this.options=r,this.parser=t,this.tokens=s,this.pos=0,this.posMax=this.src.length,this.level=0,this.pending="",this.pendingLevel=0,this.cache=[],this.isInLabel=!1,this.linkLevel=0,this.linkContent="",this.labelUnmatchedScopes=0}r.prototype.pushPending=function(){this.tokens.push({type:"text",content:this.pending,level:this.pendingLevel}),this.pending=""},r.prototype.push=function(e){this.pending&&this.pushPending(),this.tokens.push(e),this.pendingLevel=this.level},r.prototype.cacheSet=function(e,t){for(var r=this.cache.length;e>=r;r++)this.cache.push(0);this.cache[e]=t},r.prototype.cacheGet=function(e){return e<this.cache.length?this.cache[e]:0},t.exports=r},{}],57:[function(e,t){"use strict";var r=/\\([ \\!"#$%&'()*+,.\/:;<=>?@[\]^_`{|}~-])/g;t.exports=function(e,t){var n,s,o=e.posMax,i=e.pos;if(126!==e.src.charCodeAt(i))return!1;if(t)return!1;if(i+2>=o)return!1;if(e.level>=e.options.maxNesting)return!1;for(e.pos=i+1;e.pos<o;){if(126===e.src.charCodeAt(e.pos)){n=!0;break}e.parser.skipToken(e)}return n&&i+1!==e.pos?(s=e.src.slice(i+1,e.pos),s.match(/(^|[^\\])(\\\\)*\s/)?(e.pos=i,!1):(e.posMax=e.pos,e.pos=i+1,t||e.push({type:"sub",level:e.level,content:s.replace(r,"$1")}),e.pos=e.posMax+1,e.posMax=o,!0)):(e.pos=i,!1)}},{}],58:[function(e,t){"use strict";var r=/\\([ \\!"#$%&'()*+,.\/:;<=>?@[\]^_`{|}~-])/g;t.exports=function(e,t){var n,s,o=e.posMax,i=e.pos;if(94!==e.src.charCodeAt(i))return!1;if(t)return!1;if(i+2>=o)return!1;if(e.level>=e.options.maxNesting)return!1;for(e.pos=i+1;e.pos<o;){if(94===e.src.charCodeAt(e.pos)){n=!0;break}e.parser.skipToken(e)}return n&&i+1!==e.pos?(s=e.src.slice(i+1,e.pos),s.match(/(^|[^\\])(\\\\)*\s/)?(e.pos=i,!1):(e.posMax=e.pos,e.pos=i+1,t||e.push({type:"sup",level:e.level,content:s.replace(r,"$1")}),e.pos=e.posMax+1,e.posMax=o,!0)):(e.pos=i,!1)}},{}],59:[function(e,t){"use strict";function r(e){switch(e){case 10:case 92:case 96:case 42:case 95:case 94:case 91:case 93:case 33:case 38:case 60:case 62:case 123:case 125:case 36:case 37:case 64:case 126:case 43:case 61:case 58:return!0;default:return!1}}t.exports=function(e,t){for(var n=e.pos;n<e.posMax&&!r(e.src.charCodeAt(n));)n++;return n===e.pos?!1:(t||(e.pending+=e.src.slice(e.pos,n)),e.pos=n,!0)}},{}],60:[function(t,r,n){!function(t,s){"function"==typeof e&&e.amd?e([],function(){return t.Autolinker=s()}):"object"==typeof n?r.exports=s():t.Autolinker=s()}(this,function(){var e=function(t){e.Util.assign(this,t)};return e.prototype={constructor:e,urls:!0,email:!0,twitter:!0,newWindow:!0,stripPrefix:!0,truncate:void 0,className:"",htmlParser:void 0,matchParser:void 0,tagBuilder:void 0,link:function(e){for(var t=this.getHtmlParser(),r=t.parse(e),n=0,s=[],o=0,i=r.length;i>o;o++){var l=r[o],a=l.getType(),c=l.getText();if("element"===a)"a"===l.getTagName()&&(l.isClosing()?n=Math.max(n-1,0):n++),s.push(c);else if("entity"===a)s.push(c);else if(0===n){var u=this.linkifyStr(c);s.push(u)}else s.push(c)}return s.join("")},linkifyStr:function(e){return this.getMatchParser().replace(e,this.createMatchReturnVal,this)},createMatchReturnVal:function(t){var r;if(this.replaceFn&&(r=this.replaceFn.call(this,this,t)),"string"==typeof r)return r;if(r===!1)return t.getMatchedText();if(r instanceof e.HtmlTag)return r.toString();var n=this.getTagBuilder(),s=n.build(t);return s.toString()},getHtmlParser:function(){var t=this.htmlParser;return t||(t=this.htmlParser=new e.htmlParser.HtmlParser),t},getMatchParser:function(){var t=this.matchParser;return t||(t=this.matchParser=new e.matchParser.MatchParser({urls:this.urls,email:this.email,twitter:this.twitter,stripPrefix:this.stripPrefix})),t},getTagBuilder:function(){var t=this.tagBuilder;return t||(t=this.tagBuilder=new e.AnchorTagBuilder({newWindow:this.newWindow,truncate:this.truncate,className:this.className})),t}},e.link=function(t,r){var n=new e(r);return n.link(t)},e.match={},e.htmlParser={},e.matchParser={},e.Util={abstractMethod:function(){throw"abstract"},assign:function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r]);return e},extend:function(t,r){var n=t.prototype,s=function(){};s.prototype=n;var o;o=r.hasOwnProperty("constructor")?r.constructor:function(){n.constructor.apply(this,arguments)};var i=o.prototype=new s;return i.constructor=o,i.superclass=n,delete r.constructor,e.Util.assign(i,r),o},ellipsis:function(e,t,r){return e.length>t&&(r=null==r?"..":r,e=e.substring(0,t-r.length)+r),e},indexOf:function(e,t){if(Array.prototype.indexOf)return e.indexOf(t);for(var r=0,n=e.length;n>r;r++)if(e[r]===t)return r;return-1},splitAndCapture:function(e,t){if(!t.global)throw new Error("`splitRegex` must have the 'g' flag set");for(var r,n=[],s=0;r=t.exec(e);)n.push(e.substring(s,r.index)),n.push(r[0]),s=r.index+r[0].length;return n.push(e.substring(s)),n}},e.HtmlTag=e.Util.extend(Object,{whitespaceRegex:/\s+/,constructor:function(t){e.Util.assign(this,t),this.innerHtml=this.innerHtml||this.innerHTML},setTagName:function(e){return this.tagName=e,this},getTagName:function(){return this.tagName||""},setAttr:function(e,t){var r=this.getAttrs();return r[e]=t,this},getAttr:function(e){return this.getAttrs()[e]},setAttrs:function(t){var r=this.getAttrs();return e.Util.assign(r,t),this},getAttrs:function(){return this.attrs||(this.attrs={})},setClass:function(e){return this.setAttr("class",e)},addClass:function(t){for(var r,n=this.getClass(),s=this.whitespaceRegex,o=e.Util.indexOf,i=n?n.split(s):[],l=t.split(s);r=l.shift();)-1===o(i,r)&&i.push(r);return this.getAttrs()["class"]=i.join(" "),this},removeClass:function(t){for(var r,n=this.getClass(),s=this.whitespaceRegex,o=e.Util.indexOf,i=n?n.split(s):[],l=t.split(s);i.length&&(r=l.shift());){var a=o(i,r);-1!==a&&i.splice(a,1)}return this.getAttrs()["class"]=i.join(" "),this},getClass:function(){return this.getAttrs()["class"]||""},hasClass:function(e){return-1!==(" "+this.getClass()+" ").indexOf(" "+e+" ")},setInnerHtml:function(e){return this.innerHtml=e,this},getInnerHtml:function(){return this.innerHtml||""},toString:function(){var e=this.getTagName(),t=this.buildAttrsStr();return t=t?" "+t:"",["<",e,t,">",this.getInnerHtml(),"</",e,">"].join("")},buildAttrsStr:function(){if(!this.attrs)return"";var e=this.getAttrs(),t=[];for(var r in e)e.hasOwnProperty(r)&&t.push(r+'="'+e[r]+'"');return t.join(" ")}}),e.AnchorTagBuilder=e.Util.extend(Object,{constructor:function(t){e.Util.assign(this,t)},build:function(t){var r=new e.HtmlTag({tagName:"a",attrs:this.createAttrs(t.getType(),t.getAnchorHref()),innerHtml:this.processAnchorText(t.getAnchorText())});return r},createAttrs:function(e,t){var r={href:t},n=this.createCssClass(e);return n&&(r["class"]=n),this.newWindow&&(r.target="_blank"),r},createCssClass:function(e){var t=this.className;return t?t+" "+t+"-"+e:""},processAnchorText:function(e){return e=this.doTruncate(e)},doTruncate:function(t){return e.Util.ellipsis(t,this.truncate||Number.POSITIVE_INFINITY)}}),e.htmlParser.HtmlParser=e.Util.extend(Object,{htmlRegex:function(){var e=/[0-9a-zA-Z][0-9a-zA-Z:]*/,t=/[^\s\0"'>\/=\x01-\x1F\x7F]+/,r=/(?:"[^"]*?"|'[^']*?'|[^'"=<>`\s]+)/,n=t.source+"(?:\\s*=\\s*"+r.source+")?";return new RegExp(["(?:","<(!DOCTYPE)","(?:","\\s+","(?:",n,"|",r.source+")",")*",">",")","|","(?:","<(/)?","("+e.source+")","(?:","\\s+",n,")*","\\s*/?",">",")"].join(""),"gi")}(),htmlCharacterEntitiesRegex:/(&nbsp;|&#160;|&lt;|&#60;|&gt;|&#62;|&quot;|&#34;|&#39;)/gi,parse:function(e){for(var t,r,n=this.htmlRegex,s=0,o=[];null!==(t=n.exec(e));){var i=t[0],l=t[1]||t[3],a=!!t[2],c=e.substring(s,t.index);c&&(r=this.parseTextAndEntityNodes(c),o.push.apply(o,r)),o.push(this.createElementNode(i,l,a)),s=t.index+i.length}if(s<e.length){var u=e.substring(s);u&&(r=this.parseTextAndEntityNodes(u),o.push.apply(o,r))}return o},parseTextAndEntityNodes:function(t){for(var r=[],n=e.Util.splitAndCapture(t,this.htmlCharacterEntitiesRegex),s=0,o=n.length;o>s;s+=2){var i=n[s],l=n[s+1];i&&r.push(this.createTextNode(i)),l&&r.push(this.createEntityNode(l))}return r},createElementNode:function(t,r,n){return new e.htmlParser.ElementNode({text:t,tagName:r.toLowerCase(),closing:n})},createEntityNode:function(t){return new e.htmlParser.EntityNode({text:t})},createTextNode:function(t){return new e.htmlParser.TextNode({text:t})}}),e.htmlParser.HtmlNode=e.Util.extend(Object,{text:"",constructor:function(t){e.Util.assign(this,t)},getType:e.Util.abstractMethod,getText:function(){return this.text}}),e.htmlParser.ElementNode=e.Util.extend(e.htmlParser.HtmlNode,{tagName:"",closing:!1,getType:function(){return"element"},getTagName:function(){return this.tagName},isClosing:function(){return this.closing}}),e.htmlParser.EntityNode=e.Util.extend(e.htmlParser.HtmlNode,{getType:function(){return"entity"}}),e.htmlParser.TextNode=e.Util.extend(e.htmlParser.HtmlNode,{getType:function(){return"text"}}),e.matchParser.MatchParser=e.Util.extend(Object,{urls:!0,email:!0,twitter:!0,stripPrefix:!0,matcherRegex:function(){var e=/(^|[^\w])@(\w{1,15})/,t=/(?:[\-;:&=\+\$,\w\.]+@)/,r=/(?:[A-Za-z][-.+A-Za-z0-9]+:(?![A-Za-z][-.+A-Za-z0-9]+:\/\/)(?!\d+\/?)(?:\/\/)?)/,n=/(?:www\.)/,s=/[A-Za-z0-9\.\-]*[A-Za-z0-9\-]/,o=/\.(?:international|construction|contractors|enterprises|photography|productions|foundation|immobilien|industries|management|properties|technology|christmas|community|directory|education|equipment|institute|marketing|solutions|vacations|bargains|boutique|builders|catering|cleaning|clothing|computer|democrat|diamonds|graphics|holdings|lighting|partners|plumbing|supplies|training|ventures|academy|careers|company|cruises|domains|exposed|flights|florist|gallery|guitars|holiday|kitchen|neustar|okinawa|recipes|rentals|reviews|shiksha|singles|support|systems|agency|berlin|camera|center|coffee|condos|dating|estate|events|expert|futbol|kaufen|luxury|maison|monash|museum|nagoya|photos|repair|report|social|supply|tattoo|tienda|travel|viajes|villas|vision|voting|voyage|actor|build|cards|cheap|codes|dance|email|glass|house|mango|ninja|parts|photo|shoes|solar|today|tokyo|tools|watch|works|aero|arpa|asia|best|bike|blue|buzz|camp|club|cool|coop|farm|fish|gift|guru|info|jobs|kiwi|kred|land|limo|link|menu|mobi|moda|name|pics|pink|post|qpon|rich|ruhr|sexy|tips|vote|voto|wang|wien|wiki|zone|bar|bid|biz|cab|cat|ceo|com|edu|gov|int|kim|mil|net|onl|org|pro|pub|red|tel|uno|wed|xxx|xyz|ac|ad|ae|af|ag|ai|al|am|an|ao|aq|ar|as|at|au|aw|ax|az|ba|bb|bd|be|bf|bg|bh|bi|bj|bm|bn|bo|br|bs|bt|bv|bw|by|bz|ca|cc|cd|cf|cg|ch|ci|ck|cl|cm|cn|co|cr|cu|cv|cw|cx|cy|cz|de|dj|dk|dm|do|dz|ec|ee|eg|er|es|et|eu|fi|fj|fk|fm|fo|fr|ga|gb|gd|ge|gf|gg|gh|gi|gl|gm|gn|gp|gq|gr|gs|gt|gu|gw|gy|hk|hm|hn|hr|ht|hu|id|ie|il|im|in|io|iq|ir|is|it|je|jm|jo|jp|ke|kg|kh|ki|km|kn|kp|kr|kw|ky|kz|la|lb|lc|li|lk|lr|ls|lt|lu|lv|ly|ma|mc|md|me|mg|mh|mk|ml|mm|mn|mo|mp|mq|mr|ms|mt|mu|mv|mw|mx|my|mz|na|nc|ne|nf|ng|ni|nl|no|np|nr|nu|nz|om|pa|pe|pf|pg|ph|pk|pl|pm|pn|pr|ps|pt|pw|py|qa|re|ro|rs|ru|rw|sa|sb|sc|sd|se|sg|sh|si|sj|sk|sl|sm|sn|so|sr|st|su|sv|sx|sy|sz|tc|td|tf|tg|th|tj|tk|tl|tm|tn|to|tp|tr|tt|tv|tw|tz|ua|ug|uk|us|uy|uz|va|vc|ve|vg|vi|vn|vu|wf|ws|ye|yt|za|zm|zw)\b/,i=/[\-A-Za-z0-9+&@#\/%=~_()|'$*\[\]?!:,.;]*[\-A-Za-z0-9+&@#\/%=~_()|'$*\[\]]/;return new RegExp(["(",e.source,")","|","(",t.source,s.source,o.source,")","|","(","(?:","(",r.source,s.source,")","|","(?:","(.?//)?",n.source,s.source,")","|","(?:","(.?//)?",s.source,o.source,")",")","(?:"+i.source+")?",")"].join(""),"gi")}(),charBeforeProtocolRelMatchRegex:/^(.)?\/\//,constructor:function(t){e.Util.assign(this,t),this.matchValidator=new e.MatchValidator},replace:function(e,t,r){var n=this;return e.replace(this.matcherRegex,function(e,s,o,i,l,a,c,u,p){var h=n.processCandidateMatch(e,s,o,i,l,a,c,u,p);if(h){var f=t.call(r,h.match);return h.prefixStr+f+h.suffixStr}return e})},processCandidateMatch:function(t,r,n,s,o,i,l,a,c){var u,p=a||c,h="",f="";if(r&&!this.twitter||o&&!this.email||i&&!this.urls||!this.matchValidator.isValidMatch(i,l,p))return null;if(this.matchHasUnbalancedClosingParen(t)&&(t=t.substr(0,t.length-1),f=")"),o)u=new e.match.Email({matchedText:t,email:o});else if(r)n&&(h=n,t=t.slice(1)),u=new e.match.Twitter({matchedText:t,twitterHandle:s});else{if(p){var d=p.match(this.charBeforeProtocolRelMatchRegex)[1]||"";d&&(h=d,t=t.slice(1))}u=new e.match.Url({matchedText:t,url:t,protocolUrlMatch:!!l,protocolRelativeMatch:!!p,stripPrefix:this.stripPrefix})}return{prefixStr:h,suffixStr:f,match:u}},matchHasUnbalancedClosingParen:function(e){var t=e.charAt(e.length-1);if(")"===t){var r=e.match(/\(/g),n=e.match(/\)/g),s=r&&r.length||0,o=n&&n.length||0;if(o>s)return!0}return!1}}),e.MatchValidator=e.Util.extend(Object,{invalidProtocolRelMatchRegex:/^[\w]\/\//,hasFullProtocolRegex:/^[A-Za-z][-.+A-Za-z0-9]+:\/\//,uriSchemeRegex:/^[A-Za-z][-.+A-Za-z0-9]+:/,hasWordCharAfterProtocolRegex:/:[^\s]*?[A-Za-z]/,isValidMatch:function(e,t,r){return t&&!this.isValidUriScheme(t)||this.urlMatchDoesNotHaveProtocolOrDot(e,t)||this.urlMatchDoesNotHaveAtLeastOneWordChar(e,t)||this.isInvalidProtocolRelativeMatch(r)?!1:!0},isValidUriScheme:function(e){var t=e.match(this.uriSchemeRegex)[0].toLowerCase();return"javascript:"!==t&&"vbscript:"!==t},urlMatchDoesNotHaveProtocolOrDot:function(e,t){return!(!e||t&&this.hasFullProtocolRegex.test(t)||-1!==e.indexOf("."))},urlMatchDoesNotHaveAtLeastOneWordChar:function(e,t){return e&&t?!this.hasWordCharAfterProtocolRegex.test(e):!1},isInvalidProtocolRelativeMatch:function(e){return!!e&&this.invalidProtocolRelMatchRegex.test(e)}}),e.match.Match=e.Util.extend(Object,{constructor:function(t){e.Util.assign(this,t)},getType:e.Util.abstractMethod,getMatchedText:function(){return this.matchedText},getAnchorHref:e.Util.abstractMethod,getAnchorText:e.Util.abstractMethod}),e.match.Email=e.Util.extend(e.match.Match,{getType:function(){return"email"},getEmail:function(){return this.email},getAnchorHref:function(){return"mailto:"+this.email},getAnchorText:function(){return this.email}}),e.match.Twitter=e.Util.extend(e.match.Match,{getType:function(){return"twitter"},getTwitterHandle:function(){return this.twitterHandle},getAnchorHref:function(){return"https://twitter.com/"+this.twitterHandle},getAnchorText:function(){return"@"+this.twitterHandle}}),e.match.Url=e.Util.extend(e.match.Match,{urlPrefixRegex:/^(https?:\/\/)?(www\.)?/i,protocolRelativeRegex:/^\/\//,protocolPrepended:!1,getType:function(){return"url"},getUrl:function(){var e=this.url;return this.protocolRelativeMatch||this.protocolUrlMatch||this.protocolPrepended||(e=this.url="http://"+e,this.protocolPrepended=!0),e},getAnchorHref:function(){var e=this.getUrl();return e.replace(/&amp;/g,"&")},getAnchorText:function(){var e=this.getUrl();return this.protocolRelativeMatch&&(e=this.stripProtocolRelativePrefix(e)),this.stripPrefix&&(e=this.stripUrlPrefix(e)),e=this.removeTrailingSlash(e)},stripUrlPrefix:function(e){return e.replace(this.urlPrefixRegex,"")},stripProtocolRelativePrefix:function(e){return e.replace(this.protocolRelativeRegex,"")},removeTrailingSlash:function(e){return"/"===e.charAt(e.length-1)&&(e=e.slice(0,-1)),e}}),e})},{}],"/":[function(e,t){"use strict";t.exports=e("./lib/")},{"./lib/":14}]},{},[])("/")});
\ No newline at end of file
docs/js/xml.js deleted
-394
@@ -1,394 +0,0 @@
1 -// CodeMirror, copyright (c) by Marijn Haverbeke and others
2 -// Distributed under an MIT license: http://codemirror.net/LICENSE
3 -
4 -(function(mod) {
5 - if (typeof exports == "object" && typeof module == "object") // CommonJS
6 - mod(require("../../lib/codemirror"));
7 - else if (typeof define == "function" && define.amd) // AMD
8 - define(["../../lib/codemirror"], mod);
9 - else // Plain browser env
10 - mod(CodeMirror);
11 -})(function(CodeMirror) {
12 -"use strict";
13 -
14 -var htmlConfig = {
15 - autoSelfClosers: {'area': true, 'base': true, 'br': true, 'col': true, 'command': true,
16 - 'embed': true, 'frame': true, 'hr': true, 'img': true, 'input': true,
17 - 'keygen': true, 'link': true, 'meta': true, 'param': true, 'source': true,
18 - 'track': true, 'wbr': true, 'menuitem': true},
19 - implicitlyClosed: {'dd': true, 'li': true, 'optgroup': true, 'option': true, 'p': true,
20 - 'rp': true, 'rt': true, 'tbody': true, 'td': true, 'tfoot': true,
21 - 'th': true, 'tr': true},
22 - contextGrabbers: {
23 - 'dd': {'dd': true, 'dt': true},
24 - 'dt': {'dd': true, 'dt': true},
25 - 'li': {'li': true},
26 - 'option': {'option': true, 'optgroup': true},
27 - 'optgroup': {'optgroup': true},
28 - 'p': {'address': true, 'article': true, 'aside': true, 'blockquote': true, 'dir': true,
29 - 'div': true, 'dl': true, 'fieldset': true, 'footer': true, 'form': true,
30 - 'h1': true, 'h2': true, 'h3': true, 'h4': true, 'h5': true, 'h6': true,
31 - 'header': true, 'hgroup': true, 'hr': true, 'menu': true, 'nav': true, 'ol': true,
32 - 'p': true, 'pre': true, 'section': true, 'table': true, 'ul': true},
33 - 'rp': {'rp': true, 'rt': true},
34 - 'rt': {'rp': true, 'rt': true},
35 - 'tbody': {'tbody': true, 'tfoot': true},
36 - 'td': {'td': true, 'th': true},
37 - 'tfoot': {'tbody': true},
38 - 'th': {'td': true, 'th': true},
39 - 'thead': {'tbody': true, 'tfoot': true},
40 - 'tr': {'tr': true}
41 - },
42 - doNotIndent: {"pre": true},
43 - allowUnquoted: true,
44 - allowMissing: true,
45 - caseFold: true
46 -}
47 -
48 -var xmlConfig = {
49 - autoSelfClosers: {},
50 - implicitlyClosed: {},
51 - contextGrabbers: {},
52 - doNotIndent: {},
53 - allowUnquoted: false,
54 - allowMissing: false,
55 - caseFold: false
56 -}
57 -
58 -CodeMirror.defineMode("xml", function(editorConf, config_) {
59 - var indentUnit = editorConf.indentUnit
60 - var config = {}
61 - var defaults = config_.htmlMode ? htmlConfig : xmlConfig
62 - for (var prop in defaults) config[prop] = defaults[prop]
63 - for (var prop in config_) config[prop] = config_[prop]
64 -
65 - // Return variables for tokenizers
66 - var type, setStyle;
67 -
68 - function inText(stream, state) {
69 - function chain(parser) {
70 - state.tokenize = parser;
71 - return parser(stream, state);
72 - }
73 -
74 - var ch = stream.next();
75 - if (ch == "<") {
76 - if (stream.eat("!")) {
77 - if (stream.eat("[")) {
78 - if (stream.match("CDATA[")) return chain(inBlock("atom", "]]>"));
79 - else return null;
80 - } else if (stream.match("--")) {
81 - return chain(inBlock("comment", "-->"));
82 - } else if (stream.match("DOCTYPE", true, true)) {
83 - stream.eatWhile(/[\w\._\-]/);
84 - return chain(doctype(1));
85 - } else {
86 - return null;
87 - }
88 - } else if (stream.eat("?")) {
89 - stream.eatWhile(/[\w\._\-]/);
90 - state.tokenize = inBlock("meta", "?>");
91 - return "meta";
92 - } else {
93 - type = stream.eat("/") ? "closeTag" : "openTag";
94 - state.tokenize = inTag;
95 - return "tag bracket";
96 - }
97 - } else if (ch == "&") {
98 - var ok;
99 - if (stream.eat("#")) {
100 - if (stream.eat("x")) {
101 - ok = stream.eatWhile(/[a-fA-F\d]/) && stream.eat(";");
102 - } else {
103 - ok = stream.eatWhile(/[\d]/) && stream.eat(";");
104 - }
105 - } else {
106 - ok = stream.eatWhile(/[\w\.\-:]/) && stream.eat(";");
107 - }
108 - return ok ? "atom" : "error";
109 - } else {
110 - stream.eatWhile(/[^&<]/);
111 - return null;
112 - }
113 - }
114 - inText.isInText = true;
115 -
116 - function inTag(stream, state) {
117 - var ch = stream.next();
118 - if (ch == ">" || (ch == "/" && stream.eat(">"))) {
119 - state.tokenize = inText;
120 - type = ch == ">" ? "endTag" : "selfcloseTag";
121 - return "tag bracket";
122 - } else if (ch == "=") {
123 - type = "equals";
124 - return null;
125 - } else if (ch == "<") {
126 - state.tokenize = inText;
127 - state.state = baseState;
128 - state.tagName = state.tagStart = null;
129 - var next = state.tokenize(stream, state);
130 - return next ? next + " tag error" : "tag error";
131 - } else if (/[\'\"]/.test(ch)) {
132 - state.tokenize = inAttribute(ch);
133 - state.stringStartCol = stream.column();
134 - return state.tokenize(stream, state);
135 - } else {
136 - stream.match(/^[^\s\u00a0=<>\"\']*[^\s\u00a0=<>\"\'\/]/);
137 - return "word";
138 - }
139 - }
140 -
141 - function inAttribute(quote) {
142 - var closure = function(stream, state) {
143 - while (!stream.eol()) {
144 - if (stream.next() == quote) {
145 - state.tokenize = inTag;
146 - break;
147 - }
148 - }
149 - return "string";
150 - };
151 - closure.isInAttribute = true;
152 - return closure;
153 - }
154 -
155 - function inBlock(style, terminator) {
156 - return function(stream, state) {
157 - while (!stream.eol()) {
158 - if (stream.match(terminator)) {
159 - state.tokenize = inText;
160 - break;
161 - }
162 - stream.next();
163 - }
164 - return style;
165 - };
166 - }
167 - function doctype(depth) {
168 - return function(stream, state) {
169 - var ch;
170 - while ((ch = stream.next()) != null) {
171 - if (ch == "<") {
172 - state.tokenize = doctype(depth + 1);
173 - return state.tokenize(stream, state);
174 - } else if (ch == ">") {
175 - if (depth == 1) {
176 - state.tokenize = inText;
177 - break;
178 - } else {
179 - state.tokenize = doctype(depth - 1);
180 - return state.tokenize(stream, state);
181 - }
182 - }
183 - }
184 - return "meta";
185 - };
186 - }
187 -
188 - function Context(state, tagName, startOfLine) {
189 - this.prev = state.context;
190 - this.tagName = tagName;
191 - this.indent = state.indented;
192 - this.startOfLine = startOfLine;
193 - if (config.doNotIndent.hasOwnProperty(tagName) || (state.context && state.context.noIndent))
194 - this.noIndent = true;
195 - }
196 - function popContext(state) {
197 - if (state.context) state.context = state.context.prev;
198 - }
199 - function maybePopContext(state, nextTagName) {
200 - var parentTagName;
201 - while (true) {
202 - if (!state.context) {
203 - return;
204 - }
205 - parentTagName = state.context.tagName;
206 - if (!config.contextGrabbers.hasOwnProperty(parentTagName) ||
207 - !config.contextGrabbers[parentTagName].hasOwnProperty(nextTagName)) {
208 - return;
209 - }
210 - popContext(state);
211 - }
212 - }
213 -
214 - function baseState(type, stream, state) {
215 - if (type == "openTag") {
216 - state.tagStart = stream.column();
217 - return tagNameState;
218 - } else if (type == "closeTag") {
219 - return closeTagNameState;
220 - } else {
221 - return baseState;
222 - }
223 - }
224 - function tagNameState(type, stream, state) {
225 - if (type == "word") {
226 - state.tagName = stream.current();
227 - setStyle = "tag";
228 - return attrState;
229 - } else {
230 - setStyle = "error";
231 - return tagNameState;
232 - }
233 - }
234 - function closeTagNameState(type, stream, state) {
235 - if (type == "word") {
236 - var tagName = stream.current();
237 - if (state.context && state.context.tagName != tagName &&
238 - config.implicitlyClosed.hasOwnProperty(state.context.tagName))
239 - popContext(state);
240 - if ((state.context && state.context.tagName == tagName) || config.matchClosing === false) {
241 - setStyle = "tag";
242 - return closeState;
243 - } else {
244 - setStyle = "tag error";
245 - return closeStateErr;
246 - }
247 - } else {
248 - setStyle = "error";
249 - return closeStateErr;
250 - }
251 - }
252 -
253 - function closeState(type, _stream, state) {
254 - if (type != "endTag") {
255 - setStyle = "error";
256 - return closeState;
257 - }
258 - popContext(state);
259 - return baseState;
260 - }
261 - function closeStateErr(type, stream, state) {
262 - setStyle = "error";
263 - return closeState(type, stream, state);
264 - }
265 -
266 - function attrState(type, _stream, state) {
267 - if (type == "word") {
268 - setStyle = "attribute";
269 - return attrEqState;
270 - } else if (type == "endTag" || type == "selfcloseTag") {
271 - var tagName = state.tagName, tagStart = state.tagStart;
272 - state.tagName = state.tagStart = null;
273 - if (type == "selfcloseTag" ||
274 - config.autoSelfClosers.hasOwnProperty(tagName)) {
275 - maybePopContext(state, tagName);
276 - } else {
277 - maybePopContext(state, tagName);
278 - state.context = new Context(state, tagName, tagStart == state.indented);
279 - }
280 - return baseState;
281 - }
282 - setStyle = "error";
283 - return attrState;
284 - }
285 - function attrEqState(type, stream, state) {
286 - if (type == "equals") return attrValueState;
287 - if (!config.allowMissing) setStyle = "error";
288 - return attrState(type, stream, state);
289 - }
290 - function attrValueState(type, stream, state) {
291 - if (type == "string") return attrContinuedState;
292 - if (type == "word" && config.allowUnquoted) {setStyle = "string"; return attrState;}
293 - setStyle = "error";
294 - return attrState(type, stream, state);
295 - }
296 - function attrContinuedState(type, stream, state) {
297 - if (type == "string") return attrContinuedState;
298 - return attrState(type, stream, state);
299 - }
300 -
301 - return {
302 - startState: function(baseIndent) {
303 - var state = {tokenize: inText,
304 - state: baseState,
305 - indented: baseIndent || 0,
306 - tagName: null, tagStart: null,
307 - context: null}
308 - if (baseIndent != null) state.baseIndent = baseIndent
309 - return state
310 - },
311 -
312 - token: function(stream, state) {
313 - if (!state.tagName && stream.sol())
314 - state.indented = stream.indentation();
315 -
316 - if (stream.eatSpace()) return null;
317 - type = null;
318 - var style = state.tokenize(stream, state);
319 - if ((style || type) && style != "comment") {
320 - setStyle = null;
321 - state.state = state.state(type || style, stream, state);
322 - if (setStyle)
323 - style = setStyle == "error" ? style + " error" : setStyle;
324 - }
325 - return style;
326 - },
327 -
328 - indent: function(state, textAfter, fullLine) {
329 - var context = state.context;
330 - // Indent multi-line strings (e.g. css).
331 - if (state.tokenize.isInAttribute) {
332 - if (state.tagStart == state.indented)
333 - return state.stringStartCol + 1;
334 - else
335 - return state.indented + indentUnit;
336 - }
337 - if (context && context.noIndent) return CodeMirror.Pass;
338 - if (state.tokenize != inTag && state.tokenize != inText)
339 - return fullLine ? fullLine.match(/^(\s*)/)[0].length : 0;
340 - // Indent the starts of attribute names.
341 - if (state.tagName) {
342 - if (config.multilineTagIndentPastTag !== false)
343 - return state.tagStart + state.tagName.length + 2;
344 - else
345 - return state.tagStart + indentUnit * (config.multilineTagIndentFactor || 1);
346 - }
347 - if (config.alignCDATA && /<!\[CDATA\[/.test(textAfter)) return 0;
348 - var tagAfter = textAfter && /^<(\/)?([\w_:\.-]*)/.exec(textAfter);
349 - if (tagAfter && tagAfter[1]) { // Closing tag spotted
350 - while (context) {
351 - if (context.tagName == tagAfter[2]) {
352 - context = context.prev;
353 - break;
354 - } else if (config.implicitlyClosed.hasOwnProperty(context.tagName)) {
355 - context = context.prev;
356 - } else {
357 - break;
358 - }
359 - }
360 - } else if (tagAfter) { // Opening tag spotted
361 - while (context) {
362 - var grabbers = config.contextGrabbers[context.tagName];
363 - if (grabbers && grabbers.hasOwnProperty(tagAfter[2]))
364 - context = context.prev;
365 - else
366 - break;
367 - }
368 - }
369 - while (context && context.prev && !context.startOfLine)
370 - context = context.prev;
371 - if (context) return context.indent + indentUnit;
372 - else return state.baseIndent || 0;
373 - },
374 -
375 - electricInput: /<\/[\s\w:]+>$/,
376 - blockCommentStart: "<!--",
377 - blockCommentEnd: "-->",
378 -
379 - configuration: config.htmlMode ? "html" : "xml",
380 - helperType: config.htmlMode ? "html" : "xml",
381 -
382 - skipAttribute: function(state) {
383 - if (state.state == attrValueState)
384 - state.state = attrState
385 - }
386 - };
387 -});
388 -
389 -CodeMirror.defineMIME("text/xml", "xml");
390 -CodeMirror.defineMIME("application/xml", "xml");
391 -if (!CodeMirror.mimeModes.hasOwnProperty("text/html"))
392 - CodeMirror.defineMIME("text/html", {name: "xml", htmlMode: true});
393 -
394 -});