-
-
Save smacker/833bfbbf187727a1dbf0adc72777136a to your computer and use it in GitHub Desktop.
This file has been truncated, but you can view the full file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/******/ (function(modules) { // webpackBootstrap | |
/******/ // The module cache | |
/******/ var installedModules = {}; | |
/******/ | |
/******/ // The require function | |
/******/ function __webpack_require__(moduleId) { | |
/******/ | |
/******/ // Check if module is in cache | |
/******/ if(installedModules[moduleId]) { | |
/******/ return installedModules[moduleId].exports; | |
/******/ } | |
/******/ // Create a new module (and put it into the cache) | |
/******/ var module = installedModules[moduleId] = { | |
/******/ i: moduleId, | |
/******/ l: false, | |
/******/ exports: {} | |
/******/ }; | |
/******/ | |
/******/ // Execute the module function | |
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); | |
/******/ | |
/******/ // Flag the module as loaded | |
/******/ module.l = true; | |
/******/ | |
/******/ // Return the exports of the module | |
/******/ return module.exports; | |
/******/ } | |
/******/ | |
/******/ | |
/******/ // expose the modules object (__webpack_modules__) | |
/******/ __webpack_require__.m = modules; | |
/******/ | |
/******/ // expose the module cache | |
/******/ __webpack_require__.c = installedModules; | |
/******/ | |
/******/ // identity function for calling harmony imports with the correct context | |
/******/ __webpack_require__.i = function(value) { return value; }; | |
/******/ | |
/******/ // define getter function for harmony exports | |
/******/ __webpack_require__.d = function(exports, name, getter) { | |
/******/ if(!__webpack_require__.o(exports, name)) { | |
/******/ Object.defineProperty(exports, name, { | |
/******/ configurable: false, | |
/******/ enumerable: true, | |
/******/ get: getter | |
/******/ }); | |
/******/ } | |
/******/ }; | |
/******/ | |
/******/ // getDefaultExport function for compatibility with non-harmony modules | |
/******/ __webpack_require__.n = function(module) { | |
/******/ var getter = module && module.__esModule ? | |
/******/ function getDefault() { return module['default']; } : | |
/******/ function getModuleExports() { return module; }; | |
/******/ __webpack_require__.d(getter, 'a', getter); | |
/******/ return getter; | |
/******/ }; | |
/******/ | |
/******/ // Object.prototype.hasOwnProperty.call | |
/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; | |
/******/ | |
/******/ // __webpack_public_path__ | |
/******/ __webpack_require__.p = ""; | |
/******/ | |
/******/ // Load entry module and return exports | |
/******/ return __webpack_require__(__webpack_require__.s = 407); | |
/******/ }) | |
/************************************************************************/ | |
/******/ ([ | |
/* 0 */ | |
/***/ (function(module, exports) { | |
// shim for using process in browser | |
var process = module.exports = {}; | |
// cached from whatever global is present so that test runners that stub it | |
// don't break things. But we need to wrap it in a try catch in case it is | |
// wrapped in strict mode code which doesn't define any globals. It's inside a | |
// function because try/catches deoptimize in certain engines. | |
var cachedSetTimeout; | |
var cachedClearTimeout; | |
function defaultSetTimout() { | |
throw new Error('setTimeout has not been defined'); | |
} | |
function defaultClearTimeout() { | |
throw new Error('clearTimeout has not been defined'); | |
} | |
(function () { | |
try { | |
if (typeof setTimeout === 'function') { | |
cachedSetTimeout = setTimeout; | |
} else { | |
cachedSetTimeout = defaultSetTimout; | |
} | |
} catch (e) { | |
cachedSetTimeout = defaultSetTimout; | |
} | |
try { | |
if (typeof clearTimeout === 'function') { | |
cachedClearTimeout = clearTimeout; | |
} else { | |
cachedClearTimeout = defaultClearTimeout; | |
} | |
} catch (e) { | |
cachedClearTimeout = defaultClearTimeout; | |
} | |
})(); | |
function runTimeout(fun) { | |
if (cachedSetTimeout === setTimeout) { | |
//normal enviroments in sane situations | |
return setTimeout(fun, 0); | |
} | |
// if setTimeout wasn't available but was latter defined | |
if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) { | |
cachedSetTimeout = setTimeout; | |
return setTimeout(fun, 0); | |
} | |
try { | |
// when when somebody has screwed with setTimeout but no I.E. maddness | |
return cachedSetTimeout(fun, 0); | |
} catch (e) { | |
try { | |
// When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally | |
return cachedSetTimeout.call(null, fun, 0); | |
} catch (e) { | |
// same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error | |
return cachedSetTimeout.call(this, fun, 0); | |
} | |
} | |
} | |
function runClearTimeout(marker) { | |
if (cachedClearTimeout === clearTimeout) { | |
//normal enviroments in sane situations | |
return clearTimeout(marker); | |
} | |
// if clearTimeout wasn't available but was latter defined | |
if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) { | |
cachedClearTimeout = clearTimeout; | |
return clearTimeout(marker); | |
} | |
try { | |
// when when somebody has screwed with setTimeout but no I.E. maddness | |
return cachedClearTimeout(marker); | |
} catch (e) { | |
try { | |
// When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally | |
return cachedClearTimeout.call(null, marker); | |
} catch (e) { | |
// same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error. | |
// Some versions of I.E. have different rules for clearTimeout vs setTimeout | |
return cachedClearTimeout.call(this, marker); | |
} | |
} | |
} | |
var queue = []; | |
var draining = false; | |
var currentQueue; | |
var queueIndex = -1; | |
function cleanUpNextTick() { | |
if (!draining || !currentQueue) { | |
return; | |
} | |
draining = false; | |
if (currentQueue.length) { | |
queue = currentQueue.concat(queue); | |
} else { | |
queueIndex = -1; | |
} | |
if (queue.length) { | |
drainQueue(); | |
} | |
} | |
function drainQueue() { | |
if (draining) { | |
return; | |
} | |
var timeout = runTimeout(cleanUpNextTick); | |
draining = true; | |
var len = queue.length; | |
while (len) { | |
currentQueue = queue; | |
queue = []; | |
while (++queueIndex < len) { | |
if (currentQueue) { | |
currentQueue[queueIndex].run(); | |
} | |
} | |
queueIndex = -1; | |
len = queue.length; | |
} | |
currentQueue = null; | |
draining = false; | |
runClearTimeout(timeout); | |
} | |
process.nextTick = function (fun) { | |
var args = new Array(arguments.length - 1); | |
if (arguments.length > 1) { | |
for (var i = 1; i < arguments.length; i++) { | |
args[i - 1] = arguments[i]; | |
} | |
} | |
queue.push(new Item(fun, args)); | |
if (queue.length === 1 && !draining) { | |
runTimeout(drainQueue); | |
} | |
}; | |
// v8 likes predictible objects | |
function Item(fun, array) { | |
this.fun = fun; | |
this.array = array; | |
} | |
Item.prototype.run = function () { | |
this.fun.apply(null, this.array); | |
}; | |
process.title = 'browser'; | |
process.browser = true; | |
process.env = {}; | |
process.argv = []; | |
process.version = ''; // empty string to avoid regexp issues | |
process.versions = {}; | |
function noop() {} | |
process.on = noop; | |
process.addListener = noop; | |
process.once = noop; | |
process.off = noop; | |
process.removeListener = noop; | |
process.removeAllListeners = noop; | |
process.emit = noop; | |
process.prependListener = noop; | |
process.prependOnceListener = noop; | |
process.listeners = function (name) { | |
return []; | |
}; | |
process.binding = function (name) { | |
throw new Error('process.binding is not supported'); | |
}; | |
process.cwd = function () { | |
return '/'; | |
}; | |
process.chdir = function (dir) { | |
throw new Error('process.chdir is not supported'); | |
}; | |
process.umask = function () { | |
return 0; | |
}; | |
/***/ }), | |
/* 1 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
"use strict"; | |
/* WEBPACK VAR INJECTION */(function(process) {/** | |
* Copyright (c) 2013-present, Facebook, Inc. | |
* All rights reserved. | |
* | |
* This source code is licensed under the BSD-style license found in the | |
* LICENSE file in the root directory of this source tree. An additional grant | |
* of patent rights can be found in the PATENTS file in the same directory. | |
* | |
*/ | |
/** | |
* Use invariant() to assert state which your program assumes to be true. | |
* | |
* Provide sprintf-style format (only %s is supported) and arguments | |
* to provide information about what broke and what you were | |
* expecting. | |
* | |
* The invariant message will be stripped in production, but the invariant | |
* will remain to ensure logic does not differ in production. | |
*/ | |
var validateFormat = function validateFormat(format) {}; | |
if (process.env.NODE_ENV !== 'production') { | |
validateFormat = function validateFormat(format) { | |
if (format === undefined) { | |
throw new Error('invariant requires an error message argument'); | |
} | |
}; | |
} | |
function invariant(condition, format, a, b, c, d, e, f) { | |
validateFormat(format); | |
if (!condition) { | |
var error; | |
if (format === undefined) { | |
error = new Error('Minified exception occurred; use the non-minified dev environment ' + 'for the full error message and additional helpful warnings.'); | |
} else { | |
var args = [a, b, c, d, e, f]; | |
var argIndex = 0; | |
error = new Error(format.replace(/%s/g, function () { | |
return args[argIndex++]; | |
})); | |
error.name = 'Invariant Violation'; | |
} | |
error.framesToPop = 1; // we don't care about invariant's own frame | |
throw error; | |
} | |
} | |
module.exports = invariant; | |
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0))) | |
/***/ }), | |
/* 2 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
"use strict"; | |
/* WEBPACK VAR INJECTION */(function(process) {/** | |
* Copyright 2014-2015, Facebook, Inc. | |
* All rights reserved. | |
* | |
* This source code is licensed under the BSD-style license found in the | |
* LICENSE file in the root directory of this source tree. An additional grant | |
* of patent rights can be found in the PATENTS file in the same directory. | |
* | |
*/ | |
var emptyFunction = __webpack_require__(8); | |
/** | |
* Similar to invariant but only logs a warning if the condition is not met. | |
* This can be used to log issues in development environments in critical | |
* paths. Removing the logging code for production environments will keep the | |
* same logic and follow the same code paths. | |
*/ | |
var warning = emptyFunction; | |
if (process.env.NODE_ENV !== 'production') { | |
var printWarning = function printWarning(format) { | |
for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { | |
args[_key - 1] = arguments[_key]; | |
} | |
var argIndex = 0; | |
var message = 'Warning: ' + format.replace(/%s/g, function () { | |
return args[argIndex++]; | |
}); | |
if (typeof console !== 'undefined') { | |
console.error(message); | |
} | |
try { | |
// --- Welcome to debugging React --- | |
// This error was thrown as a convenience so that you can use this stack | |
// to find the callsite that caused this warning to fire. | |
throw new Error(message); | |
} catch (x) {} | |
}; | |
warning = function warning(condition, format) { | |
if (format === undefined) { | |
throw new Error('`warning(condition, format, ...args)` requires a warning ' + 'message argument'); | |
} | |
if (format.indexOf('Failed Composite propType: ') === 0) { | |
return; // Ignore CompositeComponent proptype check. | |
} | |
if (!condition) { | |
for (var _len2 = arguments.length, args = Array(_len2 > 2 ? _len2 - 2 : 0), _key2 = 2; _key2 < _len2; _key2++) { | |
args[_key2 - 2] = arguments[_key2]; | |
} | |
printWarning.apply(undefined, [format].concat(args)); | |
} | |
}; | |
} | |
module.exports = warning; | |
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0))) | |
/***/ }), | |
/* 3 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
"use strict"; | |
/** | |
* Copyright (c) 2013-present, Facebook, Inc. | |
* All rights reserved. | |
* | |
* This source code is licensed under the BSD-style license found in the | |
* LICENSE file in the root directory of this source tree. An additional grant | |
* of patent rights can be found in the PATENTS file in the same directory. | |
* | |
* | |
*/ | |
/** | |
* WARNING: DO NOT manually require this module. | |
* This is a replacement for `invariant(...)` used by the error code system | |
* and will _only_ be required by the corresponding babel pass. | |
* It always throws. | |
*/ | |
function reactProdInvariant(code) { | |
var argCount = arguments.length - 1; | |
var message = 'Minified React error #' + code + '; visit ' + 'http://facebook.github.io/react/docs/error-decoder.html?invariant=' + code; | |
for (var argIdx = 0; argIdx < argCount; argIdx++) { | |
message += '&args[]=' + encodeURIComponent(arguments[argIdx + 1]); | |
} | |
message += ' for the full message or use the non-minified dev environment' + ' for full errors and additional helpful warnings.'; | |
var error = new Error(message); | |
error.name = 'Invariant Violation'; | |
error.framesToPop = 1; // we don't care about reactProdInvariant's own frame | |
throw error; | |
} | |
module.exports = reactProdInvariant; | |
/***/ }), | |
/* 4 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
"use strict"; | |
/* | |
object-assign | |
(c) Sindre Sorhus | |
@license MIT | |
*/ | |
/* eslint-disable no-unused-vars */ | |
var getOwnPropertySymbols = Object.getOwnPropertySymbols; | |
var hasOwnProperty = Object.prototype.hasOwnProperty; | |
var propIsEnumerable = Object.prototype.propertyIsEnumerable; | |
function toObject(val) { | |
if (val === null || val === undefined) { | |
throw new TypeError('Object.assign cannot be called with null or undefined'); | |
} | |
return Object(val); | |
} | |
function shouldUseNative() { | |
try { | |
if (!Object.assign) { | |
return false; | |
} | |
// Detect buggy property enumeration order in older V8 versions. | |
// https://bugs.chromium.org/p/v8/issues/detail?id=4118 | |
var test1 = new String('abc'); // eslint-disable-line no-new-wrappers | |
test1[5] = 'de'; | |
if (Object.getOwnPropertyNames(test1)[0] === '5') { | |
return false; | |
} | |
// https://bugs.chromium.org/p/v8/issues/detail?id=3056 | |
var test2 = {}; | |
for (var i = 0; i < 10; i++) { | |
test2['_' + String.fromCharCode(i)] = i; | |
} | |
var order2 = Object.getOwnPropertyNames(test2).map(function (n) { | |
return test2[n]; | |
}); | |
if (order2.join('') !== '0123456789') { | |
return false; | |
} | |
// https://bugs.chromium.org/p/v8/issues/detail?id=3056 | |
var test3 = {}; | |
'abcdefghijklmnopqrst'.split('').forEach(function (letter) { | |
test3[letter] = letter; | |
}); | |
if (Object.keys(Object.assign({}, test3)).join('') !== 'abcdefghijklmnopqrst') { | |
return false; | |
} | |
return true; | |
} catch (err) { | |
// We don't expect any of the above to throw, but better to be safe. | |
return false; | |
} | |
} | |
module.exports = shouldUseNative() ? Object.assign : function (target, source) { | |
var from; | |
var to = toObject(target); | |
var symbols; | |
for (var s = 1; s < arguments.length; s++) { | |
from = Object(arguments[s]); | |
for (var key in from) { | |
if (hasOwnProperty.call(from, key)) { | |
to[key] = from[key]; | |
} | |
} | |
if (getOwnPropertySymbols) { | |
symbols = getOwnPropertySymbols(from); | |
for (var i = 0; i < symbols.length; i++) { | |
if (propIsEnumerable.call(from, symbols[i])) { | |
to[symbols[i]] = from[symbols[i]]; | |
} | |
} | |
} | |
} | |
return to; | |
}; | |
/***/ }), | |
/* 5 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
"use strict"; | |
/* WEBPACK VAR INJECTION */(function(process) {/** | |
* Copyright 2013-present, Facebook, Inc. | |
* All rights reserved. | |
* | |
* This source code is licensed under the BSD-style license found in the | |
* LICENSE file in the root directory of this source tree. An additional grant | |
* of patent rights can be found in the PATENTS file in the same directory. | |
* | |
*/ | |
var _prodInvariant = __webpack_require__(3); | |
var DOMProperty = __webpack_require__(13); | |
var ReactDOMComponentFlags = __webpack_require__(65); | |
var invariant = __webpack_require__(1); | |
var ATTR_NAME = DOMProperty.ID_ATTRIBUTE_NAME; | |
var Flags = ReactDOMComponentFlags; | |
var internalInstanceKey = '__reactInternalInstance$' + Math.random().toString(36).slice(2); | |
/** | |
* Check if a given node should be cached. | |
*/ | |
function shouldPrecacheNode(node, nodeID) { | |
return node.nodeType === 1 && node.getAttribute(ATTR_NAME) === String(nodeID) || node.nodeType === 8 && node.nodeValue === ' react-text: ' + nodeID + ' ' || node.nodeType === 8 && node.nodeValue === ' react-empty: ' + nodeID + ' '; | |
} | |
/** | |
* Drill down (through composites and empty components) until we get a host or | |
* host text component. | |
* | |
* This is pretty polymorphic but unavoidable with the current structure we have | |
* for `_renderedChildren`. | |
*/ | |
function getRenderedHostOrTextFromComponent(component) { | |
var rendered; | |
while (rendered = component._renderedComponent) { | |
component = rendered; | |
} | |
return component; | |
} | |
/** | |
* Populate `_hostNode` on the rendered host/text component with the given | |
* DOM node. The passed `inst` can be a composite. | |
*/ | |
function precacheNode(inst, node) { | |
var hostInst = getRenderedHostOrTextFromComponent(inst); | |
hostInst._hostNode = node; | |
node[internalInstanceKey] = hostInst; | |
} | |
function uncacheNode(inst) { | |
var node = inst._hostNode; | |
if (node) { | |
delete node[internalInstanceKey]; | |
inst._hostNode = null; | |
} | |
} | |
/** | |
* Populate `_hostNode` on each child of `inst`, assuming that the children | |
* match up with the DOM (element) children of `node`. | |
* | |
* We cache entire levels at once to avoid an n^2 problem where we access the | |
* children of a node sequentially and have to walk from the start to our target | |
* node every time. | |
* | |
* Since we update `_renderedChildren` and the actual DOM at (slightly) | |
* different times, we could race here and see a newer `_renderedChildren` than | |
* the DOM nodes we see. To avoid this, ReactMultiChild calls | |
* `prepareToManageChildren` before we change `_renderedChildren`, at which | |
* time the container's child nodes are always cached (until it unmounts). | |
*/ | |
function precacheChildNodes(inst, node) { | |
if (inst._flags & Flags.hasCachedChildNodes) { | |
return; | |
} | |
var children = inst._renderedChildren; | |
var childNode = node.firstChild; | |
outer: for (var name in children) { | |
if (!children.hasOwnProperty(name)) { | |
continue; | |
} | |
var childInst = children[name]; | |
var childID = getRenderedHostOrTextFromComponent(childInst)._domID; | |
if (childID === 0) { | |
// We're currently unmounting this child in ReactMultiChild; skip it. | |
continue; | |
} | |
// We assume the child nodes are in the same order as the child instances. | |
for (; childNode !== null; childNode = childNode.nextSibling) { | |
if (shouldPrecacheNode(childNode, childID)) { | |
precacheNode(childInst, childNode); | |
continue outer; | |
} | |
} | |
// We reached the end of the DOM children without finding an ID match. | |
true ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Unable to find element with ID %s.', childID) : _prodInvariant('32', childID) : void 0; | |
} | |
inst._flags |= Flags.hasCachedChildNodes; | |
} | |
/** | |
* Given a DOM node, return the closest ReactDOMComponent or | |
* ReactDOMTextComponent instance ancestor. | |
*/ | |
function getClosestInstanceFromNode(node) { | |
if (node[internalInstanceKey]) { | |
return node[internalInstanceKey]; | |
} | |
// Walk up the tree until we find an ancestor whose instance we have cached. | |
var parents = []; | |
while (!node[internalInstanceKey]) { | |
parents.push(node); | |
if (node.parentNode) { | |
node = node.parentNode; | |
} else { | |
// Top of the tree. This node must not be part of a React tree (or is | |
// unmounted, potentially). | |
return null; | |
} | |
} | |
var closest; | |
var inst; | |
for (; node && (inst = node[internalInstanceKey]); node = parents.pop()) { | |
closest = inst; | |
if (parents.length) { | |
precacheChildNodes(inst, node); | |
} | |
} | |
return closest; | |
} | |
/** | |
* Given a DOM node, return the ReactDOMComponent or ReactDOMTextComponent | |
* instance, or null if the node was not rendered by this React. | |
*/ | |
function getInstanceFromNode(node) { | |
var inst = getClosestInstanceFromNode(node); | |
if (inst != null && inst._hostNode === node) { | |
return inst; | |
} else { | |
return null; | |
} | |
} | |
/** | |
* Given a ReactDOMComponent or ReactDOMTextComponent, return the corresponding | |
* DOM node. | |
*/ | |
function getNodeFromInstance(inst) { | |
// Without this first invariant, passing a non-DOM-component triggers the next | |
// invariant for a missing parent, which is super confusing. | |
!(inst._hostNode !== undefined) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'getNodeFromInstance: Invalid argument.') : _prodInvariant('33') : void 0; | |
if (inst._hostNode) { | |
return inst._hostNode; | |
} | |
// Walk up the tree until we find an ancestor whose DOM node we have cached. | |
var parents = []; | |
while (!inst._hostNode) { | |
parents.push(inst); | |
!inst._hostParent ? process.env.NODE_ENV !== 'production' ? invariant(false, 'React DOM tree root should always have a node reference.') : _prodInvariant('34') : void 0; | |
inst = inst._hostParent; | |
} | |
// Now parents contains each ancestor that does *not* have a cached native | |
// node, and `inst` is the deepest ancestor that does. | |
for (; parents.length; inst = parents.pop()) { | |
precacheChildNodes(inst, inst._hostNode); | |
} | |
return inst._hostNode; | |
} | |
var ReactDOMComponentTree = { | |
getClosestInstanceFromNode: getClosestInstanceFromNode, | |
getInstanceFromNode: getInstanceFromNode, | |
getNodeFromInstance: getNodeFromInstance, | |
precacheChildNodes: precacheChildNodes, | |
precacheNode: precacheNode, | |
uncacheNode: uncacheNode | |
}; | |
module.exports = ReactDOMComponentTree; | |
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0))) | |
/***/ }), | |
/* 6 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
"use strict"; | |
/** | |
* Copyright (c) 2013-present, Facebook, Inc. | |
* All rights reserved. | |
* | |
* This source code is licensed under the BSD-style license found in the | |
* LICENSE file in the root directory of this source tree. An additional grant | |
* of patent rights can be found in the PATENTS file in the same directory. | |
* | |
*/ | |
var canUseDOM = !!(typeof window !== 'undefined' && window.document && window.document.createElement); | |
/** | |
* Simple, lightweight module assisting with the detection and context of | |
* Worker. Helps avoid circular dependencies and allows code to reason about | |
* whether or not they are in a Worker, even if they never include the main | |
* `ReactWorker` dependency. | |
*/ | |
var ExecutionEnvironment = { | |
canUseDOM: canUseDOM, | |
canUseWorkers: typeof Worker !== 'undefined', | |
canUseEventListeners: canUseDOM && !!(window.addEventListener || window.attachEvent), | |
canUseViewport: canUseDOM && !!window.screen, | |
isInWorker: !canUseDOM // For now, this is true - might change in the future. | |
}; | |
module.exports = ExecutionEnvironment; | |
/***/ }), | |
/* 7 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
"use strict"; | |
/* WEBPACK VAR INJECTION */(function(process) {/** | |
* Copyright 2016-present, Facebook, Inc. | |
* All rights reserved. | |
* | |
* This source code is licensed under the BSD-style license found in the | |
* LICENSE file in the root directory of this source tree. An additional grant | |
* of patent rights can be found in the PATENTS file in the same directory. | |
* | |
* | |
*/ | |
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; | |
var _prodInvariant = __webpack_require__(21); | |
var ReactCurrentOwner = __webpack_require__(11); | |
var invariant = __webpack_require__(1); | |
var warning = __webpack_require__(2); | |
function isNative(fn) { | |
// Based on isNative() from Lodash | |
var funcToString = Function.prototype.toString; | |
var hasOwnProperty = Object.prototype.hasOwnProperty; | |
var reIsNative = RegExp('^' + funcToString | |
// Take an example native function source for comparison | |
.call(hasOwnProperty | |
// Strip regex characters so we can use it for regex | |
).replace(/[\\^$.*+?()[\]{}|]/g, '\\$&' | |
// Remove hasOwnProperty from the template to make it generic | |
).replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$'); | |
try { | |
var source = funcToString.call(fn); | |
return reIsNative.test(source); | |
} catch (err) { | |
return false; | |
} | |
} | |
var canUseCollections = | |
// Array.from | |
typeof Array.from === 'function' && | |
// Map | |
typeof Map === 'function' && isNative(Map) && | |
// Map.prototype.keys | |
Map.prototype != null && typeof Map.prototype.keys === 'function' && isNative(Map.prototype.keys) && | |
// Set | |
typeof Set === 'function' && isNative(Set) && | |
// Set.prototype.keys | |
Set.prototype != null && typeof Set.prototype.keys === 'function' && isNative(Set.prototype.keys); | |
var setItem; | |
var getItem; | |
var removeItem; | |
var getItemIDs; | |
var addRoot; | |
var removeRoot; | |
var getRootIDs; | |
if (canUseCollections) { | |
var itemMap = new Map(); | |
var rootIDSet = new Set(); | |
setItem = function setItem(id, item) { | |
itemMap.set(id, item); | |
}; | |
getItem = function getItem(id) { | |
return itemMap.get(id); | |
}; | |
removeItem = function removeItem(id) { | |
itemMap['delete'](id); | |
}; | |
getItemIDs = function getItemIDs() { | |
return Array.from(itemMap.keys()); | |
}; | |
addRoot = function addRoot(id) { | |
rootIDSet.add(id); | |
}; | |
removeRoot = function removeRoot(id) { | |
rootIDSet['delete'](id); | |
}; | |
getRootIDs = function getRootIDs() { | |
return Array.from(rootIDSet.keys()); | |
}; | |
} else { | |
var itemByKey = {}; | |
var rootByKey = {}; | |
// Use non-numeric keys to prevent V8 performance issues: | |
// https://github.com/facebook/react/pull/7232 | |
var getKeyFromID = function getKeyFromID(id) { | |
return '.' + id; | |
}; | |
var getIDFromKey = function getIDFromKey(key) { | |
return parseInt(key.substr(1), 10); | |
}; | |
setItem = function setItem(id, item) { | |
var key = getKeyFromID(id); | |
itemByKey[key] = item; | |
}; | |
getItem = function getItem(id) { | |
var key = getKeyFromID(id); | |
return itemByKey[key]; | |
}; | |
removeItem = function removeItem(id) { | |
var key = getKeyFromID(id); | |
delete itemByKey[key]; | |
}; | |
getItemIDs = function getItemIDs() { | |
return Object.keys(itemByKey).map(getIDFromKey); | |
}; | |
addRoot = function addRoot(id) { | |
var key = getKeyFromID(id); | |
rootByKey[key] = true; | |
}; | |
removeRoot = function removeRoot(id) { | |
var key = getKeyFromID(id); | |
delete rootByKey[key]; | |
}; | |
getRootIDs = function getRootIDs() { | |
return Object.keys(rootByKey).map(getIDFromKey); | |
}; | |
} | |
var unmountedIDs = []; | |
function purgeDeep(id) { | |
var item = getItem(id); | |
if (item) { | |
var childIDs = item.childIDs; | |
removeItem(id); | |
childIDs.forEach(purgeDeep); | |
} | |
} | |
function describeComponentFrame(name, source, ownerName) { | |
return '\n in ' + (name || 'Unknown') + (source ? ' (at ' + source.fileName.replace(/^.*[\\\/]/, '') + ':' + source.lineNumber + ')' : ownerName ? ' (created by ' + ownerName + ')' : ''); | |
} | |
function _getDisplayName(element) { | |
if (element == null) { | |
return '#empty'; | |
} else if (typeof element === 'string' || typeof element === 'number') { | |
return '#text'; | |
} else if (typeof element.type === 'string') { | |
return element.type; | |
} else { | |
return element.type.displayName || element.type.name || 'Unknown'; | |
} | |
} | |
function describeID(id) { | |
var name = ReactComponentTreeHook.getDisplayName(id); | |
var element = ReactComponentTreeHook.getElement(id); | |
var ownerID = ReactComponentTreeHook.getOwnerID(id); | |
var ownerName; | |
if (ownerID) { | |
ownerName = ReactComponentTreeHook.getDisplayName(ownerID); | |
} | |
process.env.NODE_ENV !== 'production' ? warning(element, 'ReactComponentTreeHook: Missing React element for debugID %s when ' + 'building stack', id) : void 0; | |
return describeComponentFrame(name, element && element._source, ownerName); | |
} | |
var ReactComponentTreeHook = { | |
onSetChildren: function onSetChildren(id, nextChildIDs) { | |
var item = getItem(id); | |
!item ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Item must have been set') : _prodInvariant('144') : void 0; | |
item.childIDs = nextChildIDs; | |
for (var i = 0; i < nextChildIDs.length; i++) { | |
var nextChildID = nextChildIDs[i]; | |
var nextChild = getItem(nextChildID); | |
!nextChild ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Expected hook events to fire for the child before its parent includes it in onSetChildren().') : _prodInvariant('140') : void 0; | |
!(nextChild.childIDs != null || _typeof(nextChild.element) !== 'object' || nextChild.element == null) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Expected onSetChildren() to fire for a container child before its parent includes it in onSetChildren().') : _prodInvariant('141') : void 0; | |
!nextChild.isMounted ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Expected onMountComponent() to fire for the child before its parent includes it in onSetChildren().') : _prodInvariant('71') : void 0; | |
if (nextChild.parentID == null) { | |
nextChild.parentID = id; | |
// TODO: This shouldn't be necessary but mounting a new root during in | |
// componentWillMount currently causes not-yet-mounted components to | |
// be purged from our tree data so their parent id is missing. | |
} | |
!(nextChild.parentID === id) ? process.env.NODE_ENV !== '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; | |
} | |
}, | |
onBeforeMountComponent: function onBeforeMountComponent(id, element, parentID) { | |
var item = { | |
element: element, | |
parentID: parentID, | |
text: null, | |
childIDs: [], | |
isMounted: false, | |
updateCount: 0 | |
}; | |
setItem(id, item); | |
}, | |
onBeforeUpdateComponent: function onBeforeUpdateComponent(id, element) { | |
var item = getItem(id); | |
if (!item || !item.isMounted) { | |
// We may end up here as a result of setState() in componentWillUnmount(). | |
// In this case, ignore the element. | |
return; | |
} | |
item.element = element; | |
}, | |
onMountComponent: function onMountComponent(id) { | |
var item = getItem(id); | |
!item ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Item must have been set') : _prodInvariant('144') : void 0; | |
item.isMounted = true; | |
var isRoot = item.parentID === 0; | |
if (isRoot) { | |
addRoot(id); | |
} | |
}, | |
onUpdateComponent: function onUpdateComponent(id) { | |
var item = getItem(id); | |
if (!item || !item.isMounted) { | |
// We may end up here as a result of setState() in componentWillUnmount(). | |
// In this case, ignore the element. | |
return; | |
} | |
item.updateCount++; | |
}, | |
onUnmountComponent: function onUnmountComponent(id) { | |
var item = getItem(id); | |
if (item) { | |
// We need to check if it exists. | |
// `item` might not exist if it is inside an error boundary, and a sibling | |
// error boundary child threw while mounting. Then this instance never | |
// got a chance to mount, but it still gets an unmounting event during | |
// the error boundary cleanup. | |
item.isMounted = false; | |
var isRoot = item.parentID === 0; | |
if (isRoot) { | |
removeRoot(id); | |
} | |
} | |
unmountedIDs.push(id); | |
}, | |
purgeUnmountedComponents: function purgeUnmountedComponents() { | |
if (ReactComponentTreeHook._preventPurging) { | |
// Should only be used for testing. | |
return; | |
} | |
for (var i = 0; i < unmountedIDs.length; i++) { | |
var id = unmountedIDs[i]; | |
purgeDeep(id); | |
} | |
unmountedIDs.length = 0; | |
}, | |
isMounted: function isMounted(id) { | |
var item = getItem(id); | |
return item ? item.isMounted : false; | |
}, | |
getCurrentStackAddendum: function getCurrentStackAddendum(topElement) { | |
var info = ''; | |
if (topElement) { | |
var name = _getDisplayName(topElement); | |
var owner = topElement._owner; | |
info += describeComponentFrame(name, topElement._source, owner && owner.getName()); | |
} | |
var currentOwner = ReactCurrentOwner.current; | |
var id = currentOwner && currentOwner._debugID; | |
info += ReactComponentTreeHook.getStackAddendumByID(id); | |
return info; | |
}, | |
getStackAddendumByID: function getStackAddendumByID(id) { | |
var info = ''; | |
while (id) { | |
info += describeID(id); | |
id = ReactComponentTreeHook.getParentID(id); | |
} | |
return info; | |
}, | |
getChildIDs: function getChildIDs(id) { | |
var item = getItem(id); | |
return item ? item.childIDs : []; | |
}, | |
getDisplayName: function getDisplayName(id) { | |
var element = ReactComponentTreeHook.getElement(id); | |
if (!element) { | |
return null; | |
} | |
return _getDisplayName(element); | |
}, | |
getElement: function getElement(id) { | |
var item = getItem(id); | |
return item ? item.element : null; | |
}, | |
getOwnerID: function getOwnerID(id) { | |
var element = ReactComponentTreeHook.getElement(id); | |
if (!element || !element._owner) { | |
return null; | |
} | |
return element._owner._debugID; | |
}, | |
getParentID: function getParentID(id) { | |
var item = getItem(id); | |
return item ? item.parentID : null; | |
}, | |
getSource: function getSource(id) { | |
var item = getItem(id); | |
var element = item ? item.element : null; | |
var source = element != null ? element._source : null; | |
return source; | |
}, | |
getText: function getText(id) { | |
var element = ReactComponentTreeHook.getElement(id); | |
if (typeof element === 'string') { | |
return element; | |
} else if (typeof element === 'number') { | |
return '' + element; | |
} else { | |
return null; | |
} | |
}, | |
getUpdateCount: function getUpdateCount(id) { | |
var item = getItem(id); | |
return item ? item.updateCount : 0; | |
}, | |
getRootIDs: getRootIDs, | |
getRegisteredIDs: getItemIDs, | |
pushNonStandardWarningStack: function pushNonStandardWarningStack(isCreatingElement, currentSource) { | |
if (typeof console.reactStack !== 'function') { | |
return; | |
} | |
var stack = []; | |
var currentOwner = ReactCurrentOwner.current; | |
var id = currentOwner && currentOwner._debugID; | |
try { | |
if (isCreatingElement) { | |
stack.push({ | |
name: id ? ReactComponentTreeHook.getDisplayName(id) : null, | |
fileName: currentSource ? currentSource.fileName : null, | |
lineNumber: currentSource ? currentSource.lineNumber : null | |
}); | |
} | |
while (id) { | |
var element = ReactComponentTreeHook.getElement(id); | |
var parentID = ReactComponentTreeHook.getParentID(id); | |
var ownerID = ReactComponentTreeHook.getOwnerID(id); | |
var ownerName = ownerID ? ReactComponentTreeHook.getDisplayName(ownerID) : null; | |
var source = element && element._source; | |
stack.push({ | |
name: ownerName, | |
fileName: source ? source.fileName : null, | |
lineNumber: source ? source.lineNumber : null | |
}); | |
id = parentID; | |
} | |
} catch (err) { | |
// Internal state is messed up. | |
// Stop building the stack (it's just a nice to have). | |
} | |
console.reactStack(stack); | |
}, | |
popNonStandardWarningStack: function popNonStandardWarningStack() { | |
if (typeof console.reactStackEnd !== 'function') { | |
return; | |
} | |
console.reactStackEnd(); | |
} | |
}; | |
module.exports = ReactComponentTreeHook; | |
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0))) | |
/***/ }), | |
/* 8 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
"use strict"; | |
/** | |
* Copyright (c) 2013-present, Facebook, Inc. | |
* All rights reserved. | |
* | |
* This source code is licensed under the BSD-style license found in the | |
* LICENSE file in the root directory of this source tree. An additional grant | |
* of patent rights can be found in the PATENTS file in the same directory. | |
* | |
* | |
*/ | |
function makeEmptyFunction(arg) { | |
return function () { | |
return arg; | |
}; | |
} | |
/** | |
* This function accepts and discards inputs; it has no side effects. This is | |
* primarily useful idiomatically for overridable function endpoints which | |
* always need to be callable, since JS lacks a null-call idiom ala Cocoa. | |
*/ | |
var emptyFunction = function emptyFunction() {}; | |
emptyFunction.thatReturns = makeEmptyFunction; | |
emptyFunction.thatReturnsFalse = makeEmptyFunction(false); | |
emptyFunction.thatReturnsTrue = makeEmptyFunction(true); | |
emptyFunction.thatReturnsNull = makeEmptyFunction(null); | |
emptyFunction.thatReturnsThis = function () { | |
return this; | |
}; | |
emptyFunction.thatReturnsArgument = function (arg) { | |
return arg; | |
}; | |
module.exports = emptyFunction; | |
/***/ }), | |
/* 9 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
"use strict"; | |
/* WEBPACK VAR INJECTION */(function(process) {/** | |
* Copyright 2016-present, Facebook, Inc. | |
* All rights reserved. | |
* | |
* This source code is licensed under the BSD-style license found in the | |
* LICENSE file in the root directory of this source tree. An additional grant | |
* of patent rights can be found in the PATENTS file in the same directory. | |
* | |
* | |
*/ | |
// Trust the developer to only use ReactInstrumentation with a __DEV__ check | |
var debugTool = null; | |
if (process.env.NODE_ENV !== 'production') { | |
var ReactDebugTool = __webpack_require__(336); | |
debugTool = ReactDebugTool; | |
} | |
module.exports = { debugTool: debugTool }; | |
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0))) | |
/***/ }), | |
/* 10 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
"use strict"; | |
/* WEBPACK VAR INJECTION */(function(process) {/** | |
* Copyright 2013-present, Facebook, Inc. | |
* All rights reserved. | |
* | |
* This source code is licensed under the BSD-style license found in the | |
* LICENSE file in the root directory of this source tree. An additional grant | |
* of patent rights can be found in the PATENTS file in the same directory. | |
* | |
*/ | |
var _prodInvariant = __webpack_require__(3), | |
_assign = __webpack_require__(4); | |
var CallbackQueue = __webpack_require__(63); | |
var PooledClass = __webpack_require__(14); | |
var ReactFeatureFlags = __webpack_require__(68); | |
var ReactReconciler = __webpack_require__(19); | |
var Transaction = __webpack_require__(32); | |
var invariant = __webpack_require__(1); | |
var dirtyComponents = []; | |
var updateBatchNumber = 0; | |
var asapCallbackQueue = CallbackQueue.getPooled(); | |
var asapEnqueued = false; | |
var batchingStrategy = null; | |
function ensureInjected() { | |
!(ReactUpdates.ReactReconcileTransaction && batchingStrategy) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactUpdates: must inject a reconcile transaction class and batching strategy') : _prodInvariant('123') : void 0; | |
} | |
var NESTED_UPDATES = { | |
initialize: function initialize() { | |
this.dirtyComponentsLength = dirtyComponents.length; | |
}, | |
close: function close() { | |
if (this.dirtyComponentsLength !== dirtyComponents.length) { | |
// Additional updates were enqueued by componentDidUpdate handlers or | |
// similar; before our own UPDATE_QUEUEING wrapper closes, we want to run | |
// these new updates so that if A's componentDidUpdate calls setState on | |
// B, B will update before the callback A's updater provided when calling | |
// setState. | |
dirtyComponents.splice(0, this.dirtyComponentsLength); | |
flushBatchedUpdates(); | |
} else { | |
dirtyComponents.length = 0; | |
} | |
} | |
}; | |
var UPDATE_QUEUEING = { | |
initialize: function initialize() { | |
this.callbackQueue.reset(); | |
}, | |
close: function close() { | |
this.callbackQueue.notifyAll(); | |
} | |
}; | |
var TRANSACTION_WRAPPERS = [NESTED_UPDATES, UPDATE_QUEUEING]; | |
function ReactUpdatesFlushTransaction() { | |
this.reinitializeTransaction(); | |
this.dirtyComponentsLength = null; | |
this.callbackQueue = CallbackQueue.getPooled(); | |
this.reconcileTransaction = ReactUpdates.ReactReconcileTransaction.getPooled( | |
/* useCreateElement */true); | |
} | |
_assign(ReactUpdatesFlushTransaction.prototype, Transaction, { | |
getTransactionWrappers: function getTransactionWrappers() { | |
return TRANSACTION_WRAPPERS; | |
}, | |
destructor: function destructor() { | |
this.dirtyComponentsLength = null; | |
CallbackQueue.release(this.callbackQueue); | |
this.callbackQueue = null; | |
ReactUpdates.ReactReconcileTransaction.release(this.reconcileTransaction); | |
this.reconcileTransaction = null; | |
}, | |
perform: function perform(method, scope, a) { | |
// Essentially calls `this.reconcileTransaction.perform(method, scope, a)` | |
// with this transaction's wrappers around it. | |
return Transaction.perform.call(this, this.reconcileTransaction.perform, this.reconcileTransaction, method, scope, a); | |
} | |
}); | |
PooledClass.addPoolingTo(ReactUpdatesFlushTransaction); | |
function batchedUpdates(callback, a, b, c, d, e) { | |
ensureInjected(); | |
return batchingStrategy.batchedUpdates(callback, a, b, c, d, e); | |
} | |
/** | |
* Array comparator for ReactComponents by mount ordering. | |
* | |
* @param {ReactComponent} c1 first component you're comparing | |
* @param {ReactComponent} c2 second component you're comparing | |
* @return {number} Return value usable by Array.prototype.sort(). | |
*/ | |
function mountOrderComparator(c1, c2) { | |
return c1._mountOrder - c2._mountOrder; | |
} | |
function runBatchedUpdates(transaction) { | |
var len = transaction.dirtyComponentsLength; | |
!(len === dirtyComponents.length) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Expected flush transaction\'s stored dirty-components length (%s) to match dirty-components array length (%s).', len, dirtyComponents.length) : _prodInvariant('124', len, dirtyComponents.length) : void 0; | |
// Since reconciling a component higher in the owner hierarchy usually (not | |
// always -- see shouldComponentUpdate()) will reconcile children, reconcile | |
// them before their children by sorting the array. | |
dirtyComponents.sort(mountOrderComparator); | |
// Any updates enqueued while reconciling must be performed after this entire | |
// batch. Otherwise, if dirtyComponents is [A, B] where A has children B and | |
// C, B could update twice in a single batch if C's render enqueues an update | |
// to B (since B would have already updated, we should skip it, and the only | |
// way we can know to do so is by checking the batch counter). | |
updateBatchNumber++; | |
for (var i = 0; i < len; i++) { | |
// If a component is unmounted before pending changes apply, it will still | |
// be here, but we assume that it has cleared its _pendingCallbacks and | |
// that performUpdateIfNecessary is a noop. | |
var component = dirtyComponents[i]; | |
// If performUpdateIfNecessary happens to enqueue any new updates, we | |
// shouldn't execute the callbacks until the next render happens, so | |
// stash the callbacks first | |
var callbacks = component._pendingCallbacks; | |
component._pendingCallbacks = null; | |
var markerName; | |
if (ReactFeatureFlags.logTopLevelRenders) { | |
var namedComponent = component; | |
// Duck type TopLevelWrapper. This is probably always true. | |
if (component._currentElement.type.isReactTopLevelWrapper) { | |
namedComponent = component._renderedComponent; | |
} | |
markerName = 'React update: ' + namedComponent.getName(); | |
console.time(markerName); | |
} | |
ReactReconciler.performUpdateIfNecessary(component, transaction.reconcileTransaction, updateBatchNumber); | |
if (markerName) { | |
console.timeEnd(markerName); | |
} | |
if (callbacks) { | |
for (var j = 0; j < callbacks.length; j++) { | |
transaction.callbackQueue.enqueue(callbacks[j], component.getPublicInstance()); | |
} | |
} | |
} | |
} | |
var flushBatchedUpdates = function flushBatchedUpdates() { | |
// ReactUpdatesFlushTransaction's wrappers will clear the dirtyComponents | |
// array and perform any updates enqueued by mount-ready handlers (i.e., | |
// componentDidUpdate) but we need to check here too in order to catch | |
// updates enqueued by setState callbacks and asap calls. | |
while (dirtyComponents.length || asapEnqueued) { | |
if (dirtyComponents.length) { | |
var transaction = ReactUpdatesFlushTransaction.getPooled(); | |
transaction.perform(runBatchedUpdates, null, transaction); | |
ReactUpdatesFlushTransaction.release(transaction); | |
} | |
if (asapEnqueued) { | |
asapEnqueued = false; | |
var queue = asapCallbackQueue; | |
asapCallbackQueue = CallbackQueue.getPooled(); | |
queue.notifyAll(); | |
CallbackQueue.release(queue); | |
} | |
} | |
}; | |
/** | |
* Mark a component as needing a rerender, adding an optional callback to a | |
* list of functions which will be executed once the rerender occurs. | |
*/ | |
function enqueueUpdate(component) { | |
ensureInjected(); | |
// Various parts of our code (such as ReactCompositeComponent's | |
// _renderValidatedComponent) assume that calls to render aren't nested; | |
// verify that that's the case. (This is called by each top-level update | |
// function, like setState, forceUpdate, etc.; creation and | |
// destruction of top-level components is guarded in ReactMount.) | |
if (!batchingStrategy.isBatchingUpdates) { | |
batchingStrategy.batchedUpdates(enqueueUpdate, component); | |
return; | |
} | |
dirtyComponents.push(component); | |
if (component._updateBatchNumber == null) { | |
component._updateBatchNumber = updateBatchNumber + 1; | |
} | |
} | |
/** | |
* Enqueue a callback to be run at the end of the current batching cycle. Throws | |
* if no updates are currently being performed. | |
*/ | |
function asap(callback, context) { | |
!batchingStrategy.isBatchingUpdates ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactUpdates.asap: Can\'t enqueue an asap callback in a context whereupdates are not being batched.') : _prodInvariant('125') : void 0; | |
asapCallbackQueue.enqueue(callback, context); | |
asapEnqueued = true; | |
} | |
var ReactUpdatesInjection = { | |
injectReconcileTransaction: function injectReconcileTransaction(ReconcileTransaction) { | |
!ReconcileTransaction ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactUpdates: must provide a reconcile transaction class') : _prodInvariant('126') : void 0; | |
ReactUpdates.ReactReconcileTransaction = ReconcileTransaction; | |
}, | |
injectBatchingStrategy: function injectBatchingStrategy(_batchingStrategy) { | |
!_batchingStrategy ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactUpdates: must provide a batching strategy') : _prodInvariant('127') : void 0; | |
!(typeof _batchingStrategy.batchedUpdates === 'function') ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactUpdates: must provide a batchedUpdates() function') : _prodInvariant('128') : void 0; | |
!(typeof _batchingStrategy.isBatchingUpdates === 'boolean') ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactUpdates: must provide an isBatchingUpdates boolean attribute') : _prodInvariant('129') : void 0; | |
batchingStrategy = _batchingStrategy; | |
} | |
}; | |
var ReactUpdates = { | |
/** | |
* React references `ReactReconcileTransaction` using this property in order | |
* to allow dependency injection. | |
* | |
* @internal | |
*/ | |
ReactReconcileTransaction: null, | |
batchedUpdates: batchedUpdates, | |
enqueueUpdate: enqueueUpdate, | |
flushBatchedUpdates: flushBatchedUpdates, | |
injection: ReactUpdatesInjection, | |
asap: asap | |
}; | |
module.exports = ReactUpdates; | |
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0))) | |
/***/ }), | |
/* 11 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
"use strict"; | |
/** | |
* Copyright 2013-present, Facebook, Inc. | |
* All rights reserved. | |
* | |
* This source code is licensed under the BSD-style license found in the | |
* LICENSE file in the root directory of this source tree. An additional grant | |
* of patent rights can be found in the PATENTS file in the same directory. | |
* | |
* | |
*/ | |
/** | |
* Keeps track of the current owner. | |
* | |
* The current owner is the component who should own any components that are | |
* currently being constructed. | |
*/ | |
var ReactCurrentOwner = { | |
/** | |
* @internal | |
* @type {ReactComponent} | |
*/ | |
current: null | |
}; | |
module.exports = ReactCurrentOwner; | |
/***/ }), | |
/* 12 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
"use strict"; | |
/* WEBPACK VAR INJECTION */(function(process) {/** | |
* Copyright 2013-present, Facebook, Inc. | |
* All rights reserved. | |
* | |
* This source code is licensed under the BSD-style license found in the | |
* LICENSE file in the root directory of this source tree. An additional grant | |
* of patent rights can be found in the PATENTS file in the same directory. | |
* | |
*/ | |
var _assign = __webpack_require__(4); | |
var PooledClass = __webpack_require__(14); | |
var emptyFunction = __webpack_require__(8); | |
var warning = __webpack_require__(2); | |
var didWarnForAddedNewProperty = false; | |
var isProxySupported = typeof Proxy === 'function'; | |
var shouldBeReleasedProperties = ['dispatchConfig', '_targetInst', 'nativeEvent', 'isDefaultPrevented', 'isPropagationStopped', '_dispatchListeners', '_dispatchInstances']; | |
/** | |
* @interface Event | |
* @see http://www.w3.org/TR/DOM-Level-3-Events/ | |
*/ | |
var EventInterface = { | |
type: null, | |
target: null, | |
// currentTarget is set when dispatching; no use in copying it here | |
currentTarget: emptyFunction.thatReturnsNull, | |
eventPhase: null, | |
bubbles: null, | |
cancelable: null, | |
timeStamp: function timeStamp(event) { | |
return event.timeStamp || Date.now(); | |
}, | |
defaultPrevented: null, | |
isTrusted: null | |
}; | |
/** | |
* Synthetic events are dispatched by event plugins, typically in response to a | |
* top-level event delegation handler. | |
* | |
* These systems should generally use pooling to reduce the frequency of garbage | |
* collection. The system should check `isPersistent` to determine whether the | |
* event should be released into the pool after being dispatched. Users that | |
* need a persisted event should invoke `persist`. | |
* | |
* Synthetic events (and subclasses) implement the DOM Level 3 Events API by | |
* normalizing browser quirks. Subclasses do not necessarily have to implement a | |
* DOM interface; custom application-specific events can also subclass this. | |
* | |
* @param {object} dispatchConfig Configuration used to dispatch this event. | |
* @param {*} targetInst Marker identifying the event target. | |
* @param {object} nativeEvent Native browser event. | |
* @param {DOMEventTarget} nativeEventTarget Target node. | |
*/ | |
function SyntheticEvent(dispatchConfig, targetInst, nativeEvent, nativeEventTarget) { | |
if (process.env.NODE_ENV !== 'production') { | |
// these have a getter/setter for warnings | |
delete this.nativeEvent; | |
delete this.preventDefault; | |
delete this.stopPropagation; | |
} | |
this.dispatchConfig = dispatchConfig; | |
this._targetInst = targetInst; | |
this.nativeEvent = nativeEvent; | |
var Interface = this.constructor.Interface; | |
for (var propName in Interface) { | |
if (!Interface.hasOwnProperty(propName)) { | |
continue; | |
} | |
if (process.env.NODE_ENV !== 'production') { | |
delete this[propName]; // this has a getter/setter for warnings | |
} | |
var normalize = Interface[propName]; | |
if (normalize) { | |
this[propName] = normalize(nativeEvent); | |
} else { | |
if (propName === 'target') { | |
this.target = nativeEventTarget; | |
} else { | |
this[propName] = nativeEvent[propName]; | |
} | |
} | |
} | |
var defaultPrevented = nativeEvent.defaultPrevented != null ? nativeEvent.defaultPrevented : nativeEvent.returnValue === false; | |
if (defaultPrevented) { | |
this.isDefaultPrevented = emptyFunction.thatReturnsTrue; | |
} else { | |
this.isDefaultPrevented = emptyFunction.thatReturnsFalse; | |
} | |
this.isPropagationStopped = emptyFunction.thatReturnsFalse; | |
return this; | |
} | |
_assign(SyntheticEvent.prototype, { | |
preventDefault: function preventDefault() { | |
this.defaultPrevented = true; | |
var event = this.nativeEvent; | |
if (!event) { | |
return; | |
} | |
if (event.preventDefault) { | |
event.preventDefault(); | |
// eslint-disable-next-line valid-typeof | |
} else if (typeof event.returnValue !== 'unknown') { | |
event.returnValue = false; | |
} | |
this.isDefaultPrevented = emptyFunction.thatReturnsTrue; | |
}, | |
stopPropagation: function stopPropagation() { | |
var event = this.nativeEvent; | |
if (!event) { | |
return; | |
} | |
if (event.stopPropagation) { | |
event.stopPropagation(); | |
// eslint-disable-next-line valid-typeof | |
} else if (typeof event.cancelBubble !== 'unknown') { | |
// The ChangeEventPlugin registers a "propertychange" event for | |
// IE. This event does not support bubbling or cancelling, and | |
// any references to cancelBubble throw "Member not found". A | |
// typeof check of "unknown" circumvents this issue (and is also | |
// IE specific). | |
event.cancelBubble = true; | |
} | |
this.isPropagationStopped = emptyFunction.thatReturnsTrue; | |
}, | |
/** | |
* We release all dispatched `SyntheticEvent`s after each event loop, adding | |
* them back into the pool. This allows a way to hold onto a reference that | |
* won't be added back into the pool. | |
*/ | |
persist: function persist() { | |
this.isPersistent = emptyFunction.thatReturnsTrue; | |
}, | |
/** | |
* Checks if this event should be released back into the pool. | |
* | |
* @return {boolean} True if this should not be released, false otherwise. | |
*/ | |
isPersistent: emptyFunction.thatReturnsFalse, | |
/** | |
* `PooledClass` looks for `destructor` on each instance it releases. | |
*/ | |
destructor: function destructor() { | |
var Interface = this.constructor.Interface; | |
for (var propName in Interface) { | |
if (process.env.NODE_ENV !== 'production') { | |
Object.defineProperty(this, propName, getPooledWarningPropertyDefinition(propName, Interface[propName])); | |
} else { | |
this[propName] = null; | |
} | |
} | |
for (var i = 0; i < shouldBeReleasedProperties.length; i++) { | |
this[shouldBeReleasedProperties[i]] = null; | |
} | |
if (process.env.NODE_ENV !== 'production') { | |
Object.defineProperty(this, 'nativeEvent', getPooledWarningPropertyDefinition('nativeEvent', null)); | |
Object.defineProperty(this, 'preventDefault', getPooledWarningPropertyDefinition('preventDefault', emptyFunction)); | |
Object.defineProperty(this, 'stopPropagation', getPooledWarningPropertyDefinition('stopPropagation', emptyFunction)); | |
} | |
} | |
}); | |
SyntheticEvent.Interface = EventInterface; | |
if (process.env.NODE_ENV !== 'production') { | |
if (isProxySupported) { | |
/*eslint-disable no-func-assign */ | |
SyntheticEvent = new Proxy(SyntheticEvent, { | |
construct: function construct(target, args) { | |
return this.apply(target, Object.create(target.prototype), args); | |
}, | |
apply: function apply(constructor, that, args) { | |
return new Proxy(constructor.apply(that, args), { | |
set: function set(target, prop, value) { | |
if (prop !== 'isPersistent' && !target.constructor.Interface.hasOwnProperty(prop) && shouldBeReleasedProperties.indexOf(prop) === -1) { | |
process.env.NODE_ENV !== 'production' ? warning(didWarnForAddedNewProperty || target.isPersistent(), "This synthetic event is reused for performance reasons. If you're " + "seeing this, you're adding a new property in the synthetic event object. " + 'The property is never released. See ' + 'https://fb.me/react-event-pooling for more information.') : void 0; | |
didWarnForAddedNewProperty = true; | |
} | |
target[prop] = value; | |
return true; | |
} | |
}); | |
} | |
}); | |
/*eslint-enable no-func-assign */ | |
} | |
} | |
/** | |
* Helper to reduce boilerplate when creating subclasses. | |
* | |
* @param {function} Class | |
* @param {?object} Interface | |
*/ | |
SyntheticEvent.augmentClass = function (Class, Interface) { | |
var Super = this; | |
var E = function E() {}; | |
E.prototype = Super.prototype; | |
var prototype = new E(); | |
_assign(prototype, Class.prototype); | |
Class.prototype = prototype; | |
Class.prototype.constructor = Class; | |
Class.Interface = _assign({}, Super.Interface, Interface); | |
Class.augmentClass = Super.augmentClass; | |
PooledClass.addPoolingTo(Class, PooledClass.fourArgumentPooler); | |
}; | |
PooledClass.addPoolingTo(SyntheticEvent, PooledClass.fourArgumentPooler); | |
module.exports = SyntheticEvent; | |
/** | |
* Helper to nullify syntheticEvent instance properties when destructing | |
* | |
* @param {object} SyntheticEvent | |
* @param {String} propName | |
* @return {object} defineProperty object | |
*/ | |
function getPooledWarningPropertyDefinition(propName, getVal) { | |
var isFunction = typeof getVal === 'function'; | |
return { | |
configurable: true, | |
set: set, | |
get: get | |
}; | |
function set(val) { | |
var action = isFunction ? 'setting the method' : 'setting the property'; | |
warn(action, 'This is effectively a no-op'); | |
return val; | |
} | |
function get() { | |
var action = isFunction ? 'accessing the method' : 'accessing the property'; | |
var result = isFunction ? 'This is a no-op function' : 'This is set to null'; | |
warn(action, result); | |
return getVal; | |
} | |
function warn(action, result) { | |
var warningCondition = false; | |
process.env.NODE_ENV !== 'production' ? warning(warningCondition, "This synthetic event is reused for performance reasons. If you're seeing this, " + "you're %s `%s` on a released/nullified synthetic event. %s. " + 'If you must keep the original synthetic event around, use event.persist(). ' + 'See https://fb.me/react-event-pooling for more information.', action, propName, result) : void 0; | |
} | |
} | |
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0))) | |
/***/ }), | |
/* 13 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
"use strict"; | |
/* WEBPACK VAR INJECTION */(function(process) {/** | |
* Copyright 2013-present, Facebook, Inc. | |
* All rights reserved. | |
* | |
* This source code is licensed under the BSD-style license found in the | |
* LICENSE file in the root directory of this source tree. An additional grant | |
* of patent rights can be found in the PATENTS file in the same directory. | |
* | |
*/ | |
var _prodInvariant = __webpack_require__(3); | |
var invariant = __webpack_require__(1); | |
function checkMask(value, bitmask) { | |
return (value & bitmask) === bitmask; | |
} | |
var DOMPropertyInjection = { | |
/** | |
* Mapping from normalized, camelcased property names to a configuration that | |
* specifies how the associated DOM property should be accessed or rendered. | |
*/ | |
MUST_USE_PROPERTY: 0x1, | |
HAS_BOOLEAN_VALUE: 0x4, | |
HAS_NUMERIC_VALUE: 0x8, | |
HAS_POSITIVE_NUMERIC_VALUE: 0x10 | 0x8, | |
HAS_OVERLOADED_BOOLEAN_VALUE: 0x20, | |
/** | |
* Inject some specialized knowledge about the DOM. This takes a config object | |
* with the following properties: | |
* | |
* isCustomAttribute: function that given an attribute name will return true | |
* if it can be inserted into the DOM verbatim. Useful for data-* or aria-* | |
* attributes where it's impossible to enumerate all of the possible | |
* attribute names, | |
* | |
* Properties: object mapping DOM property name to one of the | |
* DOMPropertyInjection constants or null. If your attribute isn't in here, | |
* it won't get written to the DOM. | |
* | |
* DOMAttributeNames: object mapping React attribute name to the DOM | |
* attribute name. Attribute names not specified use the **lowercase** | |
* normalized name. | |
* | |
* DOMAttributeNamespaces: object mapping React attribute name to the DOM | |
* attribute namespace URL. (Attribute names not specified use no namespace.) | |
* | |
* DOMPropertyNames: similar to DOMAttributeNames but for DOM properties. | |
* Property names not specified use the normalized name. | |
* | |
* DOMMutationMethods: Properties that require special mutation methods. If | |
* `value` is undefined, the mutation method should unset the property. | |
* | |
* @param {object} domPropertyConfig the config as described above. | |
*/ | |
injectDOMPropertyConfig: function injectDOMPropertyConfig(domPropertyConfig) { | |
var Injection = DOMPropertyInjection; | |
var Properties = domPropertyConfig.Properties || {}; | |
var DOMAttributeNamespaces = domPropertyConfig.DOMAttributeNamespaces || {}; | |
var DOMAttributeNames = domPropertyConfig.DOMAttributeNames || {}; | |
var DOMPropertyNames = domPropertyConfig.DOMPropertyNames || {}; | |
var DOMMutationMethods = domPropertyConfig.DOMMutationMethods || {}; | |
if (domPropertyConfig.isCustomAttribute) { | |
DOMProperty._isCustomAttributeFunctions.push(domPropertyConfig.isCustomAttribute); | |
} | |
for (var propName in Properties) { | |
!!DOMProperty.properties.hasOwnProperty(propName) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'injectDOMPropertyConfig(...): You\'re trying to inject DOM property \'%s\' which has already been injected. You may be accidentally injecting the same DOM property config twice, or you may be injecting two configs that have conflicting property names.', propName) : _prodInvariant('48', propName) : void 0; | |
var lowerCased = propName.toLowerCase(); | |
var propConfig = Properties[propName]; | |
var propertyInfo = { | |
attributeName: lowerCased, | |
attributeNamespace: null, | |
propertyName: propName, | |
mutationMethod: null, | |
mustUseProperty: checkMask(propConfig, Injection.MUST_USE_PROPERTY), | |
hasBooleanValue: checkMask(propConfig, Injection.HAS_BOOLEAN_VALUE), | |
hasNumericValue: checkMask(propConfig, Injection.HAS_NUMERIC_VALUE), | |
hasPositiveNumericValue: checkMask(propConfig, Injection.HAS_POSITIVE_NUMERIC_VALUE), | |
hasOverloadedBooleanValue: checkMask(propConfig, Injection.HAS_OVERLOADED_BOOLEAN_VALUE) | |
}; | |
!(propertyInfo.hasBooleanValue + propertyInfo.hasNumericValue + propertyInfo.hasOverloadedBooleanValue <= 1) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'DOMProperty: Value can be one of boolean, overloaded boolean, or numeric value, but not a combination: %s', propName) : _prodInvariant('50', propName) : void 0; | |
if (process.env.NODE_ENV !== 'production') { | |
DOMProperty.getPossibleStandardName[lowerCased] = propName; | |
} | |
if (DOMAttributeNames.hasOwnProperty(propName)) { | |
var attributeName = DOMAttributeNames[propName]; | |
propertyInfo.attributeName = attributeName; | |
if (process.env.NODE_ENV !== 'production') { | |
DOMProperty.getPossibleStandardName[attributeName] = propName; | |
} | |
} | |
if (DOMAttributeNamespaces.hasOwnProperty(propName)) { | |
propertyInfo.attributeNamespace = DOMAttributeNamespaces[propName]; | |
} | |
if (DOMPropertyNames.hasOwnProperty(propName)) { | |
propertyInfo.propertyName = DOMPropertyNames[propName]; | |
} | |
if (DOMMutationMethods.hasOwnProperty(propName)) { | |
propertyInfo.mutationMethod = DOMMutationMethods[propName]; | |
} | |
DOMProperty.properties[propName] = propertyInfo; | |
} | |
} | |
}; | |
/* eslint-disable max-len */ | |
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'; | |
/* eslint-enable max-len */ | |
/** | |
* DOMProperty exports lookup objects that can be used like functions: | |
* | |
* > DOMProperty.isValid['id'] | |
* true | |
* > DOMProperty.isValid['foobar'] | |
* undefined | |
* | |
* Although this may be confusing, it performs better in general. | |
* | |
* @see http://jsperf.com/key-exists | |
* @see http://jsperf.com/key-missing | |
*/ | |
var DOMProperty = { | |
ID_ATTRIBUTE_NAME: 'data-reactid', | |
ROOT_ATTRIBUTE_NAME: 'data-reactroot', | |
ATTRIBUTE_NAME_START_CHAR: ATTRIBUTE_NAME_START_CHAR, | |
ATTRIBUTE_NAME_CHAR: ATTRIBUTE_NAME_START_CHAR + '\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040', | |
/** | |
* Map from property "standard name" to an object with info about how to set | |
* the property in the DOM. Each object contains: | |
* | |
* attributeName: | |
* Used when rendering markup or with `*Attribute()`. | |
* attributeNamespace | |
* propertyName: | |
* Used on DOM node instances. (This includes properties that mutate due to | |
* external factors.) | |
* mutationMethod: | |
* If non-null, used instead of the property or `setAttribute()` after | |
* initial render. | |
* mustUseProperty: | |
* Whether the property must be accessed and mutated as an object property. | |
* hasBooleanValue: | |
* Whether the property should be removed when set to a falsey value. | |
* hasNumericValue: | |
* Whether the property must be numeric or parse as a numeric and should be | |
* removed when set to a falsey value. | |
* hasPositiveNumericValue: | |
* Whether the property must be positive numeric or parse as a positive | |
* numeric and should be removed when set to a falsey value. | |
* hasOverloadedBooleanValue: | |
* Whether the property can be used as a flag as well as with a value. | |
* Removed when strictly equal to false; present without a value when | |
* strictly equal to true; present with a value otherwise. | |
*/ | |
properties: {}, | |
/** | |
* Mapping from lowercase property names to the properly cased version, used | |
* to warn in the case of missing properties. Available only in __DEV__. | |
* | |
* autofocus is predefined, because adding it to the property whitelist | |
* causes unintended side effects. | |
* | |
* @type {Object} | |
*/ | |
getPossibleStandardName: process.env.NODE_ENV !== 'production' ? { autofocus: 'autoFocus' } : null, | |
/** | |
* All of the isCustomAttribute() functions that have been injected. | |
*/ | |
_isCustomAttributeFunctions: [], | |
/** | |
* Checks whether a property name is a custom attribute. | |
* @method | |
*/ | |
isCustomAttribute: function isCustomAttribute(attributeName) { | |
for (var i = 0; i < DOMProperty._isCustomAttributeFunctions.length; i++) { | |
var isCustomAttributeFn = DOMProperty._isCustomAttributeFunctions[i]; | |
if (isCustomAttributeFn(attributeName)) { | |
return true; | |
} | |
} | |
return false; | |
}, | |
injection: DOMPropertyInjection | |
}; | |
module.exports = DOMProperty; | |
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0))) | |
/***/ }), | |
/* 14 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
"use strict"; | |
/* WEBPACK VAR INJECTION */(function(process) {/** | |
* Copyright 2013-present, Facebook, Inc. | |
* All rights reserved. | |
* | |
* This source code is licensed under the BSD-style license found in the | |
* LICENSE file in the root directory of this source tree. An additional grant | |
* of patent rights can be found in the PATENTS file in the same directory. | |
* | |
* | |
*/ | |
var _prodInvariant = __webpack_require__(3); | |
var invariant = __webpack_require__(1); | |
/** | |
* Static poolers. Several custom versions for each potential number of | |
* arguments. A completely generic pooler is easy to implement, but would | |
* require accessing the `arguments` object. In each of these, `this` refers to | |
* the Class itself, not an instance. If any others are needed, simply add them | |
* here, or in their own files. | |
*/ | |
var oneArgumentPooler = function oneArgumentPooler(copyFieldsFrom) { | |
var Klass = this; | |
if (Klass.instancePool.length) { | |
var instance = Klass.instancePool.pop(); | |
Klass.call(instance, copyFieldsFrom); | |
return instance; | |
} else { | |
return new Klass(copyFieldsFrom); | |
} | |
}; | |
var twoArgumentPooler = function twoArgumentPooler(a1, a2) { | |
var Klass = this; | |
if (Klass.instancePool.length) { | |
var instance = Klass.instancePool.pop(); | |
Klass.call(instance, a1, a2); | |
return instance; | |
} else { | |
return new Klass(a1, a2); | |
} | |
}; | |
var threeArgumentPooler = function threeArgumentPooler(a1, a2, a3) { | |
var Klass = this; | |
if (Klass.instancePool.length) { | |
var instance = Klass.instancePool.pop(); | |
Klass.call(instance, a1, a2, a3); | |
return instance; | |
} else { | |
return new Klass(a1, a2, a3); | |
} | |
}; | |
var fourArgumentPooler = function fourArgumentPooler(a1, a2, a3, a4) { | |
var Klass = this; | |
if (Klass.instancePool.length) { | |
var instance = Klass.instancePool.pop(); | |
Klass.call(instance, a1, a2, a3, a4); | |
return instance; | |
} else { | |
return new Klass(a1, a2, a3, a4); | |
} | |
}; | |
var standardReleaser = function standardReleaser(instance) { | |
var Klass = this; | |
!(instance instanceof Klass) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Trying to release an instance into a pool of a different type.') : _prodInvariant('25') : void 0; | |
instance.destructor(); | |
if (Klass.instancePool.length < Klass.poolSize) { | |
Klass.instancePool.push(instance); | |
} | |
}; | |
var DEFAULT_POOL_SIZE = 10; | |
var DEFAULT_POOLER = oneArgumentPooler; | |
/** | |
* Augments `CopyConstructor` to be a poolable class, augmenting only the class | |
* itself (statically) not adding any prototypical fields. Any CopyConstructor | |
* you give this may have a `poolSize` property, and will look for a | |
* prototypical `destructor` on instances. | |
* | |
* @param {Function} CopyConstructor Constructor that can be used to reset. | |
* @param {Function} pooler Customizable pooler. | |
*/ | |
var addPoolingTo = function addPoolingTo(CopyConstructor, pooler) { | |
// Casting as any so that flow ignores the actual implementation and trusts | |
// it to match the type we declared | |
var NewKlass = CopyConstructor; | |
NewKlass.instancePool = []; | |
NewKlass.getPooled = pooler || DEFAULT_POOLER; | |
if (!NewKlass.poolSize) { | |
NewKlass.poolSize = DEFAULT_POOL_SIZE; | |
} | |
NewKlass.release = standardReleaser; | |
return NewKlass; | |
}; | |
var PooledClass = { | |
addPoolingTo: addPoolingTo, | |
oneArgumentPooler: oneArgumentPooler, | |
twoArgumentPooler: twoArgumentPooler, | |
threeArgumentPooler: threeArgumentPooler, | |
fourArgumentPooler: fourArgumentPooler | |
}; | |
module.exports = PooledClass; | |
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0))) | |
/***/ }), | |
/* 15 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
"use strict"; | |
/* WEBPACK VAR INJECTION */(function(process) {/** | |
* Copyright 2014-present, Facebook, Inc. | |
* All rights reserved. | |
* | |
* This source code is licensed under the BSD-style license found in the | |
* LICENSE file in the root directory of this source tree. An additional grant | |
* of patent rights can be found in the PATENTS file in the same directory. | |
* | |
*/ | |
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; | |
var _assign = __webpack_require__(4); | |
var ReactCurrentOwner = __webpack_require__(11); | |
var warning = __webpack_require__(2); | |
var canDefineProperty = __webpack_require__(35); | |
var hasOwnProperty = Object.prototype.hasOwnProperty; | |
var REACT_ELEMENT_TYPE = __webpack_require__(85); | |
var RESERVED_PROPS = { | |
key: true, | |
ref: true, | |
__self: true, | |
__source: true | |
}; | |
var specialPropKeyWarningShown, specialPropRefWarningShown; | |
function hasValidRef(config) { | |
if (process.env.NODE_ENV !== 'production') { | |
if (hasOwnProperty.call(config, 'ref')) { | |
var getter = Object.getOwnPropertyDescriptor(config, 'ref').get; | |
if (getter && getter.isReactWarning) { | |
return false; | |
} | |
} | |
} | |
return config.ref !== undefined; | |
} | |
function hasValidKey(config) { | |
if (process.env.NODE_ENV !== 'production') { | |
if (hasOwnProperty.call(config, 'key')) { | |
var getter = Object.getOwnPropertyDescriptor(config, 'key').get; | |
if (getter && getter.isReactWarning) { | |
return false; | |
} | |
} | |
} | |
return config.key !== undefined; | |
} | |
function defineKeyPropWarningGetter(props, displayName) { | |
var warnAboutAccessingKey = function warnAboutAccessingKey() { | |
if (!specialPropKeyWarningShown) { | |
specialPropKeyWarningShown = true; | |
process.env.NODE_ENV !== 'production' ? warning(false, '%s: `key` is not a prop. Trying to access it will result ' + 'in `undefined` being returned. If you need to access the same ' + 'value within the child component, you should pass it as a different ' + 'prop. (https://fb.me/react-special-props)', displayName) : void 0; | |
} | |
}; | |
warnAboutAccessingKey.isReactWarning = true; | |
Object.defineProperty(props, 'key', { | |
get: warnAboutAccessingKey, | |
configurable: true | |
}); | |
} | |
function defineRefPropWarningGetter(props, displayName) { | |
var warnAboutAccessingRef = function warnAboutAccessingRef() { | |
if (!specialPropRefWarningShown) { | |
specialPropRefWarningShown = true; | |
process.env.NODE_ENV !== 'production' ? warning(false, '%s: `ref` is not a prop. Trying to access it will result ' + 'in `undefined` being returned. If you need to access the same ' + 'value within the child component, you should pass it as a different ' + 'prop. (https://fb.me/react-special-props)', displayName) : void 0; | |
} | |
}; | |
warnAboutAccessingRef.isReactWarning = true; | |
Object.defineProperty(props, 'ref', { | |
get: warnAboutAccessingRef, | |
configurable: true | |
}); | |
} | |
/** | |
* Factory method to create a new React element. This no longer adheres to | |
* the class pattern, so do not use new to call it. Also, no instanceof check | |
* will work. Instead test $$typeof field against Symbol.for('react.element') to check | |
* if something is a React Element. | |
* | |
* @param {*} type | |
* @param {*} key | |
* @param {string|object} ref | |
* @param {*} self A *temporary* helper to detect places where `this` is | |
* different from the `owner` when React.createElement is called, so that we | |
* can warn. We want to get rid of owner and replace string `ref`s with arrow | |
* functions, and as long as `this` and owner are the same, there will be no | |
* change in behavior. | |
* @param {*} source An annotation object (added by a transpiler or otherwise) | |
* indicating filename, line number, and/or other information. | |
* @param {*} owner | |
* @param {*} props | |
* @internal | |
*/ | |
var ReactElement = function ReactElement(type, key, ref, self, source, owner, props) { | |
var element = { | |
// This tag allow us to uniquely identify this as a React Element | |
$$typeof: REACT_ELEMENT_TYPE, | |
// Built-in properties that belong on the element | |
type: type, | |
key: key, | |
ref: ref, | |
props: props, | |
// Record the component responsible for creating this element. | |
_owner: owner | |
}; | |
if (process.env.NODE_ENV !== 'production') { | |
// The validation flag is currently mutative. We put it on | |
// an external backing store so that we can freeze the whole object. | |
// This can be replaced with a WeakMap once they are implemented in | |
// commonly used development environments. | |
element._store = {}; | |
// To make comparing ReactElements easier for testing purposes, we make | |
// the validation flag non-enumerable (where possible, which should | |
// include every environment we run tests in), so the test framework | |
// ignores it. | |
if (canDefineProperty) { | |
Object.defineProperty(element._store, 'validated', { | |
configurable: false, | |
enumerable: false, | |
writable: true, | |
value: false | |
}); | |
// self and source are DEV only properties. | |
Object.defineProperty(element, '_self', { | |
configurable: false, | |
enumerable: false, | |
writable: false, | |
value: self | |
}); | |
// Two elements created in two different places should be considered | |
// equal for testing purposes and therefore we hide it from enumeration. | |
Object.defineProperty(element, '_source', { | |
configurable: false, | |
enumerable: false, | |
writable: false, | |
value: source | |
}); | |
} else { | |
element._store.validated = false; | |
element._self = self; | |
element._source = source; | |
} | |
if (Object.freeze) { | |
Object.freeze(element.props); | |
Object.freeze(element); | |
} | |
} | |
return element; | |
}; | |
/** | |
* Create and return a new ReactElement of the given type. | |
* See https://facebook.github.io/react/docs/top-level-api.html#react.createelement | |
*/ | |
ReactElement.createElement = function (type, config, children) { | |
var propName; | |
// Reserved names are extracted | |
var props = {}; | |
var key = null; | |
var ref = null; | |
var self = null; | |
var source = null; | |
if (config != null) { | |
if (hasValidRef(config)) { | |
ref = config.ref; | |
} | |
if (hasValidKey(config)) { | |
key = '' + config.key; | |
} | |
self = config.__self === undefined ? null : config.__self; | |
source = config.__source === undefined ? null : config.__source; | |
// Remaining properties are added to a new props object | |
for (propName in config) { | |
if (hasOwnProperty.call(config, propName) && !RESERVED_PROPS.hasOwnProperty(propName)) { | |
props[propName] = config[propName]; | |
} | |
} | |
} | |
// Children can be more than one argument, and those are transferred onto | |
// the newly allocated props object. | |
var childrenLength = arguments.length - 2; | |
if (childrenLength === 1) { | |
props.children = children; | |
} else if (childrenLength > 1) { | |
var childArray = Array(childrenLength); | |
for (var i = 0; i < childrenLength; i++) { | |
childArray[i] = arguments[i + 2]; | |
} | |
if (process.env.NODE_ENV !== 'production') { | |
if (Object.freeze) { | |
Object.freeze(childArray); | |
} | |
} | |
props.children = childArray; | |
} | |
// Resolve default props | |
if (type && type.defaultProps) { | |
var defaultProps = type.defaultProps; | |
for (propName in defaultProps) { | |
if (props[propName] === undefined) { | |
props[propName] = defaultProps[propName]; | |
} | |
} | |
} | |
if (process.env.NODE_ENV !== 'production') { | |
if (key || ref) { | |
if (typeof props.$$typeof === 'undefined' || props.$$typeof !== REACT_ELEMENT_TYPE) { | |
var displayName = typeof type === 'function' ? type.displayName || type.name || 'Unknown' : type; | |
if (key) { | |
defineKeyPropWarningGetter(props, displayName); | |
} | |
if (ref) { | |
defineRefPropWarningGetter(props, displayName); | |
} | |
} | |
} | |
} | |
return ReactElement(type, key, ref, self, source, ReactCurrentOwner.current, props); | |
}; | |
/** | |
* Return a function that produces ReactElements of a given type. | |
* See https://facebook.github.io/react/docs/top-level-api.html#react.createfactory | |
*/ | |
ReactElement.createFactory = function (type) { | |
var factory = ReactElement.createElement.bind(null, type); | |
// Expose the type on the factory and the prototype so that it can be | |
// easily accessed on elements. E.g. `<Foo />.type === Foo`. | |
// This should not be named `constructor` since this may not be the function | |
// that created the element, and it may not even be a constructor. | |
// Legacy hook TODO: Warn if this is accessed | |
factory.type = type; | |
return factory; | |
}; | |
ReactElement.cloneAndReplaceKey = function (oldElement, newKey) { | |
var newElement = ReactElement(oldElement.type, newKey, oldElement.ref, oldElement._self, oldElement._source, oldElement._owner, oldElement.props); | |
return newElement; | |
}; | |
/** | |
* Clone and return a new ReactElement using element as the starting point. | |
* See https://facebook.github.io/react/docs/top-level-api.html#react.cloneelement | |
*/ | |
ReactElement.cloneElement = function (element, config, children) { | |
var propName; | |
// Original props are copied | |
var props = _assign({}, element.props); | |
// Reserved names are extracted | |
var key = element.key; | |
var ref = element.ref; | |
// Self is preserved since the owner is preserved. | |
var self = element._self; | |
// Source is preserved since cloneElement is unlikely to be targeted by a | |
// transpiler, and the original source is probably a better indicator of the | |
// true owner. | |
var source = element._source; | |
// Owner will be preserved, unless ref is overridden | |
var owner = element._owner; | |
if (config != null) { | |
if (hasValidRef(config)) { | |
// Silently steal the ref from the parent. | |
ref = config.ref; | |
owner = ReactCurrentOwner.current; | |
} | |
if (hasValidKey(config)) { | |
key = '' + config.key; | |
} | |
// Remaining properties override existing props | |
var defaultProps; | |
if (element.type && element.type.defaultProps) { | |
defaultProps = element.type.defaultProps; | |
} | |
for (propName in config) { | |
if (hasOwnProperty.call(config, propName) && !RESERVED_PROPS.hasOwnProperty(propName)) { | |
if (config[propName] === undefined && defaultProps !== undefined) { | |
// Resolve default props | |
props[propName] = defaultProps[propName]; | |
} else { | |
props[propName] = config[propName]; | |
} | |
} | |
} | |
} | |
// Children can be more than one argument, and those are transferred onto | |
// the newly allocated props object. | |
var childrenLength = arguments.length - 2; | |
if (childrenLength === 1) { | |
props.children = children; | |
} else if (childrenLength > 1) { | |
var childArray = Array(childrenLength); | |
for (var i = 0; i < childrenLength; i++) { | |
childArray[i] = arguments[i + 2]; | |
} | |
props.children = childArray; | |
} | |
return ReactElement(element.type, key, ref, self, source, owner, props); | |
}; | |
/** | |
* Verifies the object is a ReactElement. | |
* See https://facebook.github.io/react/docs/top-level-api.html#react.isvalidelement | |
* @param {?object} object | |
* @return {boolean} True if `object` is a valid component. | |
* @final | |
*/ | |
ReactElement.isValidElement = function (object) { | |
return (typeof object === 'undefined' ? 'undefined' : _typeof(object)) === 'object' && object !== null && object.$$typeof === REACT_ELEMENT_TYPE; | |
}; | |
module.exports = ReactElement; | |
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0))) | |
/***/ }), | |
/* 16 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
"use strict"; | |
module.exports = __webpack_require__(20); | |
/***/ }), | |
/* 17 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
"use strict"; | |
var encode = __webpack_require__(303); | |
var decode = __webpack_require__(302); | |
var C_BACKSLASH = 92; | |
var decodeHTML = __webpack_require__(56).decodeHTML; | |
var ENTITY = "&(?:#x[a-f0-9]{1,8}|#[0-9]{1,8}|[a-z][a-z0-9]{1,31});"; | |
var TAGNAME = '[A-Za-z][A-Za-z0-9-]*'; | |
var ATTRIBUTENAME = '[a-zA-Z_:][a-zA-Z0-9:._-]*'; | |
var UNQUOTEDVALUE = "[^\"'=<>`\\x00-\\x20]+"; | |
var SINGLEQUOTEDVALUE = "'[^']*'"; | |
var DOUBLEQUOTEDVALUE = '"[^"]*"'; | |
var ATTRIBUTEVALUE = "(?:" + UNQUOTEDVALUE + "|" + SINGLEQUOTEDVALUE + "|" + DOUBLEQUOTEDVALUE + ")"; | |
var ATTRIBUTEVALUESPEC = "(?:" + "\\s*=" + "\\s*" + ATTRIBUTEVALUE + ")"; | |
var ATTRIBUTE = "(?:" + "\\s+" + ATTRIBUTENAME + ATTRIBUTEVALUESPEC + "?)"; | |
var OPENTAG = "<" + TAGNAME + ATTRIBUTE + "*" + "\\s*/?>"; | |
var CLOSETAG = "</" + TAGNAME + "\\s*[>]"; | |
var HTMLCOMMENT = "<!---->|<!--(?:-?[^>-])(?:-?[^-])*-->"; | |
var PROCESSINGINSTRUCTION = "[<][?].*?[?][>]"; | |
var DECLARATION = "<![A-Z]+" + "\\s+[^>]*>"; | |
var CDATA = "<!\\[CDATA\\[[\\s\\S]*?\\]\\]>"; | |
var HTMLTAG = "(?:" + OPENTAG + "|" + CLOSETAG + "|" + HTMLCOMMENT + "|" + PROCESSINGINSTRUCTION + "|" + DECLARATION + "|" + CDATA + ")"; | |
var reHtmlTag = new RegExp('^' + HTMLTAG, 'i'); | |
var reBackslashOrAmp = /[\\&]/; | |
var ESCAPABLE = '[!"#$%&\'()*+,./:;<=>?@[\\\\\\]^_`{|}~-]'; | |
var reEntityOrEscapedChar = new RegExp('\\\\' + ESCAPABLE + '|' + ENTITY, 'gi'); | |
var XMLSPECIAL = '[&<>"]'; | |
var reXmlSpecial = new RegExp(XMLSPECIAL, 'g'); | |
var reXmlSpecialOrEntity = new RegExp(ENTITY + '|' + XMLSPECIAL, 'gi'); | |
var unescapeChar = function unescapeChar(s) { | |
if (s.charCodeAt(0) === C_BACKSLASH) { | |
return s.charAt(1); | |
} else { | |
return decodeHTML(s); | |
} | |
}; | |
// Replace entities and backslash escapes with literal characters. | |
var unescapeString = function unescapeString(s) { | |
if (reBackslashOrAmp.test(s)) { | |
return s.replace(reEntityOrEscapedChar, unescapeChar); | |
} else { | |
return s; | |
} | |
}; | |
var normalizeURI = function normalizeURI(uri) { | |
try { | |
return encode(decode(uri)); | |
} catch (err) { | |
return uri; | |
} | |
}; | |
var replaceUnsafeChar = function replaceUnsafeChar(s) { | |
switch (s) { | |
case '&': | |
return '&'; | |
case '<': | |
return '<'; | |
case '>': | |
return '>'; | |
case '"': | |
return '"'; | |
default: | |
return s; | |
} | |
}; | |
var escapeXml = function escapeXml(s, preserve_entities) { | |
if (reXmlSpecial.test(s)) { | |
if (preserve_entities) { | |
return s.replace(reXmlSpecialOrEntity, replaceUnsafeChar); | |
} else { | |
return s.replace(reXmlSpecial, replaceUnsafeChar); | |
} | |
} else { | |
return s; | |
} | |
}; | |
module.exports = { unescapeString: unescapeString, | |
normalizeURI: normalizeURI, | |
escapeXml: escapeXml, | |
reHtmlTag: reHtmlTag, | |
OPENTAG: OPENTAG, | |
CLOSETAG: CLOSETAG, | |
ENTITY: ENTITY, | |
ESCAPABLE: ESCAPABLE | |
}; | |
/***/ }), | |
/* 18 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
"use strict"; | |
/** | |
* Copyright 2015-present, Facebook, Inc. | |
* All rights reserved. | |
* | |
* This source code is licensed under the BSD-style license found in the | |
* LICENSE file in the root directory of this source tree. An additional grant | |
* of patent rights can be found in the PATENTS file in the same directory. | |
* | |
*/ | |
var DOMNamespaces = __webpack_require__(40); | |
var setInnerHTML = __webpack_require__(34); | |
var createMicrosoftUnsafeLocalFunction = __webpack_require__(47); | |
var setTextContent = __webpack_require__(82); | |
var ELEMENT_NODE_TYPE = 1; | |
var DOCUMENT_FRAGMENT_NODE_TYPE = 11; | |
/** | |
* In IE (8-11) and Edge, appending nodes with no children is dramatically | |
* faster than appending a full subtree, so we essentially queue up the | |
* .appendChild calls here and apply them so each node is added to its parent | |
* before any children are added. | |
* | |
* In other browsers, doing so is slower or neutral compared to the other order | |
* (in Firefox, twice as slow) so we only do this inversion in IE. | |
* | |
* See https://github.com/spicyj/innerhtml-vs-createelement-vs-clonenode. | |
*/ | |
var enableLazy = typeof document !== 'undefined' && typeof document.documentMode === 'number' || typeof navigator !== 'undefined' && typeof navigator.userAgent === 'string' && /\bEdge\/\d/.test(navigator.userAgent); | |
function insertTreeChildren(tree) { | |
if (!enableLazy) { | |
return; | |
} | |
var node = tree.node; | |
var children = tree.children; | |
if (children.length) { | |
for (var i = 0; i < children.length; i++) { | |
insertTreeBefore(node, children[i], null); | |
} | |
} else if (tree.html != null) { | |
setInnerHTML(node, tree.html); | |
} else if (tree.text != null) { | |
setTextContent(node, tree.text); | |
} | |
} | |
var insertTreeBefore = createMicrosoftUnsafeLocalFunction(function (parentNode, tree, referenceNode) { | |
// DocumentFragments aren't actually part of the DOM after insertion so | |
// appending children won't update the DOM. We need to ensure the fragment | |
// is properly populated first, breaking out of our lazy approach for just | |
// this level. Also, some <object> plugins (like Flash Player) will read | |
// <param> nodes immediately upon insertion into the DOM, so <object> | |
// must also be populated prior to insertion into the DOM. | |
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)) { | |
insertTreeChildren(tree); | |
parentNode.insertBefore(tree.node, referenceNode); | |
} else { | |
parentNode.insertBefore(tree.node, referenceNode); | |
insertTreeChildren(tree); | |
} | |
}); | |
function replaceChildWithTree(oldNode, newTree) { | |
oldNode.parentNode.replaceChild(newTree.node, oldNode); | |
insertTreeChildren(newTree); | |
} | |
function queueChild(parentTree, childTree) { | |
if (enableLazy) { | |
parentTree.children.push(childTree); | |
} else { | |
parentTree.node.appendChild(childTree.node); | |
} | |
} | |
function queueHTML(tree, html) { | |
if (enableLazy) { | |
tree.html = html; | |
} else { | |
setInnerHTML(tree.node, html); | |
} | |
} | |
function queueText(tree, text) { | |
if (enableLazy) { | |
tree.text = text; | |
} else { | |
setTextContent(tree.node, text); | |
} | |
} | |
function toString() { | |
return this.node.nodeName; | |
} | |
function DOMLazyTree(node) { | |
return { | |
node: node, | |
children: [], | |
html: null, | |
text: null, | |
toString: toString | |
}; | |
} | |
DOMLazyTree.insertTreeBefore = insertTreeBefore; | |
DOMLazyTree.replaceChildWithTree = replaceChildWithTree; | |
DOMLazyTree.queueChild = queueChild; | |
DOMLazyTree.queueHTML = queueHTML; | |
DOMLazyTree.queueText = queueText; | |
module.exports = DOMLazyTree; | |
/***/ }), | |
/* 19 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
"use strict"; | |
/* WEBPACK VAR INJECTION */(function(process) {/** | |
* Copyright 2013-present, Facebook, Inc. | |
* All rights reserved. | |
* | |
* This source code is licensed under the BSD-style license found in the | |
* LICENSE file in the root directory of this source tree. An additional grant | |
* of patent rights can be found in the PATENTS file in the same directory. | |
* | |
*/ | |
var ReactRef = __webpack_require__(350); | |
var ReactInstrumentation = __webpack_require__(9); | |
var warning = __webpack_require__(2); | |
/** | |
* Helper to call ReactRef.attachRefs with this composite component, split out | |
* to avoid allocations in the transaction mount-ready queue. | |
*/ | |
function attachRefs() { | |
ReactRef.attachRefs(this, this._currentElement); | |
} | |
var ReactReconciler = { | |
/** | |
* Initializes the component, renders markup, and registers event listeners. | |
* | |
* @param {ReactComponent} internalInstance | |
* @param {ReactReconcileTransaction|ReactServerRenderingTransaction} transaction | |
* @param {?object} the containing host component instance | |
* @param {?object} info about the host container | |
* @return {?string} Rendered markup to be inserted into the DOM. | |
* @final | |
* @internal | |
*/ | |
mountComponent: function mountComponent(internalInstance, transaction, hostParent, hostContainerInfo, context, parentDebugID) // 0 in production and for roots | |
{ | |
if (process.env.NODE_ENV !== 'production') { | |
if (internalInstance._debugID !== 0) { | |
ReactInstrumentation.debugTool.onBeforeMountComponent(internalInstance._debugID, internalInstance._currentElement, parentDebugID); | |
} | |
} | |
var markup = internalInstance.mountComponent(transaction, hostParent, hostContainerInfo, context, parentDebugID); | |
if (internalInstance._currentElement && internalInstance._currentElement.ref != null) { | |
transaction.getReactMountReady().enqueue(attachRefs, internalInstance); | |
} | |
if (process.env.NODE_ENV !== 'production') { | |
if (internalInstance._debugID !== 0) { | |
ReactInstrumentation.debugTool.onMountComponent(internalInstance._debugID); | |
} | |
} | |
return markup; | |
}, | |
/** | |
* Returns a value that can be passed to | |
* ReactComponentEnvironment.replaceNodeWithMarkup. | |
*/ | |
getHostNode: function getHostNode(internalInstance) { | |
return internalInstance.getHostNode(); | |
}, | |
/** | |
* Releases any resources allocated by `mountComponent`. | |
* | |
* @final | |
* @internal | |
*/ | |
unmountComponent: function unmountComponent(internalInstance, safely) { | |
if (process.env.NODE_ENV !== 'production') { | |
if (internalInstance._debugID !== 0) { | |
ReactInstrumentation.debugTool.onBeforeUnmountComponent(internalInstance._debugID); | |
} | |
} | |
ReactRef.detachRefs(internalInstance, internalInstance._currentElement); | |
internalInstance.unmountComponent(safely); | |
if (process.env.NODE_ENV !== 'production') { | |
if (internalInstance._debugID !== 0) { | |
ReactInstrumentation.debugTool.onUnmountComponent(internalInstance._debugID); | |
} | |
} | |
}, | |
/** | |
* Update a component using a new element. | |
* | |
* @param {ReactComponent} internalInstance | |
* @param {ReactElement} nextElement | |
* @param {ReactReconcileTransaction} transaction | |
* @param {object} context | |
* @internal | |
*/ | |
receiveComponent: function receiveComponent(internalInstance, nextElement, transaction, context) { | |
var prevElement = internalInstance._currentElement; | |
if (nextElement === prevElement && context === internalInstance._context) { | |
// Since elements are immutable after the owner is rendered, | |
// we can do a cheap identity compare here to determine if this is a | |
// superfluous reconcile. It's possible for state to be mutable but such | |
// change should trigger an update of the owner which would recreate | |
// the element. We explicitly check for the existence of an owner since | |
// it's possible for an element created outside a composite to be | |
// deeply mutated and reused. | |
// TODO: Bailing out early is just a perf optimization right? | |
// TODO: Removing the return statement should affect correctness? | |
return; | |
} | |
if (process.env.NODE_ENV !== 'production') { | |
if (internalInstance._debugID !== 0) { | |
ReactInstrumentation.debugTool.onBeforeUpdateComponent(internalInstance._debugID, nextElement); | |
} | |
} | |
var refsChanged = ReactRef.shouldUpdateRefs(prevElement, nextElement); | |
if (refsChanged) { | |
ReactRef.detachRefs(internalInstance, prevElement); | |
} | |
internalInstance.receiveComponent(nextElement, transaction, context); | |
if (refsChanged && internalInstance._currentElement && internalInstance._currentElement.ref != null) { | |
transaction.getReactMountReady().enqueue(attachRefs, internalInstance); | |
} | |
if (process.env.NODE_ENV !== 'production') { | |
if (internalInstance._debugID !== 0) { | |
ReactInstrumentation.debugTool.onUpdateComponent(internalInstance._debugID); | |
} | |
} | |
}, | |
/** | |
* Flush any dirty changes in a component. | |
* | |
* @param {ReactComponent} internalInstance | |
* @param {ReactReconcileTransaction} transaction | |
* @internal | |
*/ | |
performUpdateIfNecessary: function performUpdateIfNecessary(internalInstance, transaction, updateBatchNumber) { | |
if (internalInstance._updateBatchNumber !== updateBatchNumber) { | |
// The component's enqueued batch number should always be the current | |
// batch or the following one. | |
process.env.NODE_ENV !== 'production' ? warning(internalInstance._updateBatchNumber == null || internalInstance._updateBatchNumber === updateBatchNumber + 1, 'performUpdateIfNecessary: Unexpected batch number (current %s, ' + 'pending %s)', updateBatchNumber, internalInstance._updateBatchNumber) : void 0; | |
return; | |
} | |
if (process.env.NODE_ENV !== 'production') { | |
if (internalInstance._debugID !== 0) { | |
ReactInstrumentation.debugTool.onBeforeUpdateComponent(internalInstance._debugID, internalInstance._currentElement); | |
} | |
} | |
internalInstance.performUpdateIfNecessary(transaction); | |
if (process.env.NODE_ENV !== 'production') { | |
if (internalInstance._debugID !== 0) { | |
ReactInstrumentation.debugTool.onUpdateComponent(internalInstance._debugID); | |
} | |
} | |
} | |
}; | |
module.exports = ReactReconciler; | |
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0))) | |
/***/ }), | |
/* 20 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
"use strict"; | |
/* WEBPACK VAR INJECTION */(function(process) {/** | |
* Copyright 2013-present, Facebook, Inc. | |
* All rights reserved. | |
* | |
* This source code is licensed under the BSD-style license found in the | |
* LICENSE file in the root directory of this source tree. An additional grant | |
* of patent rights can be found in the PATENTS file in the same directory. | |
* | |
*/ | |
var _assign = __webpack_require__(4); | |
var ReactBaseClasses = __webpack_require__(84); | |
var ReactChildren = __webpack_require__(381); | |
var ReactDOMFactories = __webpack_require__(382); | |
var ReactElement = __webpack_require__(15); | |
var ReactPropTypes = __webpack_require__(384); | |
var ReactVersion = __webpack_require__(386); | |
var createReactClass = __webpack_require__(388); | |
var onlyChild = __webpack_require__(390); | |
var createElement = ReactElement.createElement; | |
var createFactory = ReactElement.createFactory; | |
var cloneElement = ReactElement.cloneElement; | |
if (process.env.NODE_ENV !== 'production') { | |
var lowPriorityWarning = __webpack_require__(54); | |
var canDefineProperty = __webpack_require__(35); | |
var ReactElementValidator = __webpack_require__(86); | |
var didWarnPropTypesDeprecated = false; | |
createElement = ReactElementValidator.createElement; | |
createFactory = ReactElementValidator.createFactory; | |
cloneElement = ReactElementValidator.cloneElement; | |
} | |
var __spread = _assign; | |
var createMixin = function createMixin(mixin) { | |
return mixin; | |
}; | |
if (process.env.NODE_ENV !== 'production') { | |
var warnedForSpread = false; | |
var warnedForCreateMixin = false; | |
__spread = function __spread() { | |
lowPriorityWarning(warnedForSpread, '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.'); | |
warnedForSpread = true; | |
return _assign.apply(null, arguments); | |
}; | |
createMixin = function createMixin(mixin) { | |
lowPriorityWarning(warnedForCreateMixin, 'React.createMixin is deprecated and should not be used. ' + 'In React v16.0, it will be removed. ' + 'You can use this mixin directly instead. ' + 'See https://fb.me/createmixin-was-never-implemented for more info.'); | |
warnedForCreateMixin = true; | |
return mixin; | |
}; | |
} | |
var React = { | |
// Modern | |
Children: { | |
map: ReactChildren.map, | |
forEach: ReactChildren.forEach, | |
count: ReactChildren.count, | |
toArray: ReactChildren.toArray, | |
only: onlyChild | |
}, | |
Component: ReactBaseClasses.Component, | |
PureComponent: ReactBaseClasses.PureComponent, | |
createElement: createElement, | |
cloneElement: cloneElement, | |
isValidElement: ReactElement.isValidElement, | |
// Classic | |
PropTypes: ReactPropTypes, | |
createClass: createReactClass, | |
createFactory: createFactory, | |
createMixin: createMixin, | |
// This looks DOM specific but these are actually isomorphic helpers | |
// since they are just generating DOM strings. | |
DOM: ReactDOMFactories, | |
version: ReactVersion, | |
// Deprecated hook for JSX spread, don't use this for anything. | |
__spread: __spread | |
}; | |
if (process.env.NODE_ENV !== 'production') { | |
var warnedForCreateClass = false; | |
if (canDefineProperty) { | |
Object.defineProperty(React, 'PropTypes', { | |
get: function get() { | |
lowPriorityWarning(didWarnPropTypesDeprecated, 'Accessing PropTypes via the main React package is deprecated,' + ' and will be removed in React v16.0.' + ' Use the latest available v15.* prop-types package from npm instead.' + ' For info on usage, compatibility, migration and more, see ' + 'https://fb.me/prop-types-docs'); | |
didWarnPropTypesDeprecated = true; | |
return ReactPropTypes; | |
} | |
}); | |
Object.defineProperty(React, 'createClass', { | |
get: function get() { | |
lowPriorityWarning(warnedForCreateClass, 'Accessing createClass via the main React package is deprecated,' + ' and will be removed in React v16.0.' + " Use a plain JavaScript class instead. If you're not yet " + 'ready to migrate, create-react-class v15.* is available ' + 'on npm as a temporary, drop-in replacement. ' + 'For more info see https://fb.me/react-create-class'); | |
warnedForCreateClass = true; | |
return createReactClass; | |
} | |
}); | |
} | |
// React.DOM factories are deprecated. Wrap these methods so that | |
// invocations of the React.DOM namespace and alert users to switch | |
// to the `react-dom-factories` package. | |
React.DOM = {}; | |
var warnedForFactories = false; | |
Object.keys(ReactDOMFactories).forEach(function (factory) { | |
React.DOM[factory] = function () { | |
if (!warnedForFactories) { | |
lowPriorityWarning(false, 'Accessing factories like React.DOM.%s has been deprecated ' + 'and will be removed in v16.0+. Use the ' + 'react-dom-factories package instead. ' + ' Version 1.0 provides a drop-in replacement.' + ' For more info, see https://fb.me/react-dom-factories', factory); | |
warnedForFactories = true; | |
} | |
return ReactDOMFactories[factory].apply(ReactDOMFactories, arguments); | |
}; | |
}); | |
} | |
module.exports = React; | |
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0))) | |
/***/ }), | |
/* 21 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
"use strict"; | |
/** | |
* Copyright (c) 2013-present, Facebook, Inc. | |
* All rights reserved. | |
* | |
* This source code is licensed under the BSD-style license found in the | |
* LICENSE file in the root directory of this source tree. An additional grant | |
* of patent rights can be found in the PATENTS file in the same directory. | |
* | |
* | |
*/ | |
/** | |
* WARNING: DO NOT manually require this module. | |
* This is a replacement for `invariant(...)` used by the error code system | |
* and will _only_ be required by the corresponding babel pass. | |
* It always throws. | |
*/ | |
function reactProdInvariant(code) { | |
var argCount = arguments.length - 1; | |
var message = 'Minified React error #' + code + '; visit ' + 'http://facebook.github.io/react/docs/error-decoder.html?invariant=' + code; | |
for (var argIdx = 0; argIdx < argCount; argIdx++) { | |
message += '&args[]=' + encodeURIComponent(arguments[argIdx + 1]); | |
} | |
message += ' for the full message or use the non-minified dev environment' + ' for full errors and additional helpful warnings.'; | |
var error = new Error(message); | |
error.name = 'Invariant Violation'; | |
error.framesToPop = 1; // we don't care about reactProdInvariant's own frame | |
throw error; | |
} | |
module.exports = reactProdInvariant; | |
/***/ }), | |
/* 22 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
/* WEBPACK VAR INJECTION */(function(process) {var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; | |
/** | |
* Copyright 2013-present, Facebook, Inc. | |
* All rights reserved. | |
* | |
* This source code is licensed under the BSD-style license found in the | |
* LICENSE file in the root directory of this source tree. An additional grant | |
* of patent rights can be found in the PATENTS file in the same directory. | |
*/ | |
if (process.env.NODE_ENV !== 'production') { | |
var REACT_ELEMENT_TYPE = typeof Symbol === 'function' && Symbol.for && Symbol.for('react.element') || 0xeac7; | |
var isValidElement = function isValidElement(object) { | |
return (typeof object === 'undefined' ? 'undefined' : _typeof(object)) === 'object' && object !== null && object.$$typeof === REACT_ELEMENT_TYPE; | |
}; | |
// By explicitly using `prop-types` you are opting into new development behavior. | |
// http://fb.me/prop-types-in-prod | |
var throwOnDirectAccess = true; | |
module.exports = __webpack_require__(61)(isValidElement, throwOnDirectAccess); | |
} else { | |
// By explicitly using `prop-types` you are opting into new production behavior. | |
// http://fb.me/prop-types-in-prod | |
module.exports = __webpack_require__(306)(); | |
} | |
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0))) | |
/***/ }), | |
/* 23 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
"use strict"; | |
/* WEBPACK VAR INJECTION */(function(process) {/** | |
* Copyright 2013-present, Facebook, Inc. | |
* All rights reserved. | |
* | |
* This source code is licensed under the BSD-style license found in the | |
* LICENSE file in the root directory of this source tree. An additional grant | |
* of patent rights can be found in the PATENTS file in the same directory. | |
* | |
*/ | |
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; | |
var _prodInvariant = __webpack_require__(3); | |
var EventPluginRegistry = __webpack_require__(29); | |
var EventPluginUtils = __webpack_require__(41); | |
var ReactErrorUtils = __webpack_require__(45); | |
var accumulateInto = __webpack_require__(75); | |
var forEachAccumulated = __webpack_require__(76); | |
var invariant = __webpack_require__(1); | |
/** | |
* Internal store for event listeners | |
*/ | |
var listenerBank = {}; | |
/** | |
* Internal queue of events that have accumulated their dispatches and are | |
* waiting to have their dispatches executed. | |
*/ | |
var eventQueue = null; | |
/** | |
* Dispatches an event and releases it back into the pool, unless persistent. | |
* | |
* @param {?object} event Synthetic event to be dispatched. | |
* @param {boolean} simulated If the event is simulated (changes exn behavior) | |
* @private | |
*/ | |
var executeDispatchesAndRelease = function executeDispatchesAndRelease(event, simulated) { | |
if (event) { | |
EventPluginUtils.executeDispatchesInOrder(event, simulated); | |
if (!event.isPersistent()) { | |
event.constructor.release(event); | |
} | |
} | |
}; | |
var executeDispatchesAndReleaseSimulated = function executeDispatchesAndReleaseSimulated(e) { | |
return executeDispatchesAndRelease(e, true); | |
}; | |
var executeDispatchesAndReleaseTopLevel = function executeDispatchesAndReleaseTopLevel(e) { | |
return executeDispatchesAndRelease(e, false); | |
}; | |
var getDictionaryKey = function getDictionaryKey(inst) { | |
// Prevents V8 performance issue: | |
// https://github.com/facebook/react/pull/7232 | |
return '.' + inst._rootNodeID; | |
}; | |
function isInteractive(tag) { | |
return tag === 'button' || tag === 'input' || tag === 'select' || tag === 'textarea'; | |
} | |
function shouldPreventMouseEvent(name, type, props) { | |
switch (name) { | |
case 'onClick': | |
case 'onClickCapture': | |
case 'onDoubleClick': | |
case 'onDoubleClickCapture': | |
case 'onMouseDown': | |
case 'onMouseDownCapture': | |
case 'onMouseMove': | |
case 'onMouseMoveCapture': | |
case 'onMouseUp': | |
case 'onMouseUpCapture': | |
return !!(props.disabled && isInteractive(type)); | |
default: | |
return false; | |
} | |
} | |
/** | |
* This is a unified interface for event plugins to be installed and configured. | |
* | |
* Event plugins can implement the following properties: | |
* | |
* `extractEvents` {function(string, DOMEventTarget, string, object): *} | |
* Required. When a top-level event is fired, this method is expected to | |
* extract synthetic events that will in turn be queued and dispatched. | |
* | |
* `eventTypes` {object} | |
* Optional, plugins that fire events must publish a mapping of registration | |
* names that are used to register listeners. Values of this mapping must | |
* be objects that contain `registrationName` or `phasedRegistrationNames`. | |
* | |
* `executeDispatch` {function(object, function, string)} | |
* Optional, allows plugins to override how an event gets dispatched. By | |
* default, the listener is simply invoked. | |
* | |
* Each plugin that is injected into `EventsPluginHub` is immediately operable. | |
* | |
* @public | |
*/ | |
var EventPluginHub = { | |
/** | |
* Methods for injecting dependencies. | |
*/ | |
injection: { | |
/** | |
* @param {array} InjectedEventPluginOrder | |
* @public | |
*/ | |
injectEventPluginOrder: EventPluginRegistry.injectEventPluginOrder, | |
/** | |
* @param {object} injectedNamesToPlugins Map from names to plugin modules. | |
*/ | |
injectEventPluginsByName: EventPluginRegistry.injectEventPluginsByName | |
}, | |
/** | |
* Stores `listener` at `listenerBank[registrationName][key]`. Is idempotent. | |
* | |
* @param {object} inst The instance, which is the source of events. | |
* @param {string} registrationName Name of listener (e.g. `onClick`). | |
* @param {function} listener The callback to store. | |
*/ | |
putListener: function putListener(inst, registrationName, listener) { | |
!(typeof listener === 'function') ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Expected %s listener to be a function, instead got type %s', registrationName, typeof listener === 'undefined' ? 'undefined' : _typeof(listener)) : _prodInvariant('94', registrationName, typeof listener === 'undefined' ? 'undefined' : _typeof(listener)) : void 0; | |
var key = getDictionaryKey(inst); | |
var bankForRegistrationName = listenerBank[registrationName] || (listenerBank[registrationName] = {}); | |
bankForRegistrationName[key] = listener; | |
var PluginModule = EventPluginRegistry.registrationNameModules[registrationName]; | |
if (PluginModule && PluginModule.didPutListener) { | |
PluginModule.didPutListener(inst, registrationName, listener); | |
} | |
}, | |
/** | |
* @param {object} inst The instance, which is the source of events. | |
* @param {string} registrationName Name of listener (e.g. `onClick`). | |
* @return {?function} The stored callback. | |
*/ | |
getListener: function getListener(inst, registrationName) { | |
// TODO: shouldPreventMouseEvent is DOM-specific and definitely should not | |
// live here; needs to be moved to a better place soon | |
var bankForRegistrationName = listenerBank[registrationName]; | |
if (shouldPreventMouseEvent(registrationName, inst._currentElement.type, inst._currentElement.props)) { | |
return null; | |
} | |
var key = getDictionaryKey(inst); | |
return bankForRegistrationName && bankForRegistrationName[key]; | |
}, | |
/** | |
* Deletes a listener from the registration bank. | |
* | |
* @param {object} inst The instance, which is the source of events. | |
* @param {string} registrationName Name of listener (e.g. `onClick`). | |
*/ | |
deleteListener: function deleteListener(inst, registrationName) { | |
var PluginModule = EventPluginRegistry.registrationNameModules[registrationName]; | |
if (PluginModule && PluginModule.willDeleteListener) { | |
PluginModule.willDeleteListener(inst, registrationName); | |
} | |
var bankForRegistrationName = listenerBank[registrationName]; | |
// TODO: This should never be null -- when is it? | |
if (bankForRegistrationName) { | |
var key = getDictionaryKey(inst); | |
delete bankForRegistrationName[key]; | |
} | |
}, | |
/** | |
* Deletes all listeners for the DOM element with the supplied ID. | |
* | |
* @param {object} inst The instance, which is the source of events. | |
*/ | |
deleteAllListeners: function deleteAllListeners(inst) { | |
var key = getDictionaryKey(inst); | |
for (var registrationName in listenerBank) { | |
if (!listenerBank.hasOwnProperty(registrationName)) { | |
continue; | |
} | |
if (!listenerBank[registrationName][key]) { | |
continue; | |
} | |
var PluginModule = EventPluginRegistry.registrationNameModules[registrationName]; | |
if (PluginModule && PluginModule.willDeleteListener) { | |
PluginModule.willDeleteListener(inst, registrationName); | |
} | |
delete listenerBank[registrationName][key]; | |
} | |
}, | |
/** | |
* Allows registered plugins an opportunity to extract events from top-level | |
* native browser events. | |
* | |
* @return {*} An accumulation of synthetic events. | |
* @internal | |
*/ | |
extractEvents: function extractEvents(topLevelType, targetInst, nativeEvent, nativeEventTarget) { | |
var events; | |
var plugins = EventPluginRegistry.plugins; | |
for (var i = 0; i < plugins.length; i++) { | |
// Not every plugin in the ordering may be loaded at runtime. | |
var possiblePlugin = plugins[i]; | |
if (possiblePlugin) { | |
var extractedEvents = possiblePlugin.extractEvents(topLevelType, targetInst, nativeEvent, nativeEventTarget); | |
if (extractedEvents) { | |
events = accumulateInto(events, extractedEvents); | |
} | |
} | |
} | |
return events; | |
}, | |
/** | |
* Enqueues a synthetic event that should be dispatched when | |
* `processEventQueue` is invoked. | |
* | |
* @param {*} events An accumulation of synthetic events. | |
* @internal | |
*/ | |
enqueueEvents: function enqueueEvents(events) { | |
if (events) { | |
eventQueue = accumulateInto(eventQueue, events); | |
} | |
}, | |
/** | |
* Dispatches all synthetic events on the event queue. | |
* | |
* @internal | |
*/ | |
processEventQueue: function processEventQueue(simulated) { | |
// Set `eventQueue` to null before processing it so that we can tell if more | |
// events get enqueued while processing. | |
var processingEventQueue = eventQueue; | |
eventQueue = null; | |
if (simulated) { | |
forEachAccumulated(processingEventQueue, executeDispatchesAndReleaseSimulated); | |
} else { | |
forEachAccumulated(processingEventQueue, executeDispatchesAndReleaseTopLevel); | |
} | |
!!eventQueue ? process.env.NODE_ENV !== 'production' ? invariant(false, 'processEventQueue(): Additional events were enqueued while processing an event queue. Support for this has not yet been implemented.') : _prodInvariant('95') : void 0; | |
// This would be a good time to rethrow if any of the event handlers threw. | |
ReactErrorUtils.rethrowCaughtError(); | |
}, | |
/** | |
* These are needed for tests only. Do not use! | |
*/ | |
__purge: function __purge() { | |
listenerBank = {}; | |
}, | |
__getListenerBank: function __getListenerBank() { | |
return listenerBank; | |
} | |
}; | |
module.exports = EventPluginHub; | |
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0))) | |
/***/ }), | |
/* 24 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
"use strict"; | |
/* WEBPACK VAR INJECTION */(function(process) {/** | |
* Copyright 2013-present, Facebook, Inc. | |
* All rights reserved. | |
* | |
* This source code is licensed under the BSD-style license found in the | |
* LICENSE file in the root directory of this source tree. An additional grant | |
* of patent rights can be found in the PATENTS file in the same directory. | |
* | |
*/ | |
var EventPluginHub = __webpack_require__(23); | |
var EventPluginUtils = __webpack_require__(41); | |
var accumulateInto = __webpack_require__(75); | |
var forEachAccumulated = __webpack_require__(76); | |
var warning = __webpack_require__(2); | |
var getListener = EventPluginHub.getListener; | |
/** | |
* Some event types have a notion of different registration names for different | |
* "phases" of propagation. This finds listeners by a given phase. | |
*/ | |
function listenerAtPhase(inst, event, propagationPhase) { | |
var registrationName = event.dispatchConfig.phasedRegistrationNames[propagationPhase]; | |
return getListener(inst, registrationName); | |
} | |
/** | |
* Tags a `SyntheticEvent` with dispatched listeners. Creating this function | |
* here, allows us to not have to bind or create functions for each event. | |
* Mutating the event's members allows us to not have to create a wrapping | |
* "dispatch" object that pairs the event with the listener. | |
*/ | |
function accumulateDirectionalDispatches(inst, phase, event) { | |
if (process.env.NODE_ENV !== 'production') { | |
process.env.NODE_ENV !== 'production' ? warning(inst, 'Dispatching inst must not be null') : void 0; | |
} | |
var listener = listenerAtPhase(inst, event, phase); | |
if (listener) { | |
event._dispatchListeners = accumulateInto(event._dispatchListeners, listener); | |
event._dispatchInstances = accumulateInto(event._dispatchInstances, inst); | |
} | |
} | |
/** | |
* Collect dispatches (must be entirely collected before dispatching - see unit | |
* tests). Lazily allocate the array to conserve memory. We must loop through | |
* each event and perform the traversal for each one. We cannot perform a | |
* single traversal for the entire collection of events because each event may | |
* have a different target. | |
*/ | |
function accumulateTwoPhaseDispatchesSingle(event) { | |
if (event && event.dispatchConfig.phasedRegistrationNames) { | |
EventPluginUtils.traverseTwoPhase(event._targetInst, accumulateDirectionalDispatches, event); | |
} | |
} | |
/** | |
* Same as `accumulateTwoPhaseDispatchesSingle`, but skips over the targetID. | |
*/ | |
function accumulateTwoPhaseDispatchesSingleSkipTarget(event) { | |
if (event && event.dispatchConfig.phasedRegistrationNames) { | |
var targetInst = event._targetInst; | |
var parentInst = targetInst ? EventPluginUtils.getParentInstance(targetInst) : null; | |
EventPluginUtils.traverseTwoPhase(parentInst, accumulateDirectionalDispatches, event); | |
} | |
} | |
/** | |
* Accumulates without regard to direction, does not look for phased | |
* registration names. Same as `accumulateDirectDispatchesSingle` but without | |
* requiring that the `dispatchMarker` be the same as the dispatched ID. | |
*/ | |
function accumulateDispatches(inst, ignoredDirection, event) { | |
if (event && event.dispatchConfig.registrationName) { | |
var registrationName = event.dispatchConfig.registrationName; | |
var listener = getListener(inst, registrationName); | |
if (listener) { | |
event._dispatchListeners = accumulateInto(event._dispatchListeners, listener); | |
event._dispatchInstances = accumulateInto(event._dispatchInstances, inst); | |
} | |
} | |
} | |
/** | |
* Accumulates dispatches on an `SyntheticEvent`, but only for the | |
* `dispatchMarker`. | |
* @param {SyntheticEvent} event | |
*/ | |
function accumulateDirectDispatchesSingle(event) { | |
if (event && event.dispatchConfig.registrationName) { | |
accumulateDispatches(event._targetInst, null, event); | |
} | |
} | |
function accumulateTwoPhaseDispatches(events) { | |
forEachAccumulated(events, accumulateTwoPhaseDispatchesSingle); | |
} | |
function accumulateTwoPhaseDispatchesSkipTarget(events) { | |
forEachAccumulated(events, accumulateTwoPhaseDispatchesSingleSkipTarget); | |
} | |
function accumulateEnterLeaveDispatches(leave, enter, from, to) { | |
EventPluginUtils.traverseEnterLeave(from, to, accumulateDispatches, leave, enter); | |
} | |
function accumulateDirectDispatches(events) { | |
forEachAccumulated(events, accumulateDirectDispatchesSingle); | |
} | |
/** | |
* A small set of propagation patterns, each of which will accept a small amount | |
* of information, and generate a set of "dispatch ready event objects" - which | |
* are sets of events that have already been annotated with a set of dispatched | |
* listener functions/ids. The API is designed this way to discourage these | |
* propagation strategies from actually executing the dispatches, since we | |
* always want to collect the entire set of dispatches before executing event a | |
* single one. | |
* | |
* @constructor EventPropagators | |
*/ | |
var EventPropagators = { | |
accumulateTwoPhaseDispatches: accumulateTwoPhaseDispatches, | |
accumulateTwoPhaseDispatchesSkipTarget: accumulateTwoPhaseDispatchesSkipTarget, | |
accumulateDirectDispatches: accumulateDirectDispatches, | |
accumulateEnterLeaveDispatches: accumulateEnterLeaveDispatches | |
}; | |
module.exports = EventPropagators; | |
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0))) | |
/***/ }), | |
/* 25 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
"use strict"; | |
/** | |
* Copyright 2013-present, Facebook, Inc. | |
* All rights reserved. | |
* | |
* This source code is licensed under the BSD-style license found in the | |
* LICENSE file in the root directory of this source tree. An additional grant | |
* of patent rights can be found in the PATENTS file in the same directory. | |
* | |
*/ | |
/** | |
* `ReactInstanceMap` maintains a mapping from a public facing stateful | |
* instance (key) and the internal representation (value). This allows public | |
* methods to accept the user facing instance as an argument and map them back | |
* to internal methods. | |
*/ | |
// TODO: Replace this with ES6: var ReactInstanceMap = new Map(); | |
var ReactInstanceMap = { | |
/** | |
* This API should be called `delete` but we'd have to make sure to always | |
* transform these to strings for IE support. When this transform is fully | |
* supported we can rename it. | |
*/ | |
remove: function remove(key) { | |
key._reactInternalInstance = undefined; | |
}, | |
get: function get(key) { | |
return key._reactInternalInstance; | |
}, | |
has: function has(key) { | |
return key._reactInternalInstance !== undefined; | |
}, | |
set: function set(key, value) { | |
key._reactInternalInstance = value; | |
} | |
}; | |
module.exports = ReactInstanceMap; | |
/***/ }), | |
/* 26 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
"use strict"; | |
/** | |
* Copyright 2013-present, Facebook, Inc. | |
* All rights reserved. | |
* | |
* This source code is licensed under the BSD-style license found in the | |
* LICENSE file in the root directory of this source tree. An additional grant | |
* of patent rights can be found in the PATENTS file in the same directory. | |
* | |
*/ | |
var SyntheticEvent = __webpack_require__(12); | |
var getEventTarget = __webpack_require__(50); | |
/** | |
* @interface UIEvent | |
* @see http://www.w3.org/TR/DOM-Level-3-Events/ | |
*/ | |
var UIEventInterface = { | |
view: function view(event) { | |
if (event.view) { | |
return event.view; | |
} | |
var target = getEventTarget(event); | |
if (target.window === target) { | |
// target is a window object | |
return target; | |
} | |
var doc = target.ownerDocument; | |
// TODO: Figure out why `ownerDocument` is sometimes undefined in IE8. | |
if (doc) { | |
return doc.defaultView || doc.parentWindow; | |
} else { | |
return window; | |
} | |
}, | |
detail: function detail(event) { | |
return event.detail || 0; | |
} | |
}; | |
/** | |
* @param {object} dispatchConfig Configuration used to dispatch this event. | |
* @param {string} dispatchMarker Marker identifying the event target. | |
* @param {object} nativeEvent Native browser event. | |
* @extends {SyntheticEvent} | |
*/ | |
function SyntheticUIEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) { | |
return SyntheticEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget); | |
} | |
SyntheticEvent.augmentClass(SyntheticUIEvent, UIEventInterface); | |
module.exports = SyntheticUIEvent; | |
/***/ }), | |
/* 27 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
"use strict"; | |
/* WEBPACK VAR INJECTION */(function(process) {/** | |
* Copyright (c) 2013-present, Facebook, Inc. | |
* All rights reserved. | |
* | |
* This source code is licensed under the BSD-style license found in the | |
* LICENSE file in the root directory of this source tree. An additional grant | |
* of patent rights can be found in the PATENTS file in the same directory. | |
* | |
*/ | |
var emptyObject = {}; | |
if (process.env.NODE_ENV !== 'production') { | |
Object.freeze(emptyObject); | |
} | |
module.exports = emptyObject; | |
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0))) | |
/***/ }), | |
/* 28 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
/* WEBPACK VAR INJECTION */(function(module) {var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; | |
/*! | |
* jQuery JavaScript Library v3.2.1 | |
* https://jquery.com/ | |
* | |
* Includes Sizzle.js | |
* https://sizzlejs.com/ | |
* | |
* Copyright JS Foundation and other contributors | |
* Released under the MIT license | |
* https://jquery.org/license | |
* | |
* Date: 2017-03-20T18:59Z | |
*/ | |
(function (global, factory) { | |
"use strict"; | |
if (( false ? "undefined" : _typeof(module)) === "object" && _typeof(module.exports) === "object") { | |
// For CommonJS and CommonJS-like environments where a proper `window` | |
// is present, execute the factory and get jQuery. | |
// For environments that do not have a `window` with a `document` | |
// (such as Node.js), expose a factory as module.exports. | |
// This accentuates the need for the creation of a real `window`. | |
// e.g. var jQuery = require("jquery")(window); | |
// See ticket #14549 for more info. | |
module.exports = global.document ? factory(global, true) : function (w) { | |
if (!w.document) { | |
throw new Error("jQuery requires a window with a document"); | |
} | |
return factory(w); | |
}; | |
} else { | |
factory(global); | |
} | |
// Pass this if window is not defined yet | |
})(typeof window !== "undefined" ? window : this, function (window, noGlobal) { | |
// Edge <= 12 - 13+, Firefox <=18 - 45+, IE 10 - 11, Safari 5.1 - 9+, iOS 6 - 9.1 | |
// throw exceptions when non-strict code (e.g., ASP.NET 4.5) accesses strict mode | |
// arguments.callee.caller (trac-13335). But as of jQuery 3.0 (2016), strict mode should be common | |
// enough that all such attempts are guarded in a try block. | |
"use strict"; | |
var arr = []; | |
var document = window.document; | |
var getProto = Object.getPrototypeOf; | |
var _slice = arr.slice; | |
var concat = arr.concat; | |
var push = arr.push; | |
var indexOf = arr.indexOf; | |
var class2type = {}; | |
var toString = class2type.toString; | |
var hasOwn = class2type.hasOwnProperty; | |
var fnToString = hasOwn.toString; | |
var ObjectFunctionString = fnToString.call(Object); | |
var support = {}; | |
function DOMEval(code, doc) { | |
doc = doc || document; | |
var script = doc.createElement("script"); | |
script.text = code; | |
doc.head.appendChild(script).parentNode.removeChild(script); | |
} | |
/* global Symbol */ | |
// Defining this global in .eslintrc.json would create a danger of using the global | |
// unguarded in another place, it seems safer to define global only for this module | |
var version = "3.2.1", | |
// Define a local copy of jQuery | |
jQuery = function jQuery(selector, context) { | |
// The jQuery object is actually just the init constructor 'enhanced' | |
// Need init if jQuery is called (just allow error to be thrown if not included) | |
return new jQuery.fn.init(selector, context); | |
}, | |
// Support: Android <=4.0 only | |
// Make sure we trim BOM and NBSP | |
rtrim = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, | |
// Matches dashed string for camelizing | |
rmsPrefix = /^-ms-/, | |
rdashAlpha = /-([a-z])/g, | |
// Used by jQuery.camelCase as callback to replace() | |
fcamelCase = function fcamelCase(all, letter) { | |
return letter.toUpperCase(); | |
}; | |
jQuery.fn = jQuery.prototype = { | |
// The current version of jQuery being used | |
jquery: version, | |
constructor: jQuery, | |
// The default length of a jQuery object is 0 | |
length: 0, | |
toArray: function toArray() { | |
return _slice.call(this); | |
}, | |
// Get the Nth element in the matched element set OR | |
// Get the whole matched element set as a clean array | |
get: function get(num) { | |
// Return all the elements in a clean array | |
if (num == null) { | |
return _slice.call(this); | |
} | |
// Return just the one element from the set | |
return num < 0 ? this[num + this.length] : this[num]; | |
}, | |
// Take an array of elements and push it onto the stack | |
// (returning the new matched element set) | |
pushStack: function pushStack(elems) { | |
// Build a new jQuery matched element set | |
var ret = jQuery.merge(this.constructor(), elems); | |
// Add the old object onto the stack (as a reference) | |
ret.prevObject = this; | |
// Return the newly-formed element set | |
return ret; | |
}, | |
// Execute a callback for every element in the matched set. | |
each: function each(callback) { | |
return jQuery.each(this, callback); | |
}, | |
map: function map(callback) { | |
return this.pushStack(jQuery.map(this, function (elem, i) { | |
return callback.call(elem, i, elem); | |
})); | |
}, | |
slice: function slice() { | |
return this.pushStack(_slice.apply(this, arguments)); | |
}, | |
first: function first() { | |
return this.eq(0); | |
}, | |
last: function last() { | |
return this.eq(-1); | |
}, | |
eq: function eq(i) { | |
var len = this.length, | |
j = +i + (i < 0 ? len : 0); | |
return this.pushStack(j >= 0 && j < len ? [this[j]] : []); | |
}, | |
end: function end() { | |
return this.prevObject || this.constructor(); | |
}, | |
// For internal use only. | |
// Behaves like an Array's method, not like a jQuery method. | |
push: push, | |
sort: arr.sort, | |
splice: arr.splice | |
}; | |
jQuery.extend = jQuery.fn.extend = function () { | |
var options, | |
name, | |
src, | |
copy, | |
copyIsArray, | |
clone, | |
target = arguments[0] || {}, | |
i = 1, | |
length = arguments.length, | |
deep = false; | |
// Handle a deep copy situation | |
if (typeof target === "boolean") { | |
deep = target; | |
// Skip the boolean and the target | |
target = arguments[i] || {}; | |
i++; | |
} | |
// Handle case when target is a string or something (possible in deep copy) | |
if ((typeof target === "undefined" ? "undefined" : _typeof(target)) !== "object" && !jQuery.isFunction(target)) { | |
target = {}; | |
} | |
// Extend jQuery itself if only one argument is passed | |
if (i === length) { | |
target = this; | |
i--; | |
} | |
for (; i < length; i++) { | |
// Only deal with non-null/undefined values | |
if ((options = arguments[i]) != null) { | |
// Extend the base object | |
for (name in options) { | |
src = target[name]; | |
copy = options[name]; | |
// Prevent never-ending loop | |
if (target === copy) { | |
continue; | |
} | |
// Recurse if we're merging plain objects or arrays | |
if (deep && copy && (jQuery.isPlainObject(copy) || (copyIsArray = Array.isArray(copy)))) { | |
if (copyIsArray) { | |
copyIsArray = false; | |
clone = src && Array.isArray(src) ? src : []; | |
} else { | |
clone = src && jQuery.isPlainObject(src) ? src : {}; | |
} | |
// Never move original objects, clone them | |
target[name] = jQuery.extend(deep, clone, copy); | |
// Don't bring in undefined values | |
} else if (copy !== undefined) { | |
target[name] = copy; | |
} | |
} | |
} | |
} | |
// Return the modified object | |
return target; | |
}; | |
jQuery.extend({ | |
// Unique for each copy of jQuery on the page | |
expando: "jQuery" + (version + Math.random()).replace(/\D/g, ""), | |
// Assume jQuery is ready without the ready module | |
isReady: true, | |
error: function error(msg) { | |
throw new Error(msg); | |
}, | |
noop: function noop() {}, | |
isFunction: function isFunction(obj) { | |
return jQuery.type(obj) === "function"; | |
}, | |
isWindow: function isWindow(obj) { | |
return obj != null && obj === obj.window; | |
}, | |
isNumeric: function isNumeric(obj) { | |
// As of jQuery 3.0, isNumeric is limited to | |
// strings and numbers (primitives or objects) | |
// that can be coerced to finite numbers (gh-2662) | |
var type = jQuery.type(obj); | |
return (type === "number" || type === "string") && | |
// parseFloat NaNs numeric-cast false positives ("") | |
// ...but misinterprets leading-number strings, particularly hex literals ("0x...") | |
// subtraction forces infinities to NaN | |
!isNaN(obj - parseFloat(obj)); | |
}, | |
isPlainObject: function isPlainObject(obj) { | |
var proto, Ctor; | |
// Detect obvious negatives | |
// Use toString instead of jQuery.type to catch host objects | |
if (!obj || toString.call(obj) !== "[object Object]") { | |
return false; | |
} | |
proto = getProto(obj); | |
// Objects with no prototype (e.g., `Object.create( null )`) are plain | |
if (!proto) { | |
return true; | |
} | |
// Objects with prototype are plain iff they were constructed by a global Object function | |
Ctor = hasOwn.call(proto, "constructor") && proto.constructor; | |
return typeof Ctor === "function" && fnToString.call(Ctor) === ObjectFunctionString; | |
}, | |
isEmptyObject: function isEmptyObject(obj) { | |
/* eslint-disable no-unused-vars */ | |
// See https://github.com/eslint/eslint/issues/6125 | |
var name; | |
for (name in obj) { | |
return false; | |
} | |
return true; | |
}, | |
type: function type(obj) { | |
if (obj == null) { | |
return obj + ""; | |
} | |
// Support: Android <=2.3 only (functionish RegExp) | |
return (typeof obj === "undefined" ? "undefined" : _typeof(obj)) === "object" || typeof obj === "function" ? class2type[toString.call(obj)] || "object" : typeof obj === "undefined" ? "undefined" : _typeof(obj); | |
}, | |
// Evaluates a script in a global context | |
globalEval: function globalEval(code) { | |
DOMEval(code); | |
}, | |
// Convert dashed to camelCase; used by the css and data modules | |
// Support: IE <=9 - 11, Edge 12 - 13 | |
// Microsoft forgot to hump their vendor prefix (#9572) | |
camelCase: function camelCase(string) { | |
return string.replace(rmsPrefix, "ms-").replace(rdashAlpha, fcamelCase); | |
}, | |
each: function each(obj, callback) { | |
var length, | |
i = 0; | |
if (isArrayLike(obj)) { | |
length = obj.length; | |
for (; i < length; i++) { | |
if (callback.call(obj[i], i, obj[i]) === false) { | |
break; | |
} | |
} | |
} else { | |
for (i in obj) { | |
if (callback.call(obj[i], i, obj[i]) === false) { | |
break; | |
} | |
} | |
} | |
return obj; | |
}, | |
// Support: Android <=4.0 only | |
trim: function trim(text) { | |
return text == null ? "" : (text + "").replace(rtrim, ""); | |
}, | |
// results is for internal usage only | |
makeArray: function makeArray(arr, results) { | |
var ret = results || []; | |
if (arr != null) { | |
if (isArrayLike(Object(arr))) { | |
jQuery.merge(ret, typeof arr === "string" ? [arr] : arr); | |
} else { | |
push.call(ret, arr); | |
} | |
} | |
return ret; | |
}, | |
inArray: function inArray(elem, arr, i) { | |
return arr == null ? -1 : indexOf.call(arr, elem, i); | |
}, | |
// Support: Android <=4.0 only, PhantomJS 1 only | |
// push.apply(_, arraylike) throws on ancient WebKit | |
merge: function merge(first, second) { | |
var len = +second.length, | |
j = 0, | |
i = first.length; | |
for (; j < len; j++) { | |
first[i++] = second[j]; | |
} | |
first.length = i; | |
return first; | |
}, | |
grep: function grep(elems, callback, invert) { | |
var callbackInverse, | |
matches = [], | |
i = 0, | |
length = elems.length, | |
callbackExpect = !invert; | |
// Go through the array, only saving the items | |
// that pass the validator function | |
for (; i < length; i++) { | |
callbackInverse = !callback(elems[i], i); | |
if (callbackInverse !== callbackExpect) { | |
matches.push(elems[i]); | |
} | |
} | |
return matches; | |
}, | |
// arg is for internal usage only | |
map: function map(elems, callback, arg) { | |
var length, | |
value, | |
i = 0, | |
ret = []; | |
// Go through the array, translating each of the items to their new values | |
if (isArrayLike(elems)) { | |
length = elems.length; | |
for (; i < length; i++) { | |
value = callback(elems[i], i, arg); | |
if (value != null) { | |
ret.push(value); | |
} | |
} | |
// Go through every key on the object, | |
} else { | |
for (i in elems) { | |
value = callback(elems[i], i, arg); | |
if (value != null) { | |
ret.push(value); | |
} | |
} | |
} | |
// Flatten any nested arrays | |
return concat.apply([], ret); | |
}, | |
// A global GUID counter for objects | |
guid: 1, | |
// Bind a function to a context, optionally partially applying any | |
// arguments. | |
proxy: function proxy(fn, context) { | |
var tmp, args, proxy; | |
if (typeof context === "string") { | |
tmp = fn[context]; | |
context = fn; | |
fn = tmp; | |
} | |
// Quick check to determine if target is callable, in the spec | |
// this throws a TypeError, but we will just return undefined. | |
if (!jQuery.isFunction(fn)) { | |
return undefined; | |
} | |
// Simulated bind | |
args = _slice.call(arguments, 2); | |
proxy = function proxy() { | |
return fn.apply(context || this, args.concat(_slice.call(arguments))); | |
}; | |
// Set the guid of unique handler to the same of original handler, so it can be removed | |
proxy.guid = fn.guid = fn.guid || jQuery.guid++; | |
return proxy; | |
}, | |
now: Date.now, | |
// jQuery.support is not used in Core but other projects attach their | |
// properties to it so it needs to exist. | |
support: support | |
}); | |
if (typeof Symbol === "function") { | |
jQuery.fn[Symbol.iterator] = arr[Symbol.iterator]; | |
} | |
// Populate the class2type map | |
jQuery.each("Boolean Number String Function Array Date RegExp Object Error Symbol".split(" "), function (i, name) { | |
class2type["[object " + name + "]"] = name.toLowerCase(); | |
}); | |
function isArrayLike(obj) { | |
// Support: real iOS 8.2 only (not reproducible in simulator) | |
// `in` check used to prevent JIT error (gh-2145) | |
// hasOwn isn't used here due to false negatives | |
// regarding Nodelist length in IE | |
var length = !!obj && "length" in obj && obj.length, | |
type = jQuery.type(obj); | |
if (type === "function" || jQuery.isWindow(obj)) { | |
return false; | |
} | |
return type === "array" || length === 0 || typeof length === "number" && length > 0 && length - 1 in obj; | |
} | |
var Sizzle = | |
/*! | |
* Sizzle CSS Selector Engine v2.3.3 | |
* https://sizzlejs.com/ | |
* | |
* Copyright jQuery Foundation and other contributors | |
* Released under the MIT license | |
* http://jquery.org/license | |
* | |
* Date: 2016-08-08 | |
*/ | |
function (window) { | |
var i, | |
support, | |
Expr, | |
getText, | |
isXML, | |
tokenize, | |
compile, | |
select, | |
outermostContext, | |
sortInput, | |
hasDuplicate, | |
// Local document vars | |
setDocument, | |
document, | |
docElem, | |
documentIsHTML, | |
rbuggyQSA, | |
rbuggyMatches, | |
matches, | |
contains, | |
// Instance-specific data | |
expando = "sizzle" + 1 * new Date(), | |
preferredDoc = window.document, | |
dirruns = 0, | |
done = 0, | |
classCache = createCache(), | |
tokenCache = createCache(), | |
compilerCache = createCache(), | |
sortOrder = function sortOrder(a, b) { | |
if (a === b) { | |
hasDuplicate = true; | |
} | |
return 0; | |
}, | |
// Instance methods | |
hasOwn = {}.hasOwnProperty, | |
arr = [], | |
pop = arr.pop, | |
push_native = arr.push, | |
push = arr.push, | |
slice = arr.slice, | |
// Use a stripped-down indexOf as it's faster than native | |
// https://jsperf.com/thor-indexof-vs-for/5 | |
indexOf = function indexOf(list, elem) { | |
var i = 0, | |
len = list.length; | |
for (; i < len; i++) { | |
if (list[i] === elem) { | |
return i; | |
} | |
} | |
return -1; | |
}, | |
booleans = "checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped", | |
// Regular expressions | |
// http://www.w3.org/TR/css3-selectors/#whitespace | |
whitespace = "[\\x20\\t\\r\\n\\f]", | |
// http://www.w3.org/TR/CSS21/syndata.html#value-def-identifier | |
identifier = "(?:\\\\.|[\\w-]|[^\0-\\xa0])+", | |
// Attribute selectors: http://www.w3.org/TR/selectors/#attribute-selectors | |
attributes = "\\[" + whitespace + "*(" + identifier + ")(?:" + whitespace + | |
// Operator (capture 2) | |
"*([*^$|!~]?=)" + whitespace + | |
// "Attribute values must be CSS identifiers [capture 5] or strings [capture 3 or capture 4]" | |
"*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|(" + identifier + "))|)" + whitespace + "*\\]", | |
pseudos = ":(" + identifier + ")(?:\\((" + | |
// To reduce the number of selectors needing tokenize in the preFilter, prefer arguments: | |
// 1. quoted (capture 3; capture 4 or capture 5) | |
"('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|" + | |
// 2. simple (capture 6) | |
"((?:\\\\.|[^\\\\()[\\]]|" + attributes + ")*)|" + | |
// 3. anything else (capture 2) | |
".*" + ")\\)|)", | |
// Leading and non-escaped trailing whitespace, capturing some non-whitespace characters preceding the latter | |
rwhitespace = new RegExp(whitespace + "+", "g"), | |
rtrim = new RegExp("^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" + whitespace + "+$", "g"), | |
rcomma = new RegExp("^" + whitespace + "*," + whitespace + "*"), | |
rcombinators = new RegExp("^" + whitespace + "*([>+~]|" + whitespace + ")" + whitespace + "*"), | |
rattributeQuotes = new RegExp("=" + whitespace + "*([^\\]'\"]*?)" + whitespace + "*\\]", "g"), | |
rpseudo = new RegExp(pseudos), | |
ridentifier = new RegExp("^" + identifier + "$"), | |
matchExpr = { | |
"ID": new RegExp("^#(" + identifier + ")"), | |
"CLASS": new RegExp("^\\.(" + identifier + ")"), | |
"TAG": new RegExp("^(" + identifier + "|[*])"), | |
"ATTR": new RegExp("^" + attributes), | |
"PSEUDO": new RegExp("^" + pseudos), | |
"CHILD": new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\(" + whitespace + "*(even|odd|(([+-]|)(\\d*)n|)" + whitespace + "*(?:([+-]|)" + whitespace + "*(\\d+)|))" + whitespace + "*\\)|)", "i"), | |
"bool": new RegExp("^(?:" + booleans + ")$", "i"), | |
// For use in libraries implementing .is() | |
// We use this for POS matching in `select` | |
"needsContext": new RegExp("^" + whitespace + "*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\(" + whitespace + "*((?:-\\d)?\\d*)" + whitespace + "*\\)|)(?=[^-]|$)", "i") | |
}, | |
rinputs = /^(?:input|select|textarea|button)$/i, | |
rheader = /^h\d$/i, | |
rnative = /^[^{]+\{\s*\[native \w/, | |
// Easily-parseable/retrievable ID or TAG or CLASS selectors | |
rquickExpr = /^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/, | |
rsibling = /[+~]/, | |
// CSS escapes | |
// http://www.w3.org/TR/CSS21/syndata.html#escaped-characters | |
runescape = new RegExp("\\\\([\\da-f]{1,6}" + whitespace + "?|(" + whitespace + ")|.)", "ig"), | |
funescape = function funescape(_, escaped, escapedWhitespace) { | |
var high = "0x" + escaped - 0x10000; | |
// NaN means non-codepoint | |
// Support: Firefox<24 | |
// Workaround erroneous numeric interpretation of +"0x" | |
return high !== high || escapedWhitespace ? escaped : high < 0 ? | |
// BMP codepoint | |
String.fromCharCode(high + 0x10000) : | |
// Supplemental Plane codepoint (surrogate pair) | |
String.fromCharCode(high >> 10 | 0xD800, high & 0x3FF | 0xDC00); | |
}, | |
// CSS string/identifier serialization | |
// https://drafts.csswg.org/cssom/#common-serializing-idioms | |
rcssescape = /([\0-\x1f\x7f]|^-?\d)|^-$|[^\0-\x1f\x7f-\uFFFF\w-]/g, | |
fcssescape = function fcssescape(ch, asCodePoint) { | |
if (asCodePoint) { | |
// U+0000 NULL becomes U+FFFD REPLACEMENT CHARACTER | |
if (ch === "\0") { | |
return "\uFFFD"; | |
} | |
// Control characters and (dependent upon position) numbers get escaped as code points | |
return ch.slice(0, -1) + "\\" + ch.charCodeAt(ch.length - 1).toString(16) + " "; | |
} | |
// Other potentially-special ASCII characters get backslash-escaped | |
return "\\" + ch; | |
}, | |
// Used for iframes | |
// See setDocument() | |
// Removing the function wrapper causes a "Permission Denied" | |
// error in IE | |
unloadHandler = function unloadHandler() { | |
setDocument(); | |
}, | |
disabledAncestor = addCombinator(function (elem) { | |
return elem.disabled === true && ("form" in elem || "label" in elem); | |
}, { dir: "parentNode", next: "legend" }); | |
// Optimize for push.apply( _, NodeList ) | |
try { | |
push.apply(arr = slice.call(preferredDoc.childNodes), preferredDoc.childNodes); | |
// Support: Android<4.0 | |
// Detect silently failing push.apply | |
arr[preferredDoc.childNodes.length].nodeType; | |
} catch (e) { | |
push = { apply: arr.length ? | |
// Leverage slice if possible | |
function (target, els) { | |
push_native.apply(target, slice.call(els)); | |
} : | |
// Support: IE<9 | |
// Otherwise append directly | |
function (target, els) { | |
var j = target.length, | |
i = 0; | |
// Can't trust NodeList.length | |
while (target[j++] = els[i++]) {} | |
target.length = j - 1; | |
} | |
}; | |
} | |
function Sizzle(selector, context, results, seed) { | |
var m, | |
i, | |
elem, | |
nid, | |
match, | |
groups, | |
newSelector, | |
newContext = context && context.ownerDocument, | |
// nodeType defaults to 9, since context defaults to document | |
nodeType = context ? context.nodeType : 9; | |
results = results || []; | |
// Return early from calls with invalid selector or context | |
if (typeof selector !== "string" || !selector || nodeType !== 1 && nodeType !== 9 && nodeType !== 11) { | |
return results; | |
} | |
// Try to shortcut find operations (as opposed to filters) in HTML documents | |
if (!seed) { | |
if ((context ? context.ownerDocument || context : preferredDoc) !== document) { | |
setDocument(context); | |
} | |
context = context || document; | |
if (documentIsHTML) { | |
// If the selector is sufficiently simple, try using a "get*By*" DOM method | |
// (excepting DocumentFragment context, where the methods don't exist) | |
if (nodeType !== 11 && (match = rquickExpr.exec(selector))) { | |
// ID selector | |
if (m = match[1]) { | |
// Document context | |
if (nodeType === 9) { | |
if (elem = context.getElementById(m)) { | |
// Support: IE, Opera, Webkit | |
// TODO: identify versions | |
// getElementById can match elements by name instead of ID | |
if (elem.id === m) { | |
results.push(elem); | |
return results; | |
} | |
} else { | |
return results; | |
} | |
// Element context | |
} else { | |
// Support: IE, Opera, Webkit | |
// TODO: identify versions | |
// getElementById can match elements by name instead of ID | |
if (newContext && (elem = newContext.getElementById(m)) && contains(context, elem) && elem.id === m) { | |
results.push(elem); | |
return results; | |
} | |
} | |
// Type selector | |
} else if (match[2]) { | |
push.apply(results, context.getElementsByTagName(selector)); | |
return results; | |
// Class selector | |
} else if ((m = match[3]) && support.getElementsByClassName && context.getElementsByClassName) { | |
push.apply(results, context.getElementsByClassName(m)); | |
return results; | |
} | |
} | |
// Take advantage of querySelectorAll | |
if (support.qsa && !compilerCache[selector + " "] && (!rbuggyQSA || !rbuggyQSA.test(selector))) { | |
if (nodeType !== 1) { | |
newContext = context; | |
newSelector = selector; | |
// qSA looks outside Element context, which is not what we want | |
// Thanks to Andrew Dupont for this workaround technique | |
// Support: IE <=8 | |
// Exclude object elements | |
} else if (context.nodeName.toLowerCase() !== "object") { | |
// Capture the context ID, setting it first if necessary | |
if (nid = context.getAttribute("id")) { | |
nid = nid.replace(rcssescape, fcssescape); | |
} else { | |
context.setAttribute("id", nid = expando); | |
} | |
// Prefix every selector in the list | |
groups = tokenize(selector); | |
i = groups.length; | |
while (i--) { | |
groups[i] = "#" + nid + " " + toSelector(groups[i]); | |
} | |
newSelector = groups.join(","); | |
// Expand context for sibling selectors | |
newContext = rsibling.test(selector) && testContext(context.parentNode) || context; | |
} | |
if (newSelector) { | |
try { | |
push.apply(results, newContext.querySelectorAll(newSelector)); | |
return results; | |
} catch (qsaError) {} finally { | |
if (nid === expando) { | |
context.removeAttribute("id"); | |
} | |
} | |
} | |
} | |
} | |
} | |
// All others | |
return select(selector.replace(rtrim, "$1"), context, results, seed); | |
} | |
/** | |
* Create key-value caches of limited size | |
* @returns {function(string, object)} Returns the Object data after storing it on itself with | |
* property name the (space-suffixed) string and (if the cache is larger than Expr.cacheLength) | |
* deleting the oldest entry | |
*/ | |
function createCache() { | |
var keys = []; | |
function cache(key, value) { | |
// Use (key + " ") to avoid collision with native prototype properties (see Issue #157) | |
if (keys.push(key + " ") > Expr.cacheLength) { | |
// Only keep the most recent entries | |
delete cache[keys.shift()]; | |
} | |
return cache[key + " "] = value; | |
} | |
return cache; | |
} | |
/** | |
* Mark a function for special use by Sizzle | |
* @param {Function} fn The function to mark | |
*/ | |
function markFunction(fn) { | |
fn[expando] = true; | |
return fn; | |
} | |
/** | |
* Support testing using an element | |
* @param {Function} fn Passed the created element and returns a boolean result | |
*/ | |
function assert(fn) { | |
var el = document.createElement("fieldset"); | |
try { | |
return !!fn(el); | |
} catch (e) { | |
return false; | |
} finally { | |
// Remove from its parent by default | |
if (el.parentNode) { | |
el.parentNode.removeChild(el); | |
} | |
// release memory in IE | |
el = null; | |
} | |
} | |
/** | |
* Adds the same handler for all of the specified attrs | |
* @param {String} attrs Pipe-separated list of attributes | |
* @param {Function} handler The method that will be applied | |
*/ | |
function addHandle(attrs, handler) { | |
var arr = attrs.split("|"), | |
i = arr.length; | |
while (i--) { | |
Expr.attrHandle[arr[i]] = handler; | |
} | |
} | |
/** | |
* Checks document order of two siblings | |
* @param {Element} a | |
* @param {Element} b | |
* @returns {Number} Returns less than 0 if a precedes b, greater than 0 if a follows b | |
*/ | |
function siblingCheck(a, b) { | |
var cur = b && a, | |
diff = cur && a.nodeType === 1 && b.nodeType === 1 && a.sourceIndex - b.sourceIndex; | |
// Use IE sourceIndex if available on both nodes | |
if (diff) { | |
return diff; | |
} | |
// Check if b follows a | |
if (cur) { | |
while (cur = cur.nextSibling) { | |
if (cur === b) { | |
return -1; | |
} | |
} | |
} | |
return a ? 1 : -1; | |
} | |
/** | |
* Returns a function to use in pseudos for input types | |
* @param {String} type | |
*/ | |
function createInputPseudo(type) { | |
return function (elem) { | |
var name = elem.nodeName.toLowerCase(); | |
return name === "input" && elem.type === type; | |
}; | |
} | |
/** | |
* Returns a function to use in pseudos for buttons | |
* @param {String} type | |
*/ | |
function createButtonPseudo(type) { | |
return function (elem) { | |
var name = elem.nodeName.toLowerCase(); | |
return (name === "input" || name === "button") && elem.type === type; | |
}; | |
} | |
/** | |
* Returns a function to use in pseudos for :enabled/:disabled | |
* @param {Boolean} disabled true for :disabled; false for :enabled | |
*/ | |
function createDisabledPseudo(disabled) { | |
// Known :disabled false positives: fieldset[disabled] > legend:nth-of-type(n+2) :can-disable | |
return function (elem) { | |
// Only certain elements can match :enabled or :disabled | |
// https://html.spec.whatwg.org/multipage/scripting.html#selector-enabled | |
// https://html.spec.whatwg.org/multipage/scripting.html#selector-disabled | |
if ("form" in elem) { | |
// Check for inherited disabledness on relevant non-disabled elements: | |
// * listed form-associated elements in a disabled fieldset | |
// https://html.spec.whatwg.org/multipage/forms.html#category-listed | |
// https://html.spec.whatwg.org/multipage/forms.html#concept-fe-disabled | |
// * option elements in a disabled optgroup | |
// https://html.spec.whatwg.org/multipage/forms.html#concept-option-disabled | |
// All such elements have a "form" property. | |
if (elem.parentNode && elem.disabled === false) { | |
// Option elements defer to a parent optgroup if present | |
if ("label" in elem) { | |
if ("label" in elem.parentNode) { | |
return elem.parentNode.disabled === disabled; | |
} else { | |
return elem.disabled === disabled; | |
} | |
} | |
// Support: IE 6 - 11 | |
// Use the isDisabled shortcut property to check for disabled fieldset ancestors | |
return elem.isDisabled === disabled || | |
// Where there is no isDisabled, check manually | |
/* jshint -W018 */ | |
elem.isDisabled !== !disabled && disabledAncestor(elem) === disabled; | |
} | |
return elem.disabled === disabled; | |
// Try to winnow out elements that can't be disabled before trusting the disabled property. | |
// Some victims get caught in our net (label, legend, menu, track), but it shouldn't | |
// even exist on them, let alone have a boolean value. | |
} else if ("label" in elem) { | |
return elem.disabled === disabled; | |
} | |
// Remaining elements are neither :enabled nor :disabled | |
return false; | |
}; | |
} | |
/** | |
* Returns a function to use in pseudos for positionals | |
* @param {Function} fn | |
*/ | |
function createPositionalPseudo(fn) { | |
return markFunction(function (argument) { | |
argument = +argument; | |
return markFunction(function (seed, matches) { | |
var j, | |
matchIndexes = fn([], seed.length, argument), | |
i = matchIndexes.length; | |
// Match elements found at the specified indexes | |
while (i--) { | |
if (seed[j = matchIndexes[i]]) { | |
seed[j] = !(matches[j] = seed[j]); | |
} | |
} | |
}); | |
}); | |
} | |
/** | |
* Checks a node for validity as a Sizzle context | |
* @param {Element|Object=} context | |
* @returns {Element|Object|Boolean} The input node if acceptable, otherwise a falsy value | |
*/ | |
function testContext(context) { | |
return context && typeof context.getElementsByTagName !== "undefined" && context; | |
} | |
// Expose support vars for convenience | |
support = Sizzle.support = {}; | |
/** | |
* Detects XML nodes | |
* @param {Element|Object} elem An element or a document | |
* @returns {Boolean} True iff elem is a non-HTML XML node | |
*/ | |
isXML = Sizzle.isXML = function (elem) { | |
// documentElement is verified for cases where it doesn't yet exist | |
// (such as loading iframes in IE - #4833) | |
var documentElement = elem && (elem.ownerDocument || elem).documentElement; | |
return documentElement ? documentElement.nodeName !== "HTML" : false; | |
}; | |
/** | |
* Sets document-related variables once based on the current document | |
* @param {Element|Object} [doc] An element or document object to use to set the document | |
* @returns {Object} Returns the current document | |
*/ | |
setDocument = Sizzle.setDocument = function (node) { | |
var hasCompare, | |
subWindow, | |
doc = node ? node.ownerDocument || node : preferredDoc; | |
// Return early if doc is invalid or already selected | |
if (doc === document || doc.nodeType !== 9 || !doc.documentElement) { | |
return document; | |
} | |
// Update global variables | |
document = doc; | |
docElem = document.documentElement; | |
documentIsHTML = !isXML(document); | |
// Support: IE 9-11, Edge | |
// Accessing iframe documents after unload throws "permission denied" errors (jQuery #13936) | |
if (preferredDoc !== document && (subWindow = document.defaultView) && subWindow.top !== subWindow) { | |
// Support: IE 11, Edge | |
if (subWindow.addEventListener) { | |
subWindow.addEventListener("unload", unloadHandler, false); | |
// Support: IE 9 - 10 only | |
} else if (subWindow.attachEvent) { | |
subWindow.attachEvent("onunload", unloadHandler); | |
} | |
} | |
/* Attributes | |
---------------------------------------------------------------------- */ | |
// Support: IE<8 | |
// Verify that getAttribute really returns attributes and not properties | |
// (excepting IE8 booleans) | |
support.attributes = assert(function (el) { | |
el.className = "i"; | |
return !el.getAttribute("className"); | |
}); | |
/* getElement(s)By* | |
---------------------------------------------------------------------- */ | |
// Check if getElementsByTagName("*") returns only elements | |
support.getElementsByTagName = assert(function (el) { | |
el.appendChild(document.createComment("")); | |
return !el.getElementsByTagName("*").length; | |
}); | |
// Support: IE<9 | |
support.getElementsByClassName = rnative.test(document.getElementsByClassName); | |
// Support: IE<10 | |
// Check if getElementById returns elements by name | |
// The broken getElementById methods don't pick up programmatically-set names, | |
// so use a roundabout getElementsByName test | |
support.getById = assert(function (el) { | |
docElem.appendChild(el).id = expando; | |
return !document.getElementsByName || !document.getElementsByName(expando).length; | |
}); | |
// ID filter and find | |
if (support.getById) { | |
Expr.filter["ID"] = function (id) { | |
var attrId = id.replace(runescape, funescape); | |
return function (elem) { | |
return elem.getAttribute("id") === attrId; | |
}; | |
}; | |
Expr.find["ID"] = function (id, context) { | |
if (typeof context.getElementById !== "undefined" && documentIsHTML) { | |
var elem = context.getElementById(id); | |
return elem ? [elem] : []; | |
} | |
}; | |
} else { | |
Expr.filter["ID"] = function (id) { | |
var attrId = id.replace(runescape, funescape); | |
return function (elem) { | |
var node = typeof elem.getAttributeNode !== "undefined" && elem.getAttributeNode("id"); | |
return node && node.value === attrId; | |
}; | |
}; | |
// Support: IE 6 - 7 only | |
// getElementById is not reliable as a find shortcut | |
Expr.find["ID"] = function (id, context) { | |
if (typeof context.getElementById !== "undefined" && documentIsHTML) { | |
var node, | |
i, | |
elems, | |
elem = context.getElementById(id); | |
if (elem) { | |
// Verify the id attribute | |
node = elem.getAttributeNode("id"); | |
if (node && node.value === id) { | |
return [elem]; | |
} | |
// Fall back on getElementsByName | |
elems = context.getElementsByName(id); | |
i = 0; | |
while (elem = elems[i++]) { | |
node = elem.getAttributeNode("id"); | |
if (node && node.value === id) { | |
return [elem]; | |
} | |
} | |
} | |
return []; | |
} | |
}; | |
} | |
// Tag | |
Expr.find["TAG"] = support.getElementsByTagName ? function (tag, context) { | |
if (typeof context.getElementsByTagName !== "undefined") { | |
return context.getElementsByTagName(tag); | |
// DocumentFragment nodes don't have gEBTN | |
} else if (support.qsa) { | |
return context.querySelectorAll(tag); | |
} | |
} : function (tag, context) { | |
var elem, | |
tmp = [], | |
i = 0, | |
// By happy coincidence, a (broken) gEBTN appears on DocumentFragment nodes too | |
results = context.getElementsByTagName(tag); | |
// Filter out possible comments | |
if (tag === "*") { | |
while (elem = results[i++]) { | |
if (elem.nodeType === 1) { | |
tmp.push(elem); | |
} | |
} | |
return tmp; | |
} | |
return results; | |
}; | |
// Class | |
Expr.find["CLASS"] = support.getElementsByClassName && function (className, context) { | |
if (typeof context.getElementsByClassName !== "undefined" && documentIsHTML) { | |
return context.getElementsByClassName(className); | |
} | |
}; | |
/* QSA/matchesSelector | |
---------------------------------------------------------------------- */ | |
// QSA and matchesSelector support | |
// matchesSelector(:active) reports false when true (IE9/Opera 11.5) | |
rbuggyMatches = []; | |
// qSa(:focus) reports false when true (Chrome 21) | |
// We allow this because of a bug in IE8/9 that throws an error | |
// whenever `document.activeElement` is accessed on an iframe | |
// So, we allow :focus to pass through QSA all the time to avoid the IE error | |
// See https://bugs.jquery.com/ticket/13378 | |
rbuggyQSA = []; | |
if (support.qsa = rnative.test(document.querySelectorAll)) { | |
// Build QSA regex | |
// Regex strategy adopted from Diego Perini | |
assert(function (el) { | |
// Select is set to empty string on purpose | |
// This is to test IE's treatment of not explicitly | |
// setting a boolean content attribute, | |
// since its presence should be enough | |
// https://bugs.jquery.com/ticket/12359 | |
docElem.appendChild(el).innerHTML = "<a id='" + expando + "'></a>" + "<select id='" + expando + "-\r\\' msallowcapture=''>" + "<option selected=''></option></select>"; | |
// Support: IE8, Opera 11-12.16 | |
// Nothing should be selected when empty strings follow ^= or $= or *= | |
// The test attribute must be unknown in Opera but "safe" for WinRT | |
// https://msdn.microsoft.com/en-us/library/ie/hh465388.aspx#attribute_section | |
if (el.querySelectorAll("[msallowcapture^='']").length) { | |
rbuggyQSA.push("[*^$]=" + whitespace + "*(?:''|\"\")"); | |
} | |
// Support: IE8 | |
// Boolean attributes and "value" are not treated correctly | |
if (!el.querySelectorAll("[selected]").length) { | |
rbuggyQSA.push("\\[" + whitespace + "*(?:value|" + booleans + ")"); | |
} | |
// Support: Chrome<29, Android<4.4, Safari<7.0+, iOS<7.0+, PhantomJS<1.9.8+ | |
if (!el.querySelectorAll("[id~=" + expando + "-]").length) { | |
rbuggyQSA.push("~="); | |
} | |
// Webkit/Opera - :checked should return selected option elements | |
// http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked | |
// IE8 throws error here and will not see later tests | |
if (!el.querySelectorAll(":checked").length) { | |
rbuggyQSA.push(":checked"); | |
} | |
// Support: Safari 8+, iOS 8+ | |
// https://bugs.webkit.org/show_bug.cgi?id=136851 | |
// In-page `selector#id sibling-combinator selector` fails | |
if (!el.querySelectorAll("a#" + expando + "+*").length) { | |
rbuggyQSA.push(".#.+[+~]"); | |
} | |
}); | |
assert(function (el) { | |
el.innerHTML = "<a href='' disabled='disabled'></a>" + "<select disabled='disabled'><option/></select>"; | |
// Support: Windows 8 Native Apps | |
// The type and name attributes are restricted during .innerHTML assignment | |
var input = document.createElement("input"); | |
input.setAttribute("type", "hidden"); | |
el.appendChild(input).setAttribute("name", "D"); | |
// Support: IE8 | |
// Enforce case-sensitivity of name attribute | |
if (el.querySelectorAll("[name=d]").length) { | |
rbuggyQSA.push("name" + whitespace + "*[*^$|!~]?="); | |
} | |
// FF 3.5 - :enabled/:disabled and hidden elements (hidden elements are still enabled) | |
// IE8 throws error here and will not see later tests | |
if (el.querySelectorAll(":enabled").length !== 2) { | |
rbuggyQSA.push(":enabled", ":disabled"); | |
} | |
// Support: IE9-11+ | |
// IE's :disabled selector does not pick up the children of disabled fieldsets | |
docElem.appendChild(el).disabled = true; | |
if (el.querySelectorAll(":disabled").length !== 2) { | |
rbuggyQSA.push(":enabled", ":disabled"); | |
} | |
// Opera 10-11 does not throw on post-comma invalid pseudos | |
el.querySelectorAll("*,:x"); | |
rbuggyQSA.push(",.*:"); | |
}); | |
} | |
if (support.matchesSelector = rnative.test(matches = docElem.matches || docElem.webkitMatchesSelector || docElem.mozMatchesSelector || docElem.oMatchesSelector || docElem.msMatchesSelector)) { | |
assert(function (el) { | |
// Check to see if it's possible to do matchesSelector | |
// on a disconnected node (IE 9) | |
support.disconnectedMatch = matches.call(el, "*"); | |
// This should fail with an exception | |
// Gecko does not error, returns false instead | |
matches.call(el, "[s!='']:x"); | |
rbuggyMatches.push("!=", pseudos); | |
}); | |
} | |
rbuggyQSA = rbuggyQSA.length && new RegExp(rbuggyQSA.join("|")); | |
rbuggyMatches = rbuggyMatches.length && new RegExp(rbuggyMatches.join("|")); | |
/* Contains | |
---------------------------------------------------------------------- */ | |
hasCompare = rnative.test(docElem.compareDocumentPosition); | |
// Element contains another | |
// Purposefully self-exclusive | |
// As in, an element does not contain itself | |
contains = hasCompare || rnative.test(docElem.contains) ? function (a, b) { | |
var adown = a.nodeType === 9 ? a.documentElement : a, | |
bup = b && b.parentNode; | |
return a === bup || !!(bup && bup.nodeType === 1 && (adown.contains ? adown.contains(bup) : a.compareDocumentPosition && a.compareDocumentPosition(bup) & 16)); | |
} : function (a, b) { | |
if (b) { | |
while (b = b.parentNode) { | |
if (b === a) { | |
return true; | |
} | |
} | |
} | |
return false; | |
}; | |
/* Sorting | |
---------------------------------------------------------------------- */ | |
// Document order sorting | |
sortOrder = hasCompare ? function (a, b) { | |
// Flag for duplicate removal | |
if (a === b) { | |
hasDuplicate = true; | |
return 0; | |
} | |
// Sort on method existence if only one input has compareDocumentPosition | |
var compare = !a.compareDocumentPosition - !b.compareDocumentPosition; | |
if (compare) { | |
return compare; | |
} | |
// Calculate position if both inputs belong to the same document | |
compare = (a.ownerDocument || a) === (b.ownerDocument || b) ? a.compareDocumentPosition(b) : | |
// Otherwise we know they are disconnected | |
1; | |
// Disconnected nodes | |
if (compare & 1 || !support.sortDetached && b.compareDocumentPosition(a) === compare) { | |
// Choose the first element that is related to our preferred document | |
if (a === document || a.ownerDocument === preferredDoc && contains(preferredDoc, a)) { | |
return -1; | |
} | |
if (b === document || b.ownerDocument === preferredDoc && contains(preferredDoc, b)) { | |
return 1; | |
} | |
// Maintain original order | |
return sortInput ? indexOf(sortInput, a) - indexOf(sortInput, b) : 0; | |
} | |
return compare & 4 ? -1 : 1; | |
} : function (a, b) { | |
// Exit early if the nodes are identical | |
if (a === b) { | |
hasDuplicate = true; | |
return 0; | |
} | |
var cur, | |
i = 0, | |
aup = a.parentNode, | |
bup = b.parentNode, | |
ap = [a], | |
bp = [b]; | |
// Parentless nodes are either documents or disconnected | |
if (!aup || !bup) { | |
return a === document ? -1 : b === document ? 1 : aup ? -1 : bup ? 1 : sortInput ? indexOf(sortInput, a) - indexOf(sortInput, b) : 0; | |
// If the nodes are siblings, we can do a quick check | |
} else if (aup === bup) { | |
return siblingCheck(a, b); | |
} | |
// Otherwise we need full lists of their ancestors for comparison | |
cur = a; | |
while (cur = cur.parentNode) { | |
ap.unshift(cur); | |
} | |
cur = b; | |
while (cur = cur.parentNode) { | |
bp.unshift(cur); | |
} | |
// Walk down the tree looking for a discrepancy | |
while (ap[i] === bp[i]) { | |
i++; | |
} | |
return i ? | |
// Do a sibling check if the nodes have a common ancestor | |
siblingCheck(ap[i], bp[i]) : | |
// Otherwise nodes in our document sort first | |
ap[i] === preferredDoc ? -1 : bp[i] === preferredDoc ? 1 : 0; | |
}; | |
return document; | |
}; | |
Sizzle.matches = function (expr, elements) { | |
return Sizzle(expr, null, null, elements); | |
}; | |
Sizzle.matchesSelector = function (elem, expr) { | |
// Set document vars if needed | |
if ((elem.ownerDocument || elem) !== document) { | |
setDocument(elem); | |
} | |
// Make sure that attribute selectors are quoted | |
expr = expr.replace(rattributeQuotes, "='$1']"); | |
if (support.matchesSelector && documentIsHTML && !compilerCache[expr + " "] && (!rbuggyMatches || !rbuggyMatches.test(expr)) && (!rbuggyQSA || !rbuggyQSA.test(expr))) { | |
try { | |
var ret = matches.call(elem, expr); | |
// IE 9's matchesSelector returns false on disconnected nodes | |
if (ret || support.disconnectedMatch || | |
// As well, disconnected nodes are said to be in a document | |
// fragment in IE 9 | |
elem.document && elem.document.nodeType !== 11) { | |
return ret; | |
} | |
} catch (e) {} | |
} | |
return Sizzle(expr, document, null, [elem]).length > 0; | |
}; | |
Sizzle.contains = function (context, elem) { | |
// Set document vars if needed | |
if ((context.ownerDocument || context) !== document) { | |
setDocument(context); | |
} | |
return contains(context, elem); | |
}; | |
Sizzle.attr = function (elem, name) { | |
// Set document vars if needed | |
if ((elem.ownerDocument || elem) !== document) { | |
setDocument(elem); | |
} | |
var fn = Expr.attrHandle[name.toLowerCase()], | |
// Don't get fooled by Object.prototype properties (jQuery #13807) | |
val = fn && hasOwn.call(Expr.attrHandle, name.toLowerCase()) ? fn(elem, name, !documentIsHTML) : undefined; | |
return val !== undefined ? val : support.attributes || !documentIsHTML ? elem.getAttribute(name) : (val = elem.getAttributeNode(name)) && val.specified ? val.value : null; | |
}; | |
Sizzle.escape = function (sel) { | |
return (sel + "").replace(rcssescape, fcssescape); | |
}; | |
Sizzle.error = function (msg) { | |
throw new Error("Syntax error, unrecognized expression: " + msg); | |
}; | |
/** | |
* Document sorting and removing duplicates | |
* @param {ArrayLike} results | |
*/ | |
Sizzle.uniqueSort = function (results) { | |
var elem, | |
duplicates = [], | |
j = 0, | |
i = 0; | |
// Unless we *know* we can detect duplicates, assume their presence | |
hasDuplicate = !support.detectDuplicates; | |
sortInput = !support.sortStable && results.slice(0); | |
results.sort(sortOrder); | |
if (hasDuplicate) { | |
while (elem = results[i++]) { | |
if (elem === results[i]) { | |
j = duplicates.push(i); | |
} | |
} | |
while (j--) { | |
results.splice(duplicates[j], 1); | |
} | |
} | |
// Clear input after sorting to release objects | |
// See https://github.com/jquery/sizzle/pull/225 | |
sortInput = null; | |
return results; | |
}; | |
/** | |
* Utility function for retrieving the text value of an array of DOM nodes | |
* @param {Array|Element} elem | |
*/ | |
getText = Sizzle.getText = function (elem) { | |
var node, | |
ret = "", | |
i = 0, | |
nodeType = elem.nodeType; | |
if (!nodeType) { | |
// If no nodeType, this is expected to be an array | |
while (node = elem[i++]) { | |
// Do not traverse comment nodes | |
ret += getText(node); | |
} | |
} else if (nodeType === 1 || nodeType === 9 || nodeType === 11) { | |
// Use textContent for elements | |
// innerText usage removed for consistency of new lines (jQuery #11153) | |
if (typeof elem.textContent === "string") { | |
return elem.textContent; | |
} else { | |
// Traverse its children | |
for (elem = elem.firstChild; elem; elem = elem.nextSibling) { | |
ret += getText(elem); | |
} | |
} | |
} else if (nodeType === 3 || nodeType === 4) { | |
return elem.nodeValue; | |
} | |
// Do not include comment or processing instruction nodes | |
return ret; | |
}; | |
Expr = Sizzle.selectors = { | |
// Can be adjusted by the user | |
cacheLength: 50, | |
createPseudo: markFunction, | |
match: matchExpr, | |
attrHandle: {}, | |
find: {}, | |
relative: { | |
">": { dir: "parentNode", first: true }, | |
" ": { dir: "parentNode" }, | |
"+": { dir: "previousSibling", first: true }, | |
"~": { dir: "previousSibling" } | |
}, | |
preFilter: { | |
"ATTR": function ATTR(match) { | |
match[1] = match[1].replace(runescape, funescape); | |
// Move the given value to match[3] whether quoted or unquoted | |
match[3] = (match[3] || match[4] || match[5] || "").replace(runescape, funescape); | |
if (match[2] === "~=") { | |
match[3] = " " + match[3] + " "; | |
} | |
return match.slice(0, 4); | |
}, | |
"CHILD": function CHILD(match) { | |
/* matches from matchExpr["CHILD"] | |
1 type (only|nth|...) | |
2 what (child|of-type) | |
3 argument (even|odd|\d*|\d*n([+-]\d+)?|...) | |
4 xn-component of xn+y argument ([+-]?\d*n|) | |
5 sign of xn-component | |
6 x of xn-component | |
7 sign of y-component | |
8 y of y-component | |
*/ | |
match[1] = match[1].toLowerCase(); | |
if (match[1].slice(0, 3) === "nth") { | |
// nth-* requires argument | |
if (!match[3]) { | |
Sizzle.error(match[0]); | |
} | |
// numeric x and y parameters for Expr.filter.CHILD | |
// remember that false/true cast respectively to 0/1 | |
match[4] = +(match[4] ? match[5] + (match[6] || 1) : 2 * (match[3] === "even" || match[3] === "odd")); | |
match[5] = +(match[7] + match[8] || match[3] === "odd"); | |
// other types prohibit arguments | |
} else if (match[3]) { | |
Sizzle.error(match[0]); | |
} | |
return match; | |
}, | |
"PSEUDO": function PSEUDO(match) { | |
var excess, | |
unquoted = !match[6] && match[2]; | |
if (matchExpr["CHILD"].test(match[0])) { | |
return null; | |
} | |
// Accept quoted arguments as-is | |
if (match[3]) { | |
match[2] = match[4] || match[5] || ""; | |
// Strip excess characters from unquoted arguments | |
} else if (unquoted && rpseudo.test(unquoted) && ( | |
// Get excess from tokenize (recursively) | |
excess = tokenize(unquoted, true)) && ( | |
// advance to the next closing parenthesis | |
excess = unquoted.indexOf(")", unquoted.length - excess) - unquoted.length)) { | |
// excess is a negative index | |
match[0] = match[0].slice(0, excess); | |
match[2] = unquoted.slice(0, excess); | |
} | |
// Return only captures needed by the pseudo filter method (type and argument) | |
return match.slice(0, 3); | |
} | |
}, | |
filter: { | |
"TAG": function TAG(nodeNameSelector) { | |
var nodeName = nodeNameSelector.replace(runescape, funescape).toLowerCase(); | |
return nodeNameSelector === "*" ? function () { | |
return true; | |
} : function (elem) { | |
return elem.nodeName && elem.nodeName.toLowerCase() === nodeName; | |
}; | |
}, | |
"CLASS": function CLASS(className) { | |
var pattern = classCache[className + " "]; | |
return pattern || (pattern = new RegExp("(^|" + whitespace + ")" + className + "(" + whitespace + "|$)")) && classCache(className, function (elem) { | |
return pattern.test(typeof elem.className === "string" && elem.className || typeof elem.getAttribute !== "undefined" && elem.getAttribute("class") || ""); | |
}); | |
}, | |
"ATTR": function ATTR(name, operator, check) { | |
return function (elem) { | |
var result = Sizzle.attr(elem, name); | |
if (result == null) { | |
return operator === "!="; | |
} | |
if (!operator) { | |
return true; | |
} | |
result += ""; | |
return operator === "=" ? result === check : operator === "!=" ? result !== check : operator === "^=" ? check && result.indexOf(check) === 0 : operator === "*=" ? check && result.indexOf(check) > -1 : operator === "$=" ? check && result.slice(-check.length) === check : operator === "~=" ? (" " + result.replace(rwhitespace, " ") + " ").indexOf(check) > -1 : operator === "|=" ? result === check || result.slice(0, check.length + 1) === check + "-" : false; | |
}; | |
}, | |
"CHILD": function CHILD(type, what, argument, first, last) { | |
var simple = type.slice(0, 3) !== "nth", | |
forward = type.slice(-4) !== "last", | |
ofType = what === "of-type"; | |
return first === 1 && last === 0 ? | |
// Shortcut for :nth-*(n) | |
function (elem) { | |
return !!elem.parentNode; | |
} : function (elem, context, xml) { | |
var cache, | |
uniqueCache, | |
outerCache, | |
node, | |
nodeIndex, | |
start, | |
dir = simple !== forward ? "nextSibling" : "previousSibling", | |
parent = elem.parentNode, | |
name = ofType && elem.nodeName.toLowerCase(), | |
useCache = !xml && !ofType, | |
diff = false; | |
if (parent) { | |
// :(first|last|only)-(child|of-type) | |
if (simple) { | |
while (dir) { | |
node = elem; | |
while (node = node[dir]) { | |
if (ofType ? node.nodeName.toLowerCase() === name : node.nodeType === 1) { | |
return false; | |
} | |
} | |
// Reverse direction for :only-* (if we haven't yet done so) | |
start = dir = type === "only" && !start && "nextSibling"; | |
} | |
return true; | |
} | |
start = [forward ? parent.firstChild : parent.lastChild]; | |
// non-xml :nth-child(...) stores cache data on `parent` | |
if (forward && useCache) { | |
// Seek `elem` from a previously-cached index | |
// ...in a gzip-friendly way | |
node = parent; | |
outerCache = node[expando] || (node[expando] = {}); | |
// Support: IE <9 only | |
// Defend against cloned attroperties (jQuery gh-1709) | |
uniqueCache = outerCache[node.uniqueID] || (outerCache[node.uniqueID] = {}); | |
cache = uniqueCache[type] || []; | |
nodeIndex = cache[0] === dirruns && cache[1]; | |
diff = nodeIndex && cache[2]; | |
node = nodeIndex && parent.childNodes[nodeIndex]; | |
while (node = ++nodeIndex && node && node[dir] || ( | |
// Fallback to seeking `elem` from the start | |
diff = nodeIndex = 0) || start.pop()) { | |
// When found, cache indexes on `parent` and break | |
if (node.nodeType === 1 && ++diff && node === elem) { | |
uniqueCache[type] = [dirruns, nodeIndex, diff]; | |
break; | |
} | |
} | |
} else { | |
// Use previously-cached element index if available | |
if (useCache) { | |
// ...in a gzip-friendly way | |
node = elem; | |
outerCache = node[expando] || (node[expando] = {}); | |
// Support: IE <9 only | |
// Defend against cloned attroperties (jQuery gh-1709) | |
uniqueCache = outerCache[node.uniqueID] || (outerCache[node.uniqueID] = {}); | |
cache = uniqueCache[type] || []; | |
nodeIndex = cache[0] === dirruns && cache[1]; | |
diff = nodeIndex; | |
} | |
// xml :nth-child(...) | |
// or :nth-last-child(...) or :nth(-last)?-of-type(...) | |
if (diff === false) { | |
// Use the same loop as above to seek `elem` from the start | |
while (node = ++nodeIndex && node && node[dir] || (diff = nodeIndex = 0) || start.pop()) { | |
if ((ofType ? node.nodeName.toLowerCase() === name : node.nodeType === 1) && ++diff) { | |
// Cache the index of each encountered element | |
if (useCache) { | |
outerCache = node[expando] || (node[expando] = {}); | |
// Support: IE <9 only | |
// Defend against cloned attroperties (jQuery gh-1709) | |
uniqueCache = outerCache[node.uniqueID] || (outerCache[node.uniqueID] = {}); | |
uniqueCache[type] = [dirruns, diff]; | |
} | |
if (node === elem) { | |
break; | |
} | |
} | |
} | |
} | |
} | |
// Incorporate the offset, then check against cycle size | |
diff -= last; | |
return diff === first || diff % first === 0 && diff / first >= 0; | |
} | |
}; | |
}, | |
"PSEUDO": function PSEUDO(pseudo, argument) { | |
// pseudo-class names are case-insensitive | |
// http://www.w3.org/TR/selectors/#pseudo-classes | |
// Prioritize by case sensitivity in case custom pseudos are added with uppercase letters | |
// Remember that setFilters inherits from pseudos | |
var args, | |
fn = Expr.pseudos[pseudo] || Expr.setFilters[pseudo.toLowerCase()] || Sizzle.error("unsupported pseudo: " + pseudo); | |
// The user may use createPseudo to indicate that | |
// arguments are needed to create the filter function | |
// just as Sizzle does | |
if (fn[expando]) { | |
return fn(argument); | |
} | |
// But maintain support for old signatures | |
if (fn.length > 1) { | |
args = [pseudo, pseudo, "", argument]; | |
return Expr.setFilters.hasOwnProperty(pseudo.toLowerCase()) ? markFunction(function (seed, matches) { | |
var idx, | |
matched = fn(seed, argument), | |
i = matched.length; | |
while (i--) { | |
idx = indexOf(seed, matched[i]); | |
seed[idx] = !(matches[idx] = matched[i]); | |
} | |
}) : function (elem) { | |
return fn(elem, 0, args); | |
}; | |
} | |
return fn; | |
} | |
}, | |
pseudos: { | |
// Potentially complex pseudos | |
"not": markFunction(function (selector) { | |
// Trim the selector passed to compile | |
// to avoid treating leading and trailing | |
// spaces as combinators | |
var input = [], | |
results = [], | |
matcher = compile(selector.replace(rtrim, "$1")); | |
return matcher[expando] ? markFunction(function (seed, matches, context, xml) { | |
var elem, | |
unmatched = matcher(seed, null, xml, []), | |
i = seed.length; | |
// Match elements unmatched by `matcher` | |
while (i--) { | |
if (elem = unmatched[i]) { | |
seed[i] = !(matches[i] = elem); | |
} | |
} | |
}) : function (elem, context, xml) { | |
input[0] = elem; | |
matcher(input, null, xml, results); | |
// Don't keep the element (issue #299) | |
input[0] = null; | |
return !results.pop(); | |
}; | |
}), | |
"has": markFunction(function (selector) { | |
return function (elem) { | |
return Sizzle(selector, elem).length > 0; | |
}; | |
}), | |
"contains": markFunction(function (text) { | |
text = text.replace(runescape, funescape); | |
return function (elem) { | |
return (elem.textContent || elem.innerText || getText(elem)).indexOf(text) > -1; | |
}; | |
}), | |
// "Whether an element is represented by a :lang() selector | |
// is based solely on the element's language value | |
// being equal to the identifier C, | |
// or beginning with the identifier C immediately followed by "-". | |
// The matching of C against the element's language value is performed case-insensitively. | |
// The identifier C does not have to be a valid language name." | |
// http://www.w3.org/TR/selectors/#lang-pseudo | |
"lang": markFunction(function (lang) { | |
// lang value must be a valid identifier | |
if (!ridentifier.test(lang || "")) { | |
Sizzle.error("unsupported lang: " + lang); | |
} | |
lang = lang.replace(runescape, funescape).toLowerCase(); | |
return function (elem) { | |
var elemLang; | |
do { | |
if (elemLang = documentIsHTML ? elem.lang : elem.getAttribute("xml:lang") || elem.getAttribute("lang")) { | |
elemLang = elemLang.toLowerCase(); | |
return elemLang === lang || elemLang.indexOf(lang + "-") === 0; | |
} | |
} while ((elem = elem.parentNode) && elem.nodeType === 1); | |
return false; | |
}; | |
}), | |
// Miscellaneous | |
"target": function target(elem) { | |
var hash = window.location && window.location.hash; | |
return hash && hash.slice(1) === elem.id; | |
}, | |
"root": function root(elem) { | |
return elem === docElem; | |
}, | |
"focus": function focus(elem) { | |
return elem === document.activeElement && (!document.hasFocus || document.hasFocus()) && !!(elem.type || elem.href || ~elem.tabIndex); | |
}, | |
// Boolean properties | |
"enabled": createDisabledPseudo(false), | |
"disabled": createDisabledPseudo(true), | |
"checked": function checked(elem) { | |
// In CSS3, :checked should return both checked and selected elements | |
// http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked | |
var nodeName = elem.nodeName.toLowerCase(); | |
return nodeName === "input" && !!elem.checked || nodeName === "option" && !!elem.selected; | |
}, | |
"selected": function selected(elem) { | |
// Accessing this property makes selected-by-default | |
// options in Safari work properly | |
if (elem.parentNode) { | |
elem.parentNode.selectedIndex; | |
} | |
return elem.selected === true; | |
}, | |
// Contents | |
"empty": function empty(elem) { | |
// http://www.w3.org/TR/selectors/#empty-pseudo | |
// :empty is negated by element (1) or content nodes (text: 3; cdata: 4; entity ref: 5), | |
// but not by others (comment: 8; processing instruction: 7; etc.) | |
// nodeType < 6 works because attributes (2) do not appear as children | |
for (elem = elem.firstChild; elem; elem = elem.nextSibling) { | |
if (elem.nodeType < 6) { | |
return false; | |
} | |
} | |
return true; | |
}, | |
"parent": function parent(elem) { | |
return !Expr.pseudos["empty"](elem); | |
}, | |
// Element/input types | |
"header": function header(elem) { | |
return rheader.test(elem.nodeName); | |
}, | |
"input": function input(elem) { | |
return rinputs.test(elem.nodeName); | |
}, | |
"button": function button(elem) { | |
var name = elem.nodeName.toLowerCase(); | |
return name === "input" && elem.type === "button" || name === "button"; | |
}, | |
"text": function text(elem) { | |
var attr; | |
return elem.nodeName.toLowerCase() === "input" && elem.type === "text" && ( | |
// Support: IE<8 | |
// New HTML5 attribute values (e.g., "search") appear with elem.type === "text" | |
(attr = elem.getAttribute("type")) == null || attr.toLowerCase() === "text"); | |
}, | |
// Position-in-collection | |
"first": createPositionalPseudo(function () { | |
return [0]; | |
}), | |
"last": createPositionalPseudo(function (matchIndexes, length) { | |
return [length - 1]; | |
}), | |
"eq": createPositionalPseudo(function (matchIndexes, length, argument) { | |
return [argument < 0 ? argument + length : argument]; | |
}), | |
"even": createPositionalPseudo(function (matchIndexes, length) { | |
var i = 0; | |
for (; i < length; i += 2) { | |
matchIndexes.push(i); | |
} | |
return matchIndexes; | |
}), | |
"odd": createPositionalPseudo(function (matchIndexes, length) { | |
var i = 1; | |
for (; i < length; i += 2) { | |
matchIndexes.push(i); | |
} | |
return matchIndexes; | |
}), | |
"lt": createPositionalPseudo(function (matchIndexes, length, argument) { | |
var i = argument < 0 ? argument + length : argument; | |
for (; --i >= 0;) { | |
matchIndexes.push(i); | |
} | |
return matchIndexes; | |
}), | |
"gt": createPositionalPseudo(function (matchIndexes, length, argument) { | |
var i = argument < 0 ? argument + length : argument; | |
for (; ++i < length;) { | |
matchIndexes.push(i); | |
} | |
return matchIndexes; | |
}) | |
} | |
}; | |
Expr.pseudos["nth"] = Expr.pseudos["eq"]; | |
// Add button/input type pseudos | |
for (i in { radio: true, checkbox: true, file: true, password: true, image: true }) { | |
Expr.pseudos[i] = createInputPseudo(i); | |
} | |
for (i in { submit: true, reset: true }) { | |
Expr.pseudos[i] = createButtonPseudo(i); | |
} | |
// Easy API for creating new setFilters | |
function setFilters() {} | |
setFilters.prototype = Expr.filters = Expr.pseudos; | |
Expr.setFilters = new setFilters(); | |
tokenize = Sizzle.tokenize = function (selector, parseOnly) { | |
var matched, | |
match, | |
tokens, | |
type, | |
soFar, | |
groups, | |
preFilters, | |
cached = tokenCache[selector + " "]; | |
if (cached) { | |
return parseOnly ? 0 : cached.slice(0); | |
} | |
soFar = selector; | |
groups = []; | |
preFilters = Expr.preFilter; | |
while (soFar) { | |
// Comma and first run | |
if (!matched || (match = rcomma.exec(soFar))) { | |
if (match) { | |
// Don't consume trailing commas as valid | |
soFar = soFar.slice(match[0].length) || soFar; | |
} | |
groups.push(tokens = []); | |
} | |
matched = false; | |
// Combinators | |
if (match = rcombinators.exec(soFar)) { | |
matched = match.shift(); | |
tokens.push({ | |
value: matched, | |
// Cast descendant combinators to space | |
type: match[0].replace(rtrim, " ") | |
}); | |
soFar = soFar.slice(matched.length); | |
} | |
// Filters | |
for (type in Expr.filter) { | |
if ((match = matchExpr[type].exec(soFar)) && (!preFilters[type] || (match = preFilters[type](match)))) { | |
matched = match.shift(); | |
tokens.push({ | |
value: matched, | |
type: type, | |
matches: match | |
}); | |
soFar = soFar.slice(matched.length); | |
} | |
} | |
if (!matched) { | |
break; | |
} | |
} | |
// Return the length of the invalid excess | |
// if we're just parsing | |
// Otherwise, throw an error or return tokens | |
return parseOnly ? soFar.length : soFar ? Sizzle.error(selector) : | |
// Cache the tokens | |
tokenCache(selector, groups).slice(0); | |
}; | |
function toSelector(tokens) { | |
var i = 0, | |
len = tokens.length, | |
selector = ""; | |
for (; i < len; i++) { | |
selector += tokens[i].value; | |
} | |
return selector; | |
} | |
function addCombinator(matcher, combinator, base) { | |
var dir = combinator.dir, | |
skip = combinator.next, | |
key = skip || dir, | |
checkNonElements = base && key === "parentNode", | |
doneName = done++; | |
return combinator.first ? | |
// Check against closest ancestor/preceding element | |
function (elem, context, xml) { | |
while (elem = elem[dir]) { | |
if (elem.nodeType === 1 || checkNonElements) { | |
return matcher(elem, context, xml); | |
} | |
} | |
return false; | |
} : | |
// Check against all ancestor/preceding elements | |
function (elem, context, xml) { | |
var oldCache, | |
uniqueCache, | |
outerCache, | |
newCache = [dirruns, doneName]; | |
// We can't set arbitrary data on XML nodes, so they don't benefit from combinator caching | |
if (xml) { | |
while (elem = elem[dir]) { | |
if (elem.nodeType === 1 || checkNonElements) { | |
if (matcher(elem, context, xml)) { | |
return true; | |
} | |
} | |
} | |
} else { | |
while (elem = elem[dir]) { | |
if (elem.nodeType === 1 || checkNonElements) { | |
outerCache = elem[expando] || (elem[expando] = {}); | |
// Support: IE <9 only | |
// Defend against cloned attroperties (jQuery gh-1709) | |
uniqueCache = outerCache[elem.uniqueID] || (outerCache[elem.uniqueID] = {}); | |
if (skip && skip === elem.nodeName.toLowerCase()) { | |
elem = elem[dir] || elem; | |
} else if ((oldCache = uniqueCache[key]) && oldCache[0] === dirruns && oldCache[1] === doneName) { | |
// Assign to newCache so results back-propagate to previous elements | |
return newCache[2] = oldCache[2]; | |
} else { | |
// Reuse newcache so results back-propagate to previous elements | |
uniqueCache[key] = newCache; | |
// A match means we're done; a fail means we have to keep checking | |
if (newCache[2] = matcher(elem, context, xml)) { | |
return true; | |
} | |
} | |
} | |
} | |
} | |
return false; | |
}; | |
} | |
function elementMatcher(matchers) { | |
return matchers.length > 1 ? function (elem, context, xml) { | |
var i = matchers.length; | |
while (i--) { | |
if (!matchers[i](elem, context, xml)) { | |
return false; | |
} | |
} | |
return true; | |
} : matchers[0]; | |
} | |
function multipleContexts(selector, contexts, results) { | |
var i = 0, | |
len = contexts.length; | |
for (; i < len; i++) { | |
Sizzle(selector, contexts[i], results); | |
} | |
return results; | |
} | |
function condense(unmatched, map, filter, context, xml) { | |
var elem, | |
newUnmatched = [], | |
i = 0, | |
len = unmatched.length, | |
mapped = map != null; | |
for (; i < len; i++) { | |
if (elem = unmatched[i]) { | |
if (!filter || filter(elem, context, xml)) { | |
newUnmatched.push(elem); | |
if (mapped) { | |
map.push(i); | |
} | |
} | |
} | |
} | |
return newUnmatched; | |
} | |
function setMatcher(preFilter, selector, matcher, postFilter, postFinder, postSelector) { | |
if (postFilter && !postFilter[expando]) { | |
postFilter = setMatcher(postFilter); | |
} | |
if (postFinder && !postFinder[expando]) { | |
postFinder = setMatcher(postFinder, postSelector); | |
} | |
return markFunction(function (seed, results, context, xml) { | |
var temp, | |
i, | |
elem, | |
preMap = [], | |
postMap = [], | |
preexisting = results.length, | |
// Get initial elements from seed or context | |
elems = seed || multipleContexts(selector || "*", context.nodeType ? [context] : context, []), | |
// Prefilter to get matcher input, preserving a map for seed-results synchronization | |
matcherIn = preFilter && (seed || !selector) ? condense(elems, preMap, preFilter, context, xml) : elems, | |
matcherOut = matcher ? | |
// If we have a postFinder, or filtered seed, or non-seed postFilter or preexisting results, | |
postFinder || (seed ? preFilter : preexisting || postFilter) ? | |
// ...intermediate processing is necessary | |
[] : | |
// ...otherwise use results directly | |
results : matcherIn; | |
// Find primary matches | |
if (matcher) { | |
matcher(matcherIn, matcherOut, context, xml); | |
} | |
// Apply postFilter | |
if (postFilter) { | |
temp = condense(matcherOut, postMap); | |
postFilter(temp, [], context, xml); | |
// Un-match failing elements by moving them back to matcherIn | |
i = temp.length; | |
while (i--) { | |
if (elem = temp[i]) { | |
matcherOut[postMap[i]] = !(matcherIn[postMap[i]] = elem); | |
} | |
} | |
} | |
if (seed) { | |
if (postFinder || preFilter) { | |
if (postFinder) { | |
// Get the final matcherOut by condensing this intermediate into postFinder contexts | |
temp = []; | |
i = matcherOut.length; | |
while (i--) { | |
if (elem = matcherOut[i]) { | |
// Restore matcherIn since elem is not yet a final match | |
temp.push(matcherIn[i] = elem); | |
} | |
} | |
postFinder(null, matcherOut = [], temp, xml); | |
} | |
// Move matched elements from seed to results to keep them synchronized | |
i = matcherOut.length; | |
while (i--) { | |
if ((elem = matcherOut[i]) && (temp = postFinder ? indexOf(seed, elem) : preMap[i]) > -1) { | |
seed[temp] = !(results[temp] = elem); | |
} | |
} | |
} | |
// Add elements to results, through postFinder if defined | |
} else { | |
matcherOut = condense(matcherOut === results ? matcherOut.splice(preexisting, matcherOut.length) : matcherOut); | |
if (postFinder) { | |
postFinder(null, results, matcherOut, xml); | |
} else { | |
push.apply(results, matcherOut); | |
} | |
} | |
}); | |
} | |
function matcherFromTokens(tokens) { | |
var checkContext, | |
matcher, | |
j, | |
len = tokens.length, | |
leadingRelative = Expr.relative[tokens[0].type], | |
implicitRelative = leadingRelative || Expr.relative[" "], | |
i = leadingRelative ? 1 : 0, | |
// The foundational matcher ensures that elements are reachable from top-level context(s) | |
matchContext = addCombinator(function (elem) { | |
return elem === checkContext; | |
}, implicitRelative, true), | |
matchAnyContext = addCombinator(function (elem) { | |
return indexOf(checkContext, elem) > -1; | |
}, implicitRelative, true), | |
matchers = [function (elem, context, xml) { | |
var ret = !leadingRelative && (xml || context !== outermostContext) || ((checkContext = context).nodeType ? matchContext(elem, context, xml) : matchAnyContext(elem, context, xml)); | |
// Avoid hanging onto element (issue #299) | |
checkContext = null; | |
return ret; | |
}]; | |
for (; i < len; i++) { | |
if (matcher = Expr.relative[tokens[i].type]) { | |
matchers = [addCombinator(elementMatcher(matchers), matcher)]; | |
} else { | |
matcher = Expr.filter[tokens[i].type].apply(null, tokens[i].matches); | |
// Return special upon seeing a positional matcher | |
if (matcher[expando]) { | |
// Find the next relative operator (if any) for proper handling | |
j = ++i; | |
for (; j < len; j++) { | |
if (Expr.relative[tokens[j].type]) { | |
break; | |
} | |
} | |
return setMatcher(i > 1 && elementMatcher(matchers), i > 1 && toSelector( | |
// If the preceding token was a descendant combinator, insert an implicit any-element `*` | |
tokens.slice(0, i - 1).concat({ value: tokens[i - 2].type === " " ? "*" : "" })).replace(rtrim, "$1"), matcher, i < j && matcherFromTokens(tokens.slice(i, j)), j < len && matcherFromTokens(tokens = tokens.slice(j)), j < len && toSelector(tokens)); | |
} | |
matchers.push(matcher); | |
} | |
} | |
return elementMatcher(matchers); | |
} | |
function matcherFromGroupMatchers(elementMatchers, setMatchers) { | |
var bySet = setMatchers.length > 0, | |
byElement = elementMatchers.length > 0, | |
superMatcher = function superMatcher(seed, context, xml, results, outermost) { | |
var elem, | |
j, | |
matcher, | |
matchedCount = 0, | |
i = "0", | |
unmatched = seed && [], | |
setMatched = [], | |
contextBackup = outermostContext, | |
// We must always have either seed elements or outermost context | |
elems = seed || byElement && Expr.find["TAG"]("*", outermost), | |
// Use integer dirruns iff this is the outermost matcher | |
dirrunsUnique = dirruns += contextBackup == null ? 1 : Math.random() || 0.1, | |
len = elems.length; | |
if (outermost) { | |
outermostContext = context === document || context || outermost; | |
} | |
// Add elements passing elementMatchers directly to results | |
// Support: IE<9, Safari | |
// Tolerate NodeList properties (IE: "length"; Safari: <number>) matching elements by id | |
for (; i !== len && (elem = elems[i]) != null; i++) { | |
if (byElement && elem) { | |
j = 0; | |
if (!context && elem.ownerDocument !== document) { | |
setDocument(elem); | |
xml = !documentIsHTML; | |
} | |
while (matcher = elementMatchers[j++]) { | |
if (matcher(elem, context || document, xml)) { | |
results.push(elem); | |
break; | |
} | |
} | |
if (outermost) { | |
dirruns = dirrunsUnique; | |
} | |
} | |
// Track unmatched elements for set filters | |
if (bySet) { | |
// They will have gone through all possible matchers | |
if (elem = !matcher && elem) { | |
matchedCount--; | |
} | |
// Lengthen the array for every element, matched or not | |
if (seed) { | |
unmatched.push(elem); | |
} | |
} | |
} | |
// `i` is now the count of elements visited above, and adding it to `matchedCount` | |
// makes the latter nonnegative. | |
matchedCount += i; | |
// Apply set filters to unmatched elements | |
// NOTE: This can be skipped if there are no unmatched elements (i.e., `matchedCount` | |
// equals `i`), unless we didn't visit _any_ elements in the above loop because we have | |
// no element matchers and no seed. | |
// Incrementing an initially-string "0" `i` allows `i` to remain a string only in that | |
// case, which will result in a "00" `matchedCount` that differs from `i` but is also | |
// numerically zero. | |
if (bySet && i !== matchedCount) { | |
j = 0; | |
while (matcher = setMatchers[j++]) { | |
matcher(unmatched, setMatched, context, xml); | |
} | |
if (seed) { | |
// Reintegrate element matches to eliminate the need for sorting | |
if (matchedCount > 0) { | |
while (i--) { | |
if (!(unmatched[i] || setMatched[i])) { | |
setMatched[i] = pop.call(results); | |
} | |
} | |
} | |
// Discard index placeholder values to get only actual matches | |
setMatched = condense(setMatched); | |
} | |
// Add matches to results | |
push.apply(results, setMatched); | |
// Seedless set matches succeeding multiple successful matchers stipulate sorting | |
if (outermost && !seed && setMatched.length > 0 && matchedCount + setMatchers.length > 1) { | |
Sizzle.uniqueSort(results); | |
} | |
} | |
// Override manipulation of globals by nested matchers | |
if (outermost) { | |
dirruns = dirrunsUnique; | |
outermostContext = contextBackup; | |
} | |
return unmatched; | |
}; | |
return bySet ? markFunction(superMatcher) : superMatcher; | |
} | |
compile = Sizzle.compile = function (selector, match /* Internal Use Only */) { | |
var i, | |
setMatchers = [], | |
elementMatchers = [], | |
cached = compilerCache[selector + " "]; | |
if (!cached) { | |
// Generate a function of recursive functions that can be used to check each element | |
if (!match) { | |
match = tokenize(selector); | |
} | |
i = match.length; | |
while (i--) { | |
cached = matcherFromTokens(match[i]); | |
if (cached[expando]) { | |
setMatchers.push(cached); | |
} else { | |
elementMatchers.push(cached); | |
} | |
} | |
// Cache the compiled function | |
cached = compilerCache(selector, matcherFromGroupMatchers(elementMatchers, setMatchers)); | |
// Save selector and tokenization | |
cached.selector = selector; | |
} | |
return cached; | |
}; | |
/** | |
* A low-level selection function that works with Sizzle's compiled | |
* selector functions | |
* @param {String|Function} selector A selector or a pre-compiled | |
* selector function built with Sizzle.compile | |
* @param {Element} context | |
* @param {Array} [results] | |
* @param {Array} [seed] A set of elements to match against | |
*/ | |
select = Sizzle.select = function (selector, context, results, seed) { | |
var i, | |
tokens, | |
token, | |
type, | |
find, | |
compiled = typeof selector === "function" && selector, | |
match = !seed && tokenize(selector = compiled.selector || selector); | |
results = results || []; | |
// Try to minimize operations if there is only one selector in the list and no seed | |
// (the latter of which guarantees us context) | |
if (match.length === 1) { | |
// Reduce context if the leading compound selector is an ID | |
tokens = match[0] = match[0].slice(0); | |
if (tokens.length > 2 && (token = tokens[0]).type === "ID" && context.nodeType === 9 && documentIsHTML && Expr.relative[tokens[1].type]) { | |
context = (Expr.find["ID"](token.matches[0].replace(runescape, funescape), context) || [])[0]; | |
if (!context) { | |
return results; | |
// Precompiled matchers will still verify ancestry, so step up a level | |
} else if (compiled) { | |
context = context.parentNode; | |
} | |
selector = selector.slice(tokens.shift().value.length); | |
} | |
// Fetch a seed set for right-to-left matching | |
i = matchExpr["needsContext"].test(selector) ? 0 : tokens.length; | |
while (i--) { | |
token = tokens[i]; | |
// Abort if we hit a combinator | |
if (Expr.relative[type = token.type]) { | |
break; | |
} | |
if (find = Expr.find[type]) { | |
// Search, expanding context for leading sibling combinators | |
if (seed = find(token.matches[0].replace(runescape, funescape), rsibling.test(tokens[0].type) && testContext(context.parentNode) || context)) { | |
// If seed is empty or no tokens remain, we can return early | |
tokens.splice(i, 1); | |
selector = seed.length && toSelector(tokens); | |
if (!selector) { | |
push.apply(results, seed); | |
return results; | |
} | |
break; | |
} | |
} | |
} | |
} | |
// Compile and execute a filtering function if one is not provided | |
// Provide `match` to avoid retokenization if we modified the selector above | |
(compiled || compile(selector, match))(seed, context, !documentIsHTML, results, !context || rsibling.test(selector) && testContext(context.parentNode) || context); | |
return results; | |
}; | |
// One-time assignments | |
// Sort stability | |
support.sortStable = expando.split("").sort(sortOrder).join("") === expando; | |
// Support: Chrome 14-35+ | |
// Always assume duplicates if they aren't passed to the comparison function | |
support.detectDuplicates = !!hasDuplicate; | |
// Initialize against the default document | |
setDocument(); | |
// Support: Webkit<537.32 - Safari 6.0.3/Chrome 25 (fixed in Chrome 27) | |
// Detached nodes confoundingly follow *each other* | |
support.sortDetached = assert(function (el) { | |
// Should return 1, but returns 4 (following) | |
return el.compareDocumentPosition(document.createElement("fieldset")) & 1; | |
}); | |
// Support: IE<8 | |
// Prevent attribute/property "interpolation" | |
// https://msdn.microsoft.com/en-us/library/ms536429%28VS.85%29.aspx | |
if (!assert(function (el) { | |
el.innerHTML = "<a href='#'></a>"; | |
return el.firstChild.getAttribute("href") === "#"; | |
})) { | |
addHandle("type|href|height|width", function (elem, name, isXML) { | |
if (!isXML) { | |
return elem.getAttribute(name, name.toLowerCase() === "type" ? 1 : 2); | |
} | |
}); | |
} | |
// Support: IE<9 | |
// Use defaultValue in place of getAttribute("value") | |
if (!support.attributes || !assert(function (el) { | |
el.innerHTML = "<input/>"; | |
el.firstChild.setAttribute("value", ""); | |
return el.firstChild.getAttribute("value") === ""; | |
})) { | |
addHandle("value", function (elem, name, isXML) { | |
if (!isXML && elem.nodeName.toLowerCase() === "input") { | |
return elem.defaultValue; | |
} | |
}); | |
} | |
// Support: IE<9 | |
// Use getAttributeNode to fetch booleans when getAttribute lies | |
if (!assert(function (el) { | |
return el.getAttribute("disabled") == null; | |
})) { | |
addHandle(booleans, function (elem, name, isXML) { | |
var val; | |
if (!isXML) { | |
return elem[name] === true ? name.toLowerCase() : (val = elem.getAttributeNode(name)) && val.specified ? val.value : null; | |
} | |
}); | |
} | |
return Sizzle; | |
}(window); | |
jQuery.find = Sizzle; | |
jQuery.expr = Sizzle.selectors; | |
// Deprecated | |
jQuery.expr[":"] = jQuery.expr.pseudos; | |
jQuery.uniqueSort = jQuery.unique = Sizzle.uniqueSort; | |
jQuery.text = Sizzle.getText; | |
jQuery.isXMLDoc = Sizzle.isXML; | |
jQuery.contains = Sizzle.contains; | |
jQuery.escapeSelector = Sizzle.escape; | |
var dir = function dir(elem, _dir, until) { | |
var matched = [], | |
truncate = until !== undefined; | |
while ((elem = elem[_dir]) && elem.nodeType !== 9) { | |
if (elem.nodeType === 1) { | |
if (truncate && jQuery(elem).is(until)) { | |
break; | |
} | |
matched.push(elem); | |
} | |
} | |
return matched; | |
}; | |
var _siblings = function _siblings(n, elem) { | |
var matched = []; | |
for (; n; n = n.nextSibling) { | |
if (n.nodeType === 1 && n !== elem) { | |
matched.push(n); | |
} | |
} | |
return matched; | |
}; | |
var rneedsContext = jQuery.expr.match.needsContext; | |
function nodeName(elem, name) { | |
return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase(); | |
}; | |
var rsingleTag = /^<([a-z][^\/\0>:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i; | |
var risSimple = /^.[^:#\[\.,]*$/; | |
// Implement the identical functionality for filter and not | |
function winnow(elements, qualifier, not) { | |
if (jQuery.isFunction(qualifier)) { | |
return jQuery.grep(elements, function (elem, i) { | |
return !!qualifier.call(elem, i, elem) !== not; | |
}); | |
} | |
// Single element | |
if (qualifier.nodeType) { | |
return jQuery.grep(elements, function (elem) { | |
return elem === qualifier !== not; | |
}); | |
} | |
// Arraylike of elements (jQuery, arguments, Array) | |
if (typeof qualifier !== "string") { | |
return jQuery.grep(elements, function (elem) { | |
return indexOf.call(qualifier, elem) > -1 !== not; | |
}); | |
} | |
// Simple selector that can be filtered directly, removing non-Elements | |
if (risSimple.test(qualifier)) { | |
return jQuery.filter(qualifier, elements, not); | |
} | |
// Complex selector, compare the two sets, removing non-Elements | |
qualifier = jQuery.filter(qualifier, elements); | |
return jQuery.grep(elements, function (elem) { | |
return indexOf.call(qualifier, elem) > -1 !== not && elem.nodeType === 1; | |
}); | |
} | |
jQuery.filter = function (expr, elems, not) { | |
var elem = elems[0]; | |
if (not) { | |
expr = ":not(" + expr + ")"; | |
} | |
if (elems.length === 1 && elem.nodeType === 1) { | |
return jQuery.find.matchesSelector(elem, expr) ? [elem] : []; | |
} | |
return jQuery.find.matches(expr, jQuery.grep(elems, function (elem) { | |
return elem.nodeType === 1; | |
})); | |
}; | |
jQuery.fn.extend({ | |
find: function find(selector) { | |
var i, | |
ret, | |
len = this.length, | |
self = this; | |
if (typeof selector !== "string") { | |
return this.pushStack(jQuery(selector).filter(function () { | |
for (i = 0; i < len; i++) { | |
if (jQuery.contains(self[i], this)) { | |
return true; | |
} | |
} | |
})); | |
} | |
ret = this.pushStack([]); | |
for (i = 0; i < len; i++) { | |
jQuery.find(selector, self[i], ret); | |
} | |
return len > 1 ? jQuery.uniqueSort(ret) : ret; | |
}, | |
filter: function filter(selector) { | |
return this.pushStack(winnow(this, selector || [], false)); | |
}, | |
not: function not(selector) { | |
return this.pushStack(winnow(this, selector || [], true)); | |
}, | |
is: function is(selector) { | |
return !!winnow(this, | |
// If this is a positional/relative selector, check membership in the returned set | |
// so $("p:first").is("p:last") won't return true for a doc with two "p". | |
typeof selector === "string" && rneedsContext.test(selector) ? jQuery(selector) : selector || [], false).length; | |
} | |
}); | |
// Initialize a jQuery object | |
// A central reference to the root jQuery(document) | |
var rootjQuery, | |
// A simple way to check for HTML strings | |
// Prioritize #id over <tag> to avoid XSS via location.hash (#9521) | |
// Strict HTML recognition (#11290: must start with <) | |
// Shortcut simple #id case for speed | |
rquickExpr = /^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]+))$/, | |
init = jQuery.fn.init = function (selector, context, root) { | |
var match, elem; | |
// HANDLE: $(""), $(null), $(undefined), $(false) | |
if (!selector) { | |
return this; | |
} | |
// Method init() accepts an alternate rootjQuery | |
// so migrate can support jQuery.sub (gh-2101) | |
root = root || rootjQuery; | |
// Handle HTML strings | |
if (typeof selector === "string") { | |
if (selector[0] === "<" && selector[selector.length - 1] === ">" && selector.length >= 3) { | |
// Assume that strings that start and end with <> are HTML and skip the regex check | |
match = [null, selector, null]; | |
} else { | |
match = rquickExpr.exec(selector); | |
} | |
// Match html or make sure no context is specified for #id | |
if (match && (match[1] || !context)) { | |
// HANDLE: $(html) -> $(array) | |
if (match[1]) { | |
context = context instanceof jQuery ? context[0] : context; | |
// Option to run scripts is true for back-compat | |
// Intentionally let the error be thrown if parseHTML is not present | |
jQuery.merge(this, jQuery.parseHTML(match[1], context && context.nodeType ? context.ownerDocument || context : document, true)); | |
// HANDLE: $(html, props) | |
if (rsingleTag.test(match[1]) && jQuery.isPlainObject(context)) { | |
for (match in context) { | |
// Properties of context are called as methods if possible | |
if (jQuery.isFunction(this[match])) { | |
this[match](context[match]); | |
// ...and otherwise set as attributes | |
} else { | |
this.attr(match, context[match]); | |
} | |
} | |
} | |
return this; | |
// HANDLE: $(#id) | |
} else { | |
elem = document.getElementById(match[2]); | |
if (elem) { | |
// Inject the element directly into the jQuery object | |
this[0] = elem; | |
this.length = 1; | |
} | |
return this; | |
} | |
// HANDLE: $(expr, $(...)) | |
} else if (!context || context.jquery) { | |
return (context || root).find(selector); | |
// HANDLE: $(expr, context) | |
// (which is just equivalent to: $(context).find(expr) | |
} else { | |
return this.constructor(context).find(selector); | |
} | |
// HANDLE: $(DOMElement) | |
} else if (selector.nodeType) { | |
this[0] = selector; | |
this.length = 1; | |
return this; | |
// HANDLE: $(function) | |
// Shortcut for document ready | |
} else if (jQuery.isFunction(selector)) { | |
return root.ready !== undefined ? root.ready(selector) : | |
// Execute immediately if ready is not present | |
selector(jQuery); | |
} | |
return jQuery.makeArray(selector, this); | |
}; | |
// Give the init function the jQuery prototype for later instantiation | |
init.prototype = jQuery.fn; | |
// Initialize central reference | |
rootjQuery = jQuery(document); | |
var rparentsprev = /^(?:parents|prev(?:Until|All))/, | |
// Methods guaranteed to produce a unique set when starting from a unique set | |
guaranteedUnique = { | |
children: true, | |
contents: true, | |
next: true, | |
prev: true | |
}; | |
jQuery.fn.extend({ | |
has: function has(target) { | |
var targets = jQuery(target, this), | |
l = targets.length; | |
return this.filter(function () { | |
var i = 0; | |
for (; i < l; i++) { | |
if (jQuery.contains(this, targets[i])) { | |
return true; | |
} | |
} | |
}); | |
}, | |
closest: function closest(selectors, context) { | |
var cur, | |
i = 0, | |
l = this.length, | |
matched = [], | |
targets = typeof selectors !== "string" && jQuery(selectors); | |
// Positional selectors never match, since there's no _selection_ context | |
if (!rneedsContext.test(selectors)) { | |
for (; i < l; i++) { | |
for (cur = this[i]; cur && cur !== context; cur = cur.parentNode) { | |
// Always skip document fragments | |
if (cur.nodeType < 11 && (targets ? targets.index(cur) > -1 : | |
// Don't pass non-elements to Sizzle | |
cur.nodeType === 1 && jQuery.find.matchesSelector(cur, selectors))) { | |
matched.push(cur); | |
break; | |
} | |
} | |
} | |
} | |
return this.pushStack(matched.length > 1 ? jQuery.uniqueSort(matched) : matched); | |
}, | |
// Determine the position of an element within the set | |
index: function index(elem) { | |
// No argument, return index in parent | |
if (!elem) { | |
return this[0] && this[0].parentNode ? this.first().prevAll().length : -1; | |
} | |
// Index in selector | |
if (typeof elem === "string") { | |
return indexOf.call(jQuery(elem), this[0]); | |
} | |
// Locate the position of the desired element | |
return indexOf.call(this, | |
// If it receives a jQuery object, the first element is used | |
elem.jquery ? elem[0] : elem); | |
}, | |
add: function add(selector, context) { | |
return this.pushStack(jQuery.uniqueSort(jQuery.merge(this.get(), jQuery(selector, context)))); | |
}, | |
addBack: function addBack(selector) { | |
return this.add(selector == null ? this.prevObject : this.prevObject.filter(selector)); | |
} | |
}); | |
function sibling(cur, dir) { | |
while ((cur = cur[dir]) && cur.nodeType !== 1) {} | |
return cur; | |
} | |
jQuery.each({ | |
parent: function parent(elem) { | |
var parent = elem.parentNode; | |
return parent && parent.nodeType !== 11 ? parent : null; | |
}, | |
parents: function parents(elem) { | |
return dir(elem, "parentNode"); | |
}, | |
parentsUntil: function parentsUntil(elem, i, until) { | |
return dir(elem, "parentNode", until); | |
}, | |
next: function next(elem) { | |
return sibling(elem, "nextSibling"); | |
}, | |
prev: function prev(elem) { | |
return sibling(elem, "previousSibling"); | |
}, | |
nextAll: function nextAll(elem) { | |
return dir(elem, "nextSibling"); | |
}, | |
prevAll: function prevAll(elem) { | |
return dir(elem, "previousSibling"); | |
}, | |
nextUntil: function nextUntil(elem, i, until) { | |
return dir(elem, "nextSibling", until); | |
}, | |
prevUntil: function prevUntil(elem, i, until) { | |
return dir(elem, "previousSibling", until); | |
}, | |
siblings: function siblings(elem) { | |
return _siblings((elem.parentNode || {}).firstChild, elem); | |
}, | |
children: function children(elem) { | |
return _siblings(elem.firstChild); | |
}, | |
contents: function contents(elem) { | |
if (nodeName(elem, "iframe")) { | |
return elem.contentDocument; | |
} | |
// Support: IE 9 - 11 only, iOS 7 only, Android Browser <=4.3 only | |
// Treat the template element as a regular one in browsers that | |
// don't support it. | |
if (nodeName(elem, "template")) { | |
elem = elem.content || elem; | |
} | |
return jQuery.merge([], elem.childNodes); | |
} | |
}, function (name, fn) { | |
jQuery.fn[name] = function (until, selector) { | |
var matched = jQuery.map(this, fn, until); | |
if (name.slice(-5) !== "Until") { | |
selector = until; | |
} | |
if (selector && typeof selector === "string") { | |
matched = jQuery.filter(selector, matched); | |
} | |
if (this.length > 1) { | |
// Remove duplicates | |
if (!guaranteedUnique[name]) { | |
jQuery.uniqueSort(matched); | |
} | |
// Reverse order for parents* and prev-derivatives | |
if (rparentsprev.test(name)) { | |
matched.reverse(); | |
} | |
} | |
return this.pushStack(matched); | |
}; | |
}); | |
var rnothtmlwhite = /[^\x20\t\r\n\f]+/g; | |
// Convert String-formatted options into Object-formatted ones | |
function createOptions(options) { | |
var object = {}; | |
jQuery.each(options.match(rnothtmlwhite) || [], function (_, flag) { | |
object[flag] = true; | |
}); | |
return object; | |
} | |
/* | |
* Create a callback list using the following parameters: | |
* | |
* options: an optional list of space-separated options that will change how | |
* the callback list behaves or a more traditional option object | |
* | |
* By default a callback list will act like an event callback list and can be | |
* "fired" multiple times. | |
* | |
* Possible options: | |
* | |
* once: will ensure the callback list can only be fired once (like a Deferred) | |
* | |
* memory: will keep track of previous values and will call any callback added | |
* after the list has been fired right away with the latest "memorized" | |
* values (like a Deferred) | |
* | |
* unique: will ensure a callback can only be added once (no duplicate in the list) | |
* | |
* stopOnFalse: interrupt callings when a callback returns false | |
* | |
*/ | |
jQuery.Callbacks = function (options) { | |
// Convert options from String-formatted to Object-formatted if needed | |
// (we check in cache first) | |
options = typeof options === "string" ? createOptions(options) : jQuery.extend({}, options); | |
var // Flag to know if list is currently firing | |
firing, | |
// Last fire value for non-forgettable lists | |
memory, | |
// Flag to know if list was already fired | |
_fired, | |
// Flag to prevent firing | |
_locked, | |
// Actual callback list | |
list = [], | |
// Queue of execution data for repeatable lists | |
queue = [], | |
// Index of currently firing callback (modified by add/remove as needed) | |
firingIndex = -1, | |
// Fire callbacks | |
fire = function fire() { | |
// Enforce single-firing | |
_locked = _locked || options.once; | |
// Execute callbacks for all pending executions, | |
// respecting firingIndex overrides and runtime changes | |
_fired = firing = true; | |
for (; queue.length; firingIndex = -1) { | |
memory = queue.shift(); | |
while (++firingIndex < list.length) { | |
// Run callback and check for early termination | |
if (list[firingIndex].apply(memory[0], memory[1]) === false && options.stopOnFalse) { | |
// Jump to end and forget the data so .add doesn't re-fire | |
firingIndex = list.length; | |
memory = false; | |
} | |
} | |
} | |
// Forget the data if we're done with it | |
if (!options.memory) { | |
memory = false; | |
} | |
firing = false; | |
// Clean up if we're done firing for good | |
if (_locked) { | |
// Keep an empty list if we have data for future add calls | |
if (memory) { | |
list = []; | |
// Otherwise, this object is spent | |
} else { | |
list = ""; | |
} | |
} | |
}, | |
// Actual Callbacks object | |
self = { | |
// Add a callback or a collection of callbacks to the list | |
add: function add() { | |
if (list) { | |
// If we have memory from a past run, we should fire after adding | |
if (memory && !firing) { | |
firingIndex = list.length - 1; | |
queue.push(memory); | |
} | |
(function add(args) { | |
jQuery.each(args, function (_, arg) { | |
if (jQuery.isFunction(arg)) { | |
if (!options.unique || !self.has(arg)) { | |
list.push(arg); | |
} | |
} else if (arg && arg.length && jQuery.type(arg) !== "string") { | |
// Inspect recursively | |
add(arg); | |
} | |
}); | |
})(arguments); | |
if (memory && !firing) { | |
fire(); | |
} | |
} | |
return this; | |
}, | |
// Remove a callback from the list | |
remove: function remove() { | |
jQuery.each(arguments, function (_, arg) { | |
var index; | |
while ((index = jQuery.inArray(arg, list, index)) > -1) { | |
list.splice(index, 1); | |
// Handle firing indexes | |
if (index <= firingIndex) { | |
firingIndex--; | |
} | |
} | |
}); | |
return this; | |
}, | |
// Check if a given callback is in the list. | |
// If no argument is given, return whether or not list has callbacks attached. | |
has: function has(fn) { | |
return fn ? jQuery.inArray(fn, list) > -1 : list.length > 0; | |
}, | |
// Remove all callbacks from the list | |
empty: function empty() { | |
if (list) { | |
list = []; | |
} | |
return this; | |
}, | |
// Disable .fire and .add | |
// Abort any current/pending executions | |
// Clear all callbacks and values | |
disable: function disable() { | |
_locked = queue = []; | |
list = memory = ""; | |
return this; | |
}, | |
disabled: function disabled() { | |
return !list; | |
}, | |
// Disable .fire | |
// Also disable .add unless we have memory (since it would have no effect) | |
// Abort any pending executions | |
lock: function lock() { | |
_locked = queue = []; | |
if (!memory && !firing) { | |
list = memory = ""; | |
} | |
return this; | |
}, | |
locked: function locked() { | |
return !!_locked; | |
}, | |
// Call all callbacks with the given context and arguments | |
fireWith: function fireWith(context, args) { | |
if (!_locked) { | |
args = args || []; | |
args = [context, args.slice ? args.slice() : args]; | |
queue.push(args); | |
if (!firing) { | |
fire(); | |
} | |
} | |
return this; | |
}, | |
// Call all the callbacks with the given arguments | |
fire: function fire() { | |
self.fireWith(this, arguments); | |
return this; | |
}, | |
// To know if the callbacks have already been called at least once | |
fired: function fired() { | |
return !!_fired; | |
} | |
}; | |
return self; | |
}; | |
function Identity(v) { | |
return v; | |
} | |
function Thrower(ex) { | |
throw ex; | |
} | |
function adoptValue(value, resolve, reject, noValue) { | |
var method; | |
try { | |
// Check for promise aspect first to privilege synchronous behavior | |
if (value && jQuery.isFunction(method = value.promise)) { | |
method.call(value).done(resolve).fail(reject); | |
// Other thenables | |
} else if (value && jQuery.isFunction(method = value.then)) { | |
method.call(value, resolve, reject); | |
// Other non-thenables | |
} else { | |
// Control `resolve` arguments by letting Array#slice cast boolean `noValue` to integer: | |
// * false: [ value ].slice( 0 ) => resolve( value ) | |
// * true: [ value ].slice( 1 ) => resolve() | |
resolve.apply(undefined, [value].slice(noValue)); | |
} | |
// For Promises/A+, convert exceptions into rejections | |
// Since jQuery.when doesn't unwrap thenables, we can skip the extra checks appearing in | |
// Deferred#then to conditionally suppress rejection. | |
} catch (value) { | |
// Support: Android 4.0 only | |
// Strict mode functions invoked without .call/.apply get global-object context | |
reject.apply(undefined, [value]); | |
} | |
} | |
jQuery.extend({ | |
Deferred: function Deferred(func) { | |
var tuples = [ | |
// action, add listener, callbacks, | |
// ... .then handlers, argument index, [final state] | |
["notify", "progress", jQuery.Callbacks("memory"), jQuery.Callbacks("memory"), 2], ["resolve", "done", jQuery.Callbacks("once memory"), jQuery.Callbacks("once memory"), 0, "resolved"], ["reject", "fail", jQuery.Callbacks("once memory"), jQuery.Callbacks("once memory"), 1, "rejected"]], | |
_state = "pending", | |
_promise = { | |
state: function state() { | |
return _state; | |
}, | |
always: function always() { | |
deferred.done(arguments).fail(arguments); | |
return this; | |
}, | |
"catch": function _catch(fn) { | |
return _promise.then(null, fn); | |
}, | |
// Keep pipe for back-compat | |
pipe: function pipe() /* fnDone, fnFail, fnProgress */{ | |
var fns = arguments; | |
return jQuery.Deferred(function (newDefer) { | |
jQuery.each(tuples, function (i, tuple) { | |
// Map tuples (progress, done, fail) to arguments (done, fail, progress) | |
var fn = jQuery.isFunction(fns[tuple[4]]) && fns[tuple[4]]; | |
// deferred.progress(function() { bind to newDefer or newDefer.notify }) | |
// deferred.done(function() { bind to newDefer or newDefer.resolve }) | |
// deferred.fail(function() { bind to newDefer or newDefer.reject }) | |
deferred[tuple[1]](function () { | |
var returned = fn && fn.apply(this, arguments); | |
if (returned && jQuery.isFunction(returned.promise)) { | |
returned.promise().progress(newDefer.notify).done(newDefer.resolve).fail(newDefer.reject); | |
} else { | |
newDefer[tuple[0] + "With"](this, fn ? [returned] : arguments); | |
} | |
}); | |
}); | |
fns = null; | |
}).promise(); | |
}, | |
then: function then(onFulfilled, onRejected, onProgress) { | |
var maxDepth = 0; | |
function resolve(depth, deferred, handler, special) { | |
return function () { | |
var that = this, | |
args = arguments, | |
mightThrow = function mightThrow() { | |
var returned, then; | |
// Support: Promises/A+ section 2.3.3.3.3 | |
// https://promisesaplus.com/#point-59 | |
// Ignore double-resolution attempts | |
if (depth < maxDepth) { | |
return; | |
} | |
returned = handler.apply(that, args); | |
// Support: Promises/A+ section 2.3.1 | |
// https://promisesaplus.com/#point-48 | |
if (returned === deferred.promise()) { | |
throw new TypeError("Thenable self-resolution"); | |
} | |
// Support: Promises/A+ sections 2.3.3.1, 3.5 | |
// https://promisesaplus.com/#point-54 | |
// https://promisesaplus.com/#point-75 | |
// Retrieve `then` only once | |
then = returned && ( | |
// Support: Promises/A+ section 2.3.4 | |
// https://promisesaplus.com/#point-64 | |
// Only check objects and functions for thenability | |
(typeof returned === "undefined" ? "undefined" : _typeof(returned)) === "object" || typeof returned === "function") && returned.then; | |
// Handle a returned thenable | |
if (jQuery.isFunction(then)) { | |
// Special processors (notify) just wait for resolution | |
if (special) { | |
then.call(returned, resolve(maxDepth, deferred, Identity, special), resolve(maxDepth, deferred, Thrower, special)); | |
// Normal processors (resolve) also hook into progress | |
} else { | |
// ...and disregard older resolution values | |
maxDepth++; | |
then.call(returned, resolve(maxDepth, deferred, Identity, special), resolve(maxDepth, deferred, Thrower, special), resolve(maxDepth, deferred, Identity, deferred.notifyWith)); | |
} | |
// Handle all other returned values | |
} else { | |
// Only substitute handlers pass on context | |
// and multiple values (non-spec behavior) | |
if (handler !== Identity) { | |
that = undefined; | |
args = [returned]; | |
} | |
// Process the value(s) | |
// Default process is resolve | |
(special || deferred.resolveWith)(that, args); | |
} | |
}, | |
// Only normal processors (resolve) catch and reject exceptions | |
process = special ? mightThrow : function () { | |
try { | |
mightThrow(); | |
} catch (e) { | |
if (jQuery.Deferred.exceptionHook) { | |
jQuery.Deferred.exceptionHook(e, process.stackTrace); | |
} | |
// Support: Promises/A+ section 2.3.3.3.4.1 | |
// https://promisesaplus.com/#point-61 | |
// Ignore post-resolution exceptions | |
if (depth + 1 >= maxDepth) { | |
// Only substitute handlers pass on context | |
// and multiple values (non-spec behavior) | |
if (handler !== Thrower) { | |
that = undefined; | |
args = [e]; | |
} | |
deferred.rejectWith(that, args); | |
} | |
} | |
}; | |
// Support: Promises/A+ section 2.3.3.3.1 | |
// https://promisesaplus.com/#point-57 | |
// Re-resolve promises immediately to dodge false rejection from | |
// subsequent errors | |
if (depth) { | |
process(); | |
} else { | |
// Call an optional hook to record the stack, in case of exception | |
// since it's otherwise lost when execution goes async | |
if (jQuery.Deferred.getStackHook) { | |
process.stackTrace = jQuery.Deferred.getStackHook(); | |
} | |
window.setTimeout(process); | |
} | |
}; | |
} | |
return jQuery.Deferred(function (newDefer) { | |
// progress_handlers.add( ... ) | |
tuples[0][3].add(resolve(0, newDefer, jQuery.isFunction(onProgress) ? onProgress : Identity, newDefer.notifyWith)); | |
// fulfilled_handlers.add( ... ) | |
tuples[1][3].add(resolve(0, newDefer, jQuery.isFunction(onFulfilled) ? onFulfilled : Identity)); | |
// rejected_handlers.add( ... ) | |
tuples[2][3].add(resolve(0, newDefer, jQuery.isFunction(onRejected) ? onRejected : Thrower)); | |
}).promise(); | |
}, | |
// Get a promise for this deferred | |
// If obj is provided, the promise aspect is added to the object | |
promise: function promise(obj) { | |
return obj != null ? jQuery.extend(obj, _promise) : _promise; | |
} | |
}, | |
deferred = {}; | |
// Add list-specific methods | |
jQuery.each(tuples, function (i, tuple) { | |
var list = tuple[2], | |
stateString = tuple[5]; | |
// promise.progress = list.add | |
// promise.done = list.add | |
// promise.fail = list.add | |
_promise[tuple[1]] = list.add; | |
// Handle state | |
if (stateString) { | |
list.add(function () { | |
// state = "resolved" (i.e., fulfilled) | |
// state = "rejected" | |
_state = stateString; | |
}, | |
// rejected_callbacks.disable | |
// fulfilled_callbacks.disable | |
tuples[3 - i][2].disable, | |
// progress_callbacks.lock | |
tuples[0][2].lock); | |
} | |
// progress_handlers.fire | |
// fulfilled_handlers.fire | |
// rejected_handlers.fire | |
list.add(tuple[3].fire); | |
// deferred.notify = function() { deferred.notifyWith(...) } | |
// deferred.resolve = function() { deferred.resolveWith(...) } | |
// deferred.reject = function() { deferred.rejectWith(...) } | |
deferred[tuple[0]] = function () { | |
deferred[tuple[0] + "With"](this === deferred ? undefined : this, arguments); | |
return this; | |
}; | |
// deferred.notifyWith = list.fireWith | |
// deferred.resolveWith = list.fireWith | |
// deferred.rejectWith = list.fireWith | |
deferred[tuple[0] + "With"] = list.fireWith; | |
}); | |
// Make the deferred a promise | |
_promise.promise(deferred); | |
// Call given func if any | |
if (func) { | |
func.call(deferred, deferred); | |
} | |
// All done! | |
return deferred; | |
}, | |
// Deferred helper | |
when: function when(singleValue) { | |
var | |
// count of uncompleted subordinates | |
remaining = arguments.length, | |
// count of unprocessed arguments | |
i = remaining, | |
// subordinate fulfillment data | |
resolveContexts = Array(i), | |
resolveValues = _slice.call(arguments), | |
// the master Deferred | |
master = jQuery.Deferred(), | |
// subordinate callback factory | |
updateFunc = function updateFunc(i) { | |
return function (value) { | |
resolveContexts[i] = this; | |
resolveValues[i] = arguments.length > 1 ? _slice.call(arguments) : value; | |
if (! --remaining) { | |
master.resolveWith(resolveContexts, resolveValues); | |
} | |
}; | |
}; | |
// Single- and empty arguments are adopted like Promise.resolve | |
if (remaining <= 1) { | |
adoptValue(singleValue, master.done(updateFunc(i)).resolve, master.reject, !remaining); | |
// Use .then() to unwrap secondary thenables (cf. gh-3000) | |
if (master.state() === "pending" || jQuery.isFunction(resolveValues[i] && resolveValues[i].then)) { | |
return master.then(); | |
} | |
} | |
// Multiple arguments are aggregated like Promise.all array elements | |
while (i--) { | |
adoptValue(resolveValues[i], updateFunc(i), master.reject); | |
} | |
return master.promise(); | |
} | |
}); | |
// These usually indicate a programmer mistake during development, | |
// warn about them ASAP rather than swallowing them by default. | |
var rerrorNames = /^(Eval|Internal|Range|Reference|Syntax|Type|URI)Error$/; | |
jQuery.Deferred.exceptionHook = function (error, stack) { | |
// Support: IE 8 - 9 only | |
// Console exists when dev tools are open, which can happen at any time | |
if (window.console && window.console.warn && error && rerrorNames.test(error.name)) { | |
window.console.warn("jQuery.Deferred exception: " + error.message, error.stack, stack); | |
} | |
}; | |
jQuery.readyException = function (error) { | |
window.setTimeout(function () { | |
throw error; | |
}); | |
}; | |
// The deferred used on DOM ready | |
var readyList = jQuery.Deferred(); | |
jQuery.fn.ready = function (fn) { | |
readyList.then(fn) | |
// Wrap jQuery.readyException in a function so that the lookup | |
// happens at the time of error handling instead of callback | |
// registration. | |
.catch(function (error) { | |
jQuery.readyException(error); | |
}); | |
return this; | |
}; | |
jQuery.extend({ | |
// Is the DOM ready to be used? Set to true once it occurs. | |
isReady: false, | |
// A counter to track how many items to wait for before | |
// the ready event fires. See #6781 | |
readyWait: 1, | |
// Handle when the DOM is ready | |
ready: function ready(wait) { | |
// Abort if there are pending holds or we're already ready | |
if (wait === true ? --jQuery.readyWait : jQuery.isReady) { | |
return; | |
} | |
// Remember that the DOM is ready | |
jQuery.isReady = true; | |
// If a normal DOM Ready event fired, decrement, and wait if need be | |
if (wait !== true && --jQuery.readyWait > 0) { | |
return; | |
} | |
// If there are functions bound, to execute | |
readyList.resolveWith(document, [jQuery]); | |
} | |
}); | |
jQuery.ready.then = readyList.then; | |
// The ready event handler and self cleanup method | |
function completed() { | |
document.removeEventListener("DOMContentLoaded", completed); | |
window.removeEventListener("load", completed); | |
jQuery.ready(); | |
} | |
// Catch cases where $(document).ready() is called | |
// after the browser event has already occurred. | |
// Support: IE <=9 - 10 only | |
// Older IE sometimes signals "interactive" too soon | |
if (document.readyState === "complete" || document.readyState !== "loading" && !document.documentElement.doScroll) { | |
// Handle it asynchronously to allow scripts the opportunity to delay ready | |
window.setTimeout(jQuery.ready); | |
} else { | |
// Use the handy event callback | |
document.addEventListener("DOMContentLoaded", completed); | |
// A fallback to window.onload, that will always work | |
window.addEventListener("load", completed); | |
} | |
// Multifunctional method to get and set values of a collection | |
// The value/s can optionally be executed if it's a function | |
var access = function access(elems, fn, key, value, chainable, emptyGet, raw) { | |
var i = 0, | |
len = elems.length, | |
bulk = key == null; | |
// Sets many values | |
if (jQuery.type(key) === "object") { | |
chainable = true; | |
for (i in key) { | |
access(elems, fn, i, key[i], true, emptyGet, raw); | |
} | |
// Sets one value | |
} else if (value !== undefined) { | |
chainable = true; | |
if (!jQuery.isFunction(value)) { | |
raw = true; | |
} | |
if (bulk) { | |
// Bulk operations run against the entire set | |
if (raw) { | |
fn.call(elems, value); | |
fn = null; | |
// ...except when executing function values | |
} else { | |
bulk = fn; | |
fn = function fn(elem, key, value) { | |
return bulk.call(jQuery(elem), value); | |
}; | |
} | |
} | |
if (fn) { | |
for (; i < len; i++) { | |
fn(elems[i], key, raw ? value : value.call(elems[i], i, fn(elems[i], key))); | |
} | |
} | |
} | |
if (chainable) { | |
return elems; | |
} | |
// Gets | |
if (bulk) { | |
return fn.call(elems); | |
} | |
return len ? fn(elems[0], key) : emptyGet; | |
}; | |
var acceptData = function acceptData(owner) { | |
// Accepts only: | |
// - Node | |
// - Node.ELEMENT_NODE | |
// - Node.DOCUMENT_NODE | |
// - Object | |
// - Any | |
return owner.nodeType === 1 || owner.nodeType === 9 || !+owner.nodeType; | |
}; | |
function Data() { | |
this.expando = jQuery.expando + Data.uid++; | |
} | |
Data.uid = 1; | |
Data.prototype = { | |
cache: function cache(owner) { | |
// Check if the owner object already has a cache | |
var value = owner[this.expando]; | |
// If not, create one | |
if (!value) { | |
value = {}; | |
// We can accept data for non-element nodes in modern browsers, | |
// but we should not, see #8335. | |
// Always return an empty object. | |
if (acceptData(owner)) { | |
// If it is a node unlikely to be stringify-ed or looped over | |
// use plain assignment | |
if (owner.nodeType) { | |
owner[this.expando] = value; | |
// Otherwise secure it in a non-enumerable property | |
// configurable must be true to allow the property to be | |
// deleted when data is removed | |
} else { | |
Object.defineProperty(owner, this.expando, { | |
value: value, | |
configurable: true | |
}); | |
} | |
} | |
} | |
return value; | |
}, | |
set: function set(owner, data, value) { | |
var prop, | |
cache = this.cache(owner); | |
// Handle: [ owner, key, value ] args | |
// Always use camelCase key (gh-2257) | |
if (typeof data === "string") { | |
cache[jQuery.camelCase(data)] = value; | |
// Handle: [ owner, { properties } ] args | |
} else { | |
// Copy the properties one-by-one to the cache object | |
for (prop in data) { | |
cache[jQuery.camelCase(prop)] = data[prop]; | |
} | |
} | |
return cache; | |
}, | |
get: function get(owner, key) { | |
return key === undefined ? this.cache(owner) : | |
// Always use camelCase key (gh-2257) | |
owner[this.expando] && owner[this.expando][jQuery.camelCase(key)]; | |
}, | |
access: function access(owner, key, value) { | |
// In cases where either: | |
// | |
// 1. No key was specified | |
// 2. A string key was specified, but no value provided | |
// | |
// Take the "read" path and allow the get method to determine | |
// which value to return, respectively either: | |
// | |
// 1. The entire cache object | |
// 2. The data stored at the key | |
// | |
if (key === undefined || key && typeof key === "string" && value === undefined) { | |
return this.get(owner, key); | |
} | |
// When the key is not a string, or both a key and value | |
// are specified, set or extend (existing objects) with either: | |
// | |
// 1. An object of properties | |
// 2. A key and value | |
// | |
this.set(owner, key, value); | |
// Since the "set" path can have two possible entry points | |
// return the expected data based on which path was taken[*] | |
return value !== undefined ? value : key; | |
}, | |
remove: function remove(owner, key) { | |
var i, | |
cache = owner[this.expando]; | |
if (cache === undefined) { | |
return; | |
} | |
if (key !== undefined) { | |
// Support array or space separated string of keys | |
if (Array.isArray(key)) { | |
// If key is an array of keys... | |
// We always set camelCase keys, so remove that. | |
key = key.map(jQuery.camelCase); | |
} else { | |
key = jQuery.camelCase(key); | |
// If a key with the spaces exists, use it. | |
// Otherwise, create an array by matching non-whitespace | |
key = key in cache ? [key] : key.match(rnothtmlwhite) || []; | |
} | |
i = key.length; | |
while (i--) { | |
delete cache[key[i]]; | |
} | |
} | |
// Remove the expando if there's no more data | |
if (key === undefined || jQuery.isEmptyObject(cache)) { | |
// Support: Chrome <=35 - 45 | |
// Webkit & Blink performance suffers when deleting properties | |
// from DOM nodes, so set to undefined instead | |
// https://bugs.chromium.org/p/chromium/issues/detail?id=378607 (bug restricted) | |
if (owner.nodeType) { | |
owner[this.expando] = undefined; | |
} else { | |
delete owner[this.expando]; | |
} | |
} | |
}, | |
hasData: function hasData(owner) { | |
var cache = owner[this.expando]; | |
return cache !== undefined && !jQuery.isEmptyObject(cache); | |
} | |
}; | |
var dataPriv = new Data(); | |
var dataUser = new Data(); | |
// Implementation Summary | |
// | |
// 1. Enforce API surface and semantic compatibility with 1.9.x branch | |
// 2. Improve the module's maintainability by reducing the storage | |
// paths to a single mechanism. | |
// 3. Use the same single mechanism to support "private" and "user" data. | |
// 4. _Never_ expose "private" data to user code (TODO: Drop _data, _removeData) | |
// 5. Avoid exposing implementation details on user objects (eg. expando properties) | |
// 6. Provide a clear path for implementation upgrade to WeakMap in 2014 | |
var rbrace = /^(?:\{[\w\W]*\}|\[[\w\W]*\])$/, | |
rmultiDash = /[A-Z]/g; | |
function getData(data) { | |
if (data === "true") { | |
return true; | |
} | |
if (data === "false") { | |
return false; | |
} | |
if (data === "null") { | |
return null; | |
} | |
// Only convert to a number if it doesn't change the string | |
if (data === +data + "") { | |
return +data; | |
} | |
if (rbrace.test(data)) { | |
return JSON.parse(data); | |
} | |
return data; | |
} | |
function dataAttr(elem, key, data) { | |
var name; | |
// If nothing was found internally, try to fetch any | |
// data from the HTML5 data-* attribute | |
if (data === undefined && elem.nodeType === 1) { | |
name = "data-" + key.replace(rmultiDash, "-$&").toLowerCase(); | |
data = elem.getAttribute(name); | |
if (typeof data === "string") { | |
try { | |
data = getData(data); | |
} catch (e) {} | |
// Make sure we set the data so it isn't changed later | |
dataUser.set(elem, key, data); | |
} else { | |
data = undefined; | |
} | |
} | |
return data; | |
} | |
jQuery.extend({ | |
hasData: function hasData(elem) { | |
return dataUser.hasData(elem) || dataPriv.hasData(elem); | |
}, | |
data: function data(elem, name, _data) { | |
return dataUser.access(elem, name, _data); | |
}, | |
removeData: function removeData(elem, name) { | |
dataUser.remove(elem, name); | |
}, | |
// TODO: Now that all calls to _data and _removeData have been replaced | |
// with direct calls to dataPriv methods, these can be deprecated. | |
_data: function _data(elem, name, data) { | |
return dataPriv.access(elem, name, data); | |
}, | |
_removeData: function _removeData(elem, name) { | |
dataPriv.remove(elem, name); | |
} | |
}); | |
jQuery.fn.extend({ | |
data: function data(key, value) { | |
var i, | |
name, | |
data, | |
elem = this[0], | |
attrs = elem && elem.attributes; | |
// Gets all values | |
if (key === undefined) { | |
if (this.length) { | |
data = dataUser.get(elem); | |
if (elem.nodeType === 1 && !dataPriv.get(elem, "hasDataAttrs")) { | |
i = attrs.length; | |
while (i--) { | |
// Support: IE 11 only | |
// The attrs elements can be null (#14894) | |
if (attrs[i]) { | |
name = attrs[i].name; | |
if (name.indexOf("data-") === 0) { | |
name = jQuery.camelCase(name.slice(5)); | |
dataAttr(elem, name, data[name]); | |
} | |
} | |
} | |
dataPriv.set(elem, "hasDataAttrs", true); | |
} | |
} | |
return data; | |
} | |
// Sets multiple values | |
if ((typeof key === "undefined" ? "undefined" : _typeof(key)) === "object") { | |
return this.each(function () { | |
dataUser.set(this, key); | |
}); | |
} | |
return access(this, function (value) { | |
var data; | |
// The calling jQuery object (element matches) is not empty | |
// (and therefore has an element appears at this[ 0 ]) and the | |
// `value` parameter was not undefined. An empty jQuery object | |
// will result in `undefined` for elem = this[ 0 ] which will | |
// throw an exception if an attempt to read a data cache is made. | |
if (elem && value === undefined) { | |
// Attempt to get data from the cache | |
// The key will always be camelCased in Data | |
data = dataUser.get(elem, key); | |
if (data !== undefined) { | |
return data; | |
} | |
// Attempt to "discover" the data in | |
// HTML5 custom data-* attrs | |
data = dataAttr(elem, key); | |
if (data !== undefined) { | |
return data; | |
} | |
// We tried really hard, but the data doesn't exist. | |
return; | |
} | |
// Set the data... | |
this.each(function () { | |
// We always store the camelCased key | |
dataUser.set(this, key, value); | |
}); | |
}, null, value, arguments.length > 1, null, true); | |
}, | |
removeData: function removeData(key) { | |
return this.each(function () { | |
dataUser.remove(this, key); | |
}); | |
} | |
}); | |
jQuery.extend({ | |
queue: function queue(elem, type, data) { | |
var queue; | |
if (elem) { | |
type = (type || "fx") + "queue"; | |
queue = dataPriv.get(elem, type); | |
// Speed up dequeue by getting out quickly if this is just a lookup | |
if (data) { | |
if (!queue || Array.isArray(data)) { | |
queue = dataPriv.access(elem, type, jQuery.makeArray(data)); | |
} else { | |
queue.push(data); | |
} | |
} | |
return queue || []; | |
} | |
}, | |
dequeue: function dequeue(elem, type) { | |
type = type || "fx"; | |
var queue = jQuery.queue(elem, type), | |
startLength = queue.length, | |
fn = queue.shift(), | |
hooks = jQuery._queueHooks(elem, type), | |
next = function next() { | |
jQuery.dequeue(elem, type); | |
}; | |
// If the fx queue is dequeued, always remove the progress sentinel | |
if (fn === "inprogress") { | |
fn = queue.shift(); | |
startLength--; | |
} | |
if (fn) { | |
// Add a progress sentinel to prevent the fx queue from being | |
// automatically dequeued | |
if (type === "fx") { | |
queue.unshift("inprogress"); | |
} | |
// Clear up the last queue stop function | |
delete hooks.stop; | |
fn.call(elem, next, hooks); | |
} | |
if (!startLength && hooks) { | |
hooks.empty.fire(); | |
} | |
}, | |
// Not public - generate a queueHooks object, or return the current one | |
_queueHooks: function _queueHooks(elem, type) { | |
var key = type + "queueHooks"; | |
return dataPriv.get(elem, key) || dataPriv.access(elem, key, { | |
empty: jQuery.Callbacks("once memory").add(function () { | |
dataPriv.remove(elem, [type + "queue", key]); | |
}) | |
}); | |
} | |
}); | |
jQuery.fn.extend({ | |
queue: function queue(type, data) { | |
var setter = 2; | |
if (typeof type !== "string") { | |
data = type; | |
type = "fx"; | |
setter--; | |
} | |
if (arguments.length < setter) { | |
return jQuery.queue(this[0], type); | |
} | |
return data === undefined ? this : this.each(function () { | |
var queue = jQuery.queue(this, type, data); | |
// Ensure a hooks for this queue | |
jQuery._queueHooks(this, type); | |
if (type === "fx" && queue[0] !== "inprogress") { | |
jQuery.dequeue(this, type); | |
} | |
}); | |
}, | |
dequeue: function dequeue(type) { | |
return this.each(function () { | |
jQuery.dequeue(this, type); | |
}); | |
}, | |
clearQueue: function clearQueue(type) { | |
return this.queue(type || "fx", []); | |
}, | |
// Get a promise resolved when queues of a certain type | |
// are emptied (fx is the type by default) | |
promise: function promise(type, obj) { | |
var tmp, | |
count = 1, | |
defer = jQuery.Deferred(), | |
elements = this, | |
i = this.length, | |
resolve = function resolve() { | |
if (! --count) { | |
defer.resolveWith(elements, [elements]); | |
} | |
}; | |
if (typeof type !== "string") { | |
obj = type; | |
type = undefined; | |
} | |
type = type || "fx"; | |
while (i--) { | |
tmp = dataPriv.get(elements[i], type + "queueHooks"); | |
if (tmp && tmp.empty) { | |
count++; | |
tmp.empty.add(resolve); | |
} | |
} | |
resolve(); | |
return defer.promise(obj); | |
} | |
}); | |
var pnum = /[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/.source; | |
var rcssNum = new RegExp("^(?:([+-])=|)(" + pnum + ")([a-z%]*)$", "i"); | |
var cssExpand = ["Top", "Right", "Bottom", "Left"]; | |
var isHiddenWithinTree = function isHiddenWithinTree(elem, el) { | |
// isHiddenWithinTree might be called from jQuery#filter function; | |
// in that case, element will be second argument | |
elem = el || elem; | |
// Inline style trumps all | |
return elem.style.display === "none" || elem.style.display === "" && | |
// Otherwise, check computed style | |
// Support: Firefox <=43 - 45 | |
// Disconnected elements can have computed display: none, so first confirm that elem is | |
// in the document. | |
jQuery.contains(elem.ownerDocument, elem) && jQuery.css(elem, "display") === "none"; | |
}; | |
var swap = function swap(elem, options, callback, args) { | |
var ret, | |
name, | |
old = {}; | |
// Remember the old values, and insert the new ones | |
for (name in options) { | |
old[name] = elem.style[name]; | |
elem.style[name] = options[name]; | |
} | |
ret = callback.apply(elem, args || []); | |
// Revert the old values | |
for (name in options) { | |
elem.style[name] = old[name]; | |
} | |
return ret; | |
}; | |
function adjustCSS(elem, prop, valueParts, tween) { | |
var adjusted, | |
scale = 1, | |
maxIterations = 20, | |
currentValue = tween ? function () { | |
return tween.cur(); | |
} : function () { | |
return jQuery.css(elem, prop, ""); | |
}, | |
initial = currentValue(), | |
unit = valueParts && valueParts[3] || (jQuery.cssNumber[prop] ? "" : "px"), | |
// Starting value computation is required for potential unit mismatches | |
initialInUnit = (jQuery.cssNumber[prop] || unit !== "px" && +initial) && rcssNum.exec(jQuery.css(elem, prop)); | |
if (initialInUnit && initialInUnit[3] !== unit) { | |
// Trust units reported by jQuery.css | |
unit = unit || initialInUnit[3]; | |
// Make sure we update the tween properties later on | |
valueParts = valueParts || []; | |
// Iteratively approximate from a nonzero starting point | |
initialInUnit = +initial || 1; | |
do { | |
// If previous iteration zeroed out, double until we get *something*. | |
// Use string for doubling so we don't accidentally see scale as unchanged below | |
scale = scale || ".5"; | |
// Adjust and apply | |
initialInUnit = initialInUnit / scale; | |
jQuery.style(elem, prop, initialInUnit + unit); | |
// Update scale, tolerating zero or NaN from tween.cur() | |
// Break the loop if scale is unchanged or perfect, or if we've just had enough. | |
} while (scale !== (scale = currentValue() / initial) && scale !== 1 && --maxIterations); | |
} | |
if (valueParts) { | |
initialInUnit = +initialInUnit || +initial || 0; | |
// Apply relative offset (+=/-=) if specified | |
adjusted = valueParts[1] ? initialInUnit + (valueParts[1] + 1) * valueParts[2] : +valueParts[2]; | |
if (tween) { | |
tween.unit = unit; | |
tween.start = initialInUnit; | |
tween.end = adjusted; | |
} | |
} | |
return adjusted; | |
} | |
var defaultDisplayMap = {}; | |
function getDefaultDisplay(elem) { | |
var temp, | |
doc = elem.ownerDocument, | |
nodeName = elem.nodeName, | |
display = defaultDisplayMap[nodeName]; | |
if (display) { | |
return display; | |
} | |
temp = doc.body.appendChild(doc.createElement(nodeName)); | |
display = jQuery.css(temp, "display"); | |
temp.parentNode.removeChild(temp); | |
if (display === "none") { | |
display = "block"; | |
} | |
defaultDisplayMap[nodeName] = display; | |
return display; | |
} | |
function showHide(elements, show) { | |
var display, | |
elem, | |
values = [], | |
index = 0, | |
length = elements.length; | |
// Determine new display value for elements that need to change | |
for (; index < length; index++) { | |
elem = elements[index]; | |
if (!elem.style) { | |
continue; | |
} | |
display = elem.style.display; | |
if (show) { | |
// Since we force visibility upon cascade-hidden elements, an immediate (and slow) | |
// check is required in this first loop unless we have a nonempty display value (either | |
// inline or about-to-be-restored) | |
if (display === "none") { | |
values[index] = dataPriv.get(elem, "display") || null; | |
if (!values[index]) { | |
elem.style.display = ""; | |
} | |
} | |
if (elem.style.display === "" && isHiddenWithinTree(elem)) { | |
values[index] = getDefaultDisplay(elem); | |
} | |
} else { | |
if (display !== "none") { | |
values[index] = "none"; | |
// Remember what we're overwriting | |
dataPriv.set(elem, "display", display); | |
} | |
} | |
} | |
// Set the display of the elements in a second loop to avoid constant reflow | |
for (index = 0; index < length; index++) { | |
if (values[index] != null) { | |
elements[index].style.display = values[index]; | |
} | |
} | |
return elements; | |
} | |
jQuery.fn.extend({ | |
show: function show() { | |
return showHide(this, true); | |
}, | |
hide: function hide() { | |
return showHide(this); | |
}, | |
toggle: function toggle(state) { | |
if (typeof state === "boolean") { | |
return state ? this.show() : this.hide(); | |
} | |
return this.each(function () { | |
if (isHiddenWithinTree(this)) { | |
jQuery(this).show(); | |
} else { | |
jQuery(this).hide(); | |
} | |
}); | |
} | |
}); | |
var rcheckableType = /^(?:checkbox|radio)$/i; | |
var rtagName = /<([a-z][^\/\0>\x20\t\r\n\f]+)/i; | |
var rscriptType = /^$|\/(?:java|ecma)script/i; | |
// We have to close these tags to support XHTML (#13200) | |
var wrapMap = { | |
// Support: IE <=9 only | |
option: [1, "<select multiple='multiple'>", "</select>"], | |
// XHTML parsers do not magically insert elements in the | |
// same way that tag soup parsers do. So we cannot shorten | |
// this by omitting <tbody> or other required elements. | |
thead: [1, "<table>", "</table>"], | |
col: [2, "<table><colgroup>", "</colgroup></table>"], | |
tr: [2, "<table><tbody>", "</tbody></table>"], | |
td: [3, "<table><tbody><tr>", "</tr></tbody></table>"], | |
_default: [0, "", ""] | |
}; | |
// Support: IE <=9 only | |
wrapMap.optgroup = wrapMap.option; | |
wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead; | |
wrapMap.th = wrapMap.td; | |
function getAll(context, tag) { | |
// Support: IE <=9 - 11 only | |
// Use typeof to avoid zero-argument method invocation on host objects (#15151) | |
var ret; | |
if (typeof context.getElementsByTagName !== "undefined") { | |
ret = context.getElementsByTagName(tag || "*"); | |
} else if (typeof context.querySelectorAll !== "undefined") { | |
ret = context.querySelectorAll(tag || "*"); | |
} else { | |
ret = []; | |
} | |
if (tag === undefined || tag && nodeName(context, tag)) { | |
return jQuery.merge([context], ret); | |
} | |
return ret; | |
} | |
// Mark scripts as having already been evaluated | |
function setGlobalEval(elems, refElements) { | |
var i = 0, | |
l = elems.length; | |
for (; i < l; i++) { | |
dataPriv.set(elems[i], "globalEval", !refElements || dataPriv.get(refElements[i], "globalEval")); | |
} | |
} | |
var rhtml = /<|&#?\w+;/; | |
function buildFragment(elems, context, scripts, selection, ignored) { | |
var elem, | |
tmp, | |
tag, | |
wrap, | |
contains, | |
j, | |
fragment = context.createDocumentFragment(), | |
nodes = [], | |
i = 0, | |
l = elems.length; | |
for (; i < l; i++) { | |
elem = elems[i]; | |
if (elem || elem === 0) { | |
// Add nodes directly | |
if (jQuery.type(elem) === "object") { | |
// Support: Android <=4.0 only, PhantomJS 1 only | |
// push.apply(_, arraylike) throws on ancient WebKit | |
jQuery.merge(nodes, elem.nodeType ? [elem] : elem); | |
// Convert non-html into a text node | |
} else if (!rhtml.test(elem)) { | |
nodes.push(context.createTextNode(elem)); | |
// Convert html into DOM nodes | |
} else { | |
tmp = tmp || fragment.appendChild(context.createElement("div")); | |
// Deserialize a standard representation | |
tag = (rtagName.exec(elem) || ["", ""])[1].toLowerCase(); | |
wrap = wrapMap[tag] || wrapMap._default; | |
tmp.innerHTML = wrap[1] + jQuery.htmlPrefilter(elem) + wrap[2]; | |
// Descend through wrappers to the right content | |
j = wrap[0]; | |
while (j--) { | |
tmp = tmp.lastChild; | |
} | |
// Support: Android <=4.0 only, PhantomJS 1 only | |
// push.apply(_, arraylike) throws on ancient WebKit | |
jQuery.merge(nodes, tmp.childNodes); | |
// Remember the top-level container | |
tmp = fragment.firstChild; | |
// Ensure the created nodes are orphaned (#12392) | |
tmp.textContent = ""; | |
} | |
} | |
} | |
// Remove wrapper from fragment | |
fragment.textContent = ""; | |
i = 0; | |
while (elem = nodes[i++]) { | |
// Skip elements already in the context collection (trac-4087) | |
if (selection && jQuery.inArray(elem, selection) > -1) { | |
if (ignored) { | |
ignored.push(elem); | |
} | |
continue; | |
} | |
contains = jQuery.contains(elem.ownerDocument, elem); | |
// Append to fragment | |
tmp = getAll(fragment.appendChild(elem), "script"); | |
// Preserve script evaluation history | |
if (contains) { | |
setGlobalEval(tmp); | |
} | |
// Capture executables | |
if (scripts) { | |
j = 0; | |
while (elem = tmp[j++]) { | |
if (rscriptType.test(elem.type || "")) { | |
scripts.push(elem); | |
} | |
} | |
} | |
} | |
return fragment; | |
} | |
(function () { | |
var fragment = document.createDocumentFragment(), | |
div = fragment.appendChild(document.createElement("div")), | |
input = document.createElement("input"); | |
// Support: Android 4.0 - 4.3 only | |
// Check state lost if the name is set (#11217) | |
// Support: Windows Web Apps (WWA) | |
// `name` and `type` must use .setAttribute for WWA (#14901) | |
input.setAttribute("type", "radio"); | |
input.setAttribute("checked", "checked"); | |
input.setAttribute("name", "t"); | |
div.appendChild(input); | |
// Support: Android <=4.1 only | |
// Older WebKit doesn't clone checked state correctly in fragments | |
support.checkClone = div.cloneNode(true).cloneNode(true).lastChild.checked; | |
// Support: IE <=11 only | |
// Make sure textarea (and checkbox) defaultValue is properly cloned | |
div.innerHTML = "<textarea>x</textarea>"; | |
support.noCloneChecked = !!div.cloneNode(true).lastChild.defaultValue; | |
})(); | |
var documentElement = document.documentElement; | |
var rkeyEvent = /^key/, | |
rmouseEvent = /^(?:mouse|pointer|contextmenu|drag|drop)|click/, | |
rtypenamespace = /^([^.]*)(?:\.(.+)|)/; | |
function returnTrue() { | |
return true; | |
} | |
function returnFalse() { | |
return false; | |
} | |
// Support: IE <=9 only | |
// See #13393 for more info | |
function safeActiveElement() { | |
try { | |
return document.activeElement; | |
} catch (err) {} | |
} | |
function _on(elem, types, selector, data, fn, one) { | |
var origFn, type; | |
// Types can be a map of types/handlers | |
if ((typeof types === "undefined" ? "undefined" : _typeof(types)) === "object") { | |
// ( types-Object, selector, data ) | |
if (typeof selector !== "string") { | |
// ( types-Object, data ) | |
data = data || selector; | |
selector = undefined; | |
} | |
for (type in types) { | |
_on(elem, type, selector, data, types[type], one); | |
} | |
return elem; | |
} | |
if (data == null && fn == null) { | |
// ( types, fn ) | |
fn = selector; | |
data = selector = undefined; | |
} else if (fn == null) { | |
if (typeof selector === "string") { | |
// ( types, selector, fn ) | |
fn = data; | |
data = undefined; | |
} else { | |
// ( types, data, fn ) | |
fn = data; | |
data = selector; | |
selector = undefined; | |
} | |
} | |
if (fn === false) { | |
fn = returnFalse; | |
} else if (!fn) { | |
return elem; | |
} | |
if (one === 1) { | |
origFn = fn; | |
fn = function fn(event) { | |
// Can use an empty set, since event contains the info | |
jQuery().off(event); | |
return origFn.apply(this, arguments); | |
}; | |
// Use same guid so caller can remove using origFn | |
fn.guid = origFn.guid || (origFn.guid = jQuery.guid++); | |
} | |
return elem.each(function () { | |
jQuery.event.add(this, types, fn, data, selector); | |
}); | |
} | |
/* | |
* Helper functions for managing events -- not part of the public interface. | |
* Props to Dean Edwards' addEvent library for many of the ideas. | |
*/ | |
jQuery.event = { | |
global: {}, | |
add: function add(elem, types, handler, data, selector) { | |
var handleObjIn, | |
eventHandle, | |
tmp, | |
events, | |
t, | |
handleObj, | |
special, | |
handlers, | |
type, | |
namespaces, | |
origType, | |
elemData = dataPriv.get(elem); | |
// Don't attach events to noData or text/comment nodes (but allow plain objects) | |
if (!elemData) { | |
return; | |
} | |
// Caller can pass in an object of custom data in lieu of the handler | |
if (handler.handler) { | |
handleObjIn = handler; | |
handler = handleObjIn.handler; | |
selector = handleObjIn.selector; | |
} | |
// Ensure that invalid selectors throw exceptions at attach time | |
// Evaluate against documentElement in case elem is a non-element node (e.g., document) | |
if (selector) { | |
jQuery.find.matchesSelector(documentElement, selector); | |
} | |
// Make sure that the handler has a unique ID, used to find/remove it later | |
if (!handler.guid) { | |
handler.guid = jQuery.guid++; | |
} | |
// Init the element's event structure and main handler, if this is the first | |
if (!(events = elemData.events)) { | |
events = elemData.events = {}; | |
} | |
if (!(eventHandle = elemData.handle)) { | |
eventHandle = elemData.handle = function (e) { | |
// Discard the second event of a jQuery.event.trigger() and | |
// when an event is called after a page has unloaded | |
return typeof jQuery !== "undefined" && jQuery.event.triggered !== e.type ? jQuery.event.dispatch.apply(elem, arguments) : undefined; | |
}; | |
} | |
// Handle multiple events separated by a space | |
types = (types || "").match(rnothtmlwhite) || [""]; | |
t = types.length; | |
while (t--) { | |
tmp = rtypenamespace.exec(types[t]) || []; | |
type = origType = tmp[1]; | |
namespaces = (tmp[2] || "").split(".").sort(); | |
// There *must* be a type, no attaching namespace-only handlers | |
if (!type) { | |
continue; | |
} | |
// If event changes its type, use the special event handlers for the changed type | |
special = jQuery.event.special[type] || {}; | |
// If selector defined, determine special event api type, otherwise given type | |
type = (selector ? special.delegateType : special.bindType) || type; | |
// Update special based on newly reset type | |
special = jQuery.event.special[type] || {}; | |
// handleObj is passed to all event handlers | |
handleObj = jQuery.extend({ | |
type: type, | |
origType: origType, | |
data: data, | |
handler: handler, | |
guid: handler.guid, | |
selector: selector, | |
needsContext: selector && jQuery.expr.match.needsContext.test(selector), | |
namespace: namespaces.join(".") | |
}, handleObjIn); | |
// Init the event handler queue if we're the first | |
if (!(handlers = events[type])) { | |
handlers = events[type] = []; | |
handlers.delegateCount = 0; | |
// Only use addEventListener if the special events handler returns false | |
if (!special.setup || special.setup.call(elem, data, namespaces, eventHandle) === false) { | |
if (elem.addEventListener) { | |
elem.addEventListener(type, eventHandle); | |
} | |
} | |
} | |
if (special.add) { | |
special.add.call(elem, handleObj); | |
if (!handleObj.handler.guid) { | |
handleObj.handler.guid = handler.guid; | |
} | |
} | |
// Add to the element's handler list, delegates in front | |
if (selector) { | |
handlers.splice(handlers.delegateCount++, 0, handleObj); | |
} else { | |
handlers.push(handleObj); | |
} | |
// Keep track of which events have ever been used, for event optimization | |
jQuery.event.global[type] = true; | |
} | |
}, | |
// Detach an event or set of events from an element | |
remove: function remove(elem, types, handler, selector, mappedTypes) { | |
var j, | |
origCount, | |
tmp, | |
events, | |
t, | |
handleObj, | |
special, | |
handlers, | |
type, | |
namespaces, | |
origType, | |
elemData = dataPriv.hasData(elem) && dataPriv.get(elem); | |
if (!elemData || !(events = elemData.events)) { | |
return; | |
} | |
// Once for each type.namespace in types; type may be omitted | |
types = (types || "").match(rnothtmlwhite) || [""]; | |
t = types.length; | |
while (t--) { | |
tmp = rtypenamespace.exec(types[t]) || []; | |
type = origType = tmp[1]; | |
namespaces = (tmp[2] || "").split(".").sort(); | |
// Unbind all events (on this namespace, if provided) for the element | |
if (!type) { | |
for (type in events) { | |
jQuery.event.remove(elem, type + types[t], handler, selector, true); | |
} | |
continue; | |
} | |
special = jQuery.event.special[type] || {}; | |
type = (selector ? special.delegateType : special.bindType) || type; | |
handlers = events[type] || []; | |
tmp = tmp[2] && new RegExp("(^|\\.)" + namespaces.join("\\.(?:.*\\.|)") + "(\\.|$)"); | |
// Remove matching events | |
origCount = j = handlers.length; | |
while (j--) { | |
handleObj = handlers[j]; | |
if ((mappedTypes || origType === handleObj.origType) && (!handler || handler.guid === handleObj.guid) && (!tmp || tmp.test(handleObj.namespace)) && (!selector || selector === handleObj.selector || selector === "**" && handleObj.selector)) { | |
handlers.splice(j, 1); | |
if (handleObj.selector) { | |
handlers.delegateCount--; | |
} | |
if (special.remove) { | |
special.remove.call(elem, handleObj); | |
} | |
} | |
} | |
// Remove generic event handler if we removed something and no more handlers exist | |
// (avoids potential for endless recursion during removal of special event handlers) | |
if (origCount && !handlers.length) { | |
if (!special.teardown || special.teardown.call(elem, namespaces, elemData.handle) === false) { | |
jQuery.removeEvent(elem, type, elemData.handle); | |
} | |
delete events[type]; | |
} | |
} | |
// Remove data and the expando if it's no longer used | |
if (jQuery.isEmptyObject(events)) { | |
dataPriv.remove(elem, "handle events"); | |
} | |
}, | |
dispatch: function dispatch(nativeEvent) { | |
// Make a writable jQuery.Event from the native event object | |
var event = jQuery.event.fix(nativeEvent); | |
var i, | |
j, | |
ret, | |
matched, | |
handleObj, | |
handlerQueue, | |
args = new Array(arguments.length), | |
handlers = (dataPriv.get(this, "events") || {})[event.type] || [], | |
special = jQuery.event.special[event.type] || {}; | |
// Use the fix-ed jQuery.Event rather than the (read-only) native event | |
args[0] = event; | |
for (i = 1; i < arguments.length; i++) { | |
args[i] = arguments[i]; | |
} | |
event.delegateTarget = this; | |
// Call the preDispatch hook for the mapped type, and let it bail if desired | |
if (special.preDispatch && special.preDispatch.call(this, event) === false) { | |
return; | |
} | |
// Determine handlers | |
handlerQueue = jQuery.event.handlers.call(this, event, handlers); | |
// Run delegates first; they may want to stop propagation beneath us | |
i = 0; | |
while ((matched = handlerQueue[i++]) && !event.isPropagationStopped()) { | |
event.currentTarget = matched.elem; | |
j = 0; | |
while ((handleObj = matched.handlers[j++]) && !event.isImmediatePropagationStopped()) { | |
// Triggered event must either 1) have no namespace, or 2) have namespace(s) | |
// a subset or equal to those in the bound event (both can have no namespace). | |
if (!event.rnamespace || event.rnamespace.test(handleObj.namespace)) { | |
event.handleObj = handleObj; | |
event.data = handleObj.data; | |
ret = ((jQuery.event.special[handleObj.origType] || {}).handle || handleObj.handler).apply(matched.elem, args); | |
if (ret !== undefined) { | |
if ((event.result = ret) === false) { | |
event.preventDefault(); | |
event.stopPropagation(); | |
} | |
} | |
} | |
} | |
} | |
// Call the postDispatch hook for the mapped type | |
if (special.postDispatch) { | |
special.postDispatch.call(this, event); | |
} | |
return event.result; | |
}, | |
handlers: function handlers(event, _handlers) { | |
var i, | |
handleObj, | |
sel, | |
matchedHandlers, | |
matchedSelectors, | |
handlerQueue = [], | |
delegateCount = _handlers.delegateCount, | |
cur = event.target; | |
// Find delegate handlers | |
if (delegateCount && | |
// Support: IE <=9 | |
// Black-hole SVG <use> instance trees (trac-13180) | |
cur.nodeType && | |
// Support: Firefox <=42 | |
// Suppress spec-violating clicks indicating a non-primary pointer button (trac-3861) | |
// https://www.w3.org/TR/DOM-Level-3-Events/#event-type-click | |
// Support: IE 11 only | |
// ...but not arrow key "clicks" of radio inputs, which can have `button` -1 (gh-2343) | |
!(event.type === "click" && event.button >= 1)) { | |
for (; cur !== this; cur = cur.parentNode || this) { | |
// Don't check non-elements (#13208) | |
// Don't process clicks on disabled elements (#6911, #8165, #11382, #11764) | |
if (cur.nodeType === 1 && !(event.type === "click" && cur.disabled === true)) { | |
matchedHandlers = []; | |
matchedSelectors = {}; | |
for (i = 0; i < delegateCount; i++) { | |
handleObj = _handlers[i]; | |
// Don't conflict with Object.prototype properties (#13203) | |
sel = handleObj.selector + " "; | |
if (matchedSelectors[sel] === undefined) { | |
matchedSelectors[sel] = handleObj.needsContext ? jQuery(sel, this).index(cur) > -1 : jQuery.find(sel, this, null, [cur]).length; | |
} | |
if (matchedSelectors[sel]) { | |
matchedHandlers.push(handleObj); | |
} | |
} | |
if (matchedHandlers.length) { | |
handlerQueue.push({ elem: cur, handlers: matchedHandlers }); | |
} | |
} | |
} | |
} | |
// Add the remaining (directly-bound) handlers | |
cur = this; | |
if (delegateCount < _handlers.length) { | |
handlerQueue.push({ elem: cur, handlers: _handlers.slice(delegateCount) }); | |
} | |
return handlerQueue; | |
}, | |
addProp: function addProp(name, hook) { | |
Object.defineProperty(jQuery.Event.prototype, name, { | |
enumerable: true, | |
configurable: true, | |
get: jQuery.isFunction(hook) ? function () { | |
if (this.originalEvent) { | |
return hook(this.originalEvent); | |
} | |
} : function () { | |
if (this.originalEvent) { | |
return this.originalEvent[name]; | |
} | |
}, | |
set: function set(value) { | |
Object.defineProperty(this, name, { | |
enumerable: true, | |
configurable: true, | |
writable: true, | |
value: value | |
}); | |
} | |
}); | |
}, | |
fix: function fix(originalEvent) { | |
return originalEvent[jQuery.expando] ? originalEvent : new jQuery.Event(originalEvent); | |
}, | |
special: { | |
load: { | |
// Prevent triggered image.load events from bubbling to window.load | |
noBubble: true | |
}, | |
focus: { | |
// Fire native event if possible so blur/focus sequence is correct | |
trigger: function trigger() { | |
if (this !== safeActiveElement() && this.focus) { | |
this.focus(); | |
return false; | |
} | |
}, | |
delegateType: "focusin" | |
}, | |
blur: { | |
trigger: function trigger() { | |
if (this === safeActiveElement() && this.blur) { | |
this.blur(); | |
return false; | |
} | |
}, | |
delegateType: "focusout" | |
}, | |
click: { | |
// For checkbox, fire native event so checked state will be right | |
trigger: function trigger() { | |
if (this.type === "checkbox" && this.click && nodeName(this, "input")) { | |
this.click(); | |
return false; | |
} | |
}, | |
// For cross-browser consistency, don't fire native .click() on links | |
_default: function _default(event) { | |
return nodeName(event.target, "a"); | |
} | |
}, | |
beforeunload: { | |
postDispatch: function postDispatch(event) { | |
// Support: Firefox 20+ | |
// Firefox doesn't alert if the returnValue field is not set. | |
if (event.result !== undefined && event.originalEvent) { | |
event.originalEvent.returnValue = event.result; | |
} | |
} | |
} | |
} | |
}; | |
jQuery.removeEvent = function (elem, type, handle) { | |
// This "if" is needed for plain objects | |
if (elem.removeEventListener) { | |
elem.removeEventListener(type, handle); | |
} | |
}; | |
jQuery.Event = function (src, props) { | |
// Allow instantiation without the 'new' keyword | |
if (!(this instanceof jQuery.Event)) { | |
return new jQuery.Event(src, props); | |
} | |
// Event object | |
if (src && src.type) { | |
this.originalEvent = src; | |
this.type = src.type; | |
// Events bubbling up the document may have been marked as prevented | |
// by a handler lower down the tree; reflect the correct value. | |
this.isDefaultPrevented = src.defaultPrevented || src.defaultPrevented === undefined && | |
// Support: Android <=2.3 only | |
src.returnValue === false ? returnTrue : returnFalse; | |
// Create target properties | |
// Support: Safari <=6 - 7 only | |
// Target should not be a text node (#504, #13143) | |
this.target = src.target && src.target.nodeType === 3 ? src.target.parentNode : src.target; | |
this.currentTarget = src.currentTarget; | |
this.relatedTarget = src.relatedTarget; | |
// Event type | |
} else { | |
this.type = src; | |
} | |
// Put explicitly provided properties onto the event object | |
if (props) { | |
jQuery.extend(this, props); | |
} | |
// Create a timestamp if incoming event doesn't have one | |
this.timeStamp = src && src.timeStamp || jQuery.now(); | |
// Mark it as fixed | |
this[jQuery.expando] = true; | |
}; | |
// jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding | |
// https://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html | |
jQuery.Event.prototype = { | |
constructor: jQuery.Event, | |
isDefaultPrevented: returnFalse, | |
isPropagationStopped: returnFalse, | |
isImmediatePropagationStopped: returnFalse, | |
isSimulated: false, | |
preventDefault: function preventDefault() { | |
var e = this.originalEvent; | |
this.isDefaultPrevented = returnTrue; | |
if (e && !this.isSimulated) { | |
e.preventDefault(); | |
} | |
}, | |
stopPropagation: function stopPropagation() { | |
var e = this.originalEvent; | |
this.isPropagationStopped = returnTrue; | |
if (e && !this.isSimulated) { | |
e.stopPropagation(); | |
} | |
}, | |
stopImmediatePropagation: function stopImmediatePropagation() { | |
var e = this.originalEvent; | |
this.isImmediatePropagationStopped = returnTrue; | |
if (e && !this.isSimulated) { | |
e.stopImmediatePropagation(); | |
} | |
this.stopPropagation(); | |
} | |
}; | |
// Includes all common event props including KeyEvent and MouseEvent specific props | |
jQuery.each({ | |
altKey: true, | |
bubbles: true, | |
cancelable: true, | |
changedTouches: true, | |
ctrlKey: true, | |
detail: true, | |
eventPhase: true, | |
metaKey: true, | |
pageX: true, | |
pageY: true, | |
shiftKey: true, | |
view: true, | |
"char": true, | |
charCode: true, | |
key: true, | |
keyCode: true, | |
button: true, | |
buttons: true, | |
clientX: true, | |
clientY: true, | |
offsetX: true, | |
offsetY: true, | |
pointerId: true, | |
pointerType: true, | |
screenX: true, | |
screenY: true, | |
targetTouches: true, | |
toElement: true, | |
touches: true, | |
which: function which(event) { | |
var button = event.button; | |
// Add which for key events | |
if (event.which == null && rkeyEvent.test(event.type)) { | |
return event.charCode != null ? event.charCode : event.keyCode; | |
} | |
// Add which for click: 1 === left; 2 === middle; 3 === right | |
if (!event.which && button !== undefined && rmouseEvent.test(event.type)) { | |
if (button & 1) { | |
return 1; | |
} | |
if (button & 2) { | |
return 3; | |
} | |
if (button & 4) { | |
return 2; | |
} | |
return 0; | |
} | |
return event.which; | |
} | |
}, jQuery.event.addProp); | |
// Create mouseenter/leave events using mouseover/out and event-time checks | |
// so that event delegation works in jQuery. | |
// Do the same for pointerenter/pointerleave and pointerover/pointerout | |
// | |
// Support: Safari 7 only | |
// Safari sends mouseenter too often; see: | |
// https://bugs.chromium.org/p/chromium/issues/detail?id=470258 | |
// for the description of the bug (it existed in older Chrome versions as well). | |
jQuery.each({ | |
mouseenter: "mouseover", | |
mouseleave: "mouseout", | |
pointerenter: "pointerover", | |
pointerleave: "pointerout" | |
}, function (orig, fix) { | |
jQuery.event.special[orig] = { | |
delegateType: fix, | |
bindType: fix, | |
handle: function handle(event) { | |
var ret, | |
target = this, | |
related = event.relatedTarget, | |
handleObj = event.handleObj; | |
// For mouseenter/leave call the handler if related is outside the target. | |
// NB: No relatedTarget if the mouse left/entered the browser window | |
if (!related || related !== target && !jQuery.contains(target, related)) { | |
event.type = handleObj.origType; | |
ret = handleObj.handler.apply(this, arguments); | |
event.type = fix; | |
} | |
return ret; | |
} | |
}; | |
}); | |
jQuery.fn.extend({ | |
on: function on(types, selector, data, fn) { | |
return _on(this, types, selector, data, fn); | |
}, | |
one: function one(types, selector, data, fn) { | |
return _on(this, types, selector, data, fn, 1); | |
}, | |
off: function off(types, selector, fn) { | |
var handleObj, type; | |
if (types && types.preventDefault && types.handleObj) { | |
// ( event ) dispatched jQuery.Event | |
handleObj = types.handleObj; | |
jQuery(types.delegateTarget).off(handleObj.namespace ? handleObj.origType + "." + handleObj.namespace : handleObj.origType, handleObj.selector, handleObj.handler); | |
return this; | |
} | |
if ((typeof types === "undefined" ? "undefined" : _typeof(types)) === "object") { | |
// ( types-object [, selector] ) | |
for (type in types) { | |
this.off(type, selector, types[type]); | |
} | |
return this; | |
} | |
if (selector === false || typeof selector === "function") { | |
// ( types [, fn] ) | |
fn = selector; | |
selector = undefined; | |
} | |
if (fn === false) { | |
fn = returnFalse; | |
} | |
return this.each(function () { | |
jQuery.event.remove(this, types, fn, selector); | |
}); | |
} | |
}); | |
var | |
/* eslint-disable max-len */ | |
// See https://github.com/eslint/eslint/issues/3229 | |
rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([a-z][^\/\0>\x20\t\r\n\f]*)[^>]*)\/>/gi, | |
/* eslint-enable */ | |
// Support: IE <=10 - 11, Edge 12 - 13 | |
// In IE/Edge using regex groups here causes severe slowdowns. | |
// See https://connect.microsoft.com/IE/feedback/details/1736512/ | |
rnoInnerhtml = /<script|<style|<link/i, | |
// checked="checked" or checked | |
rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i, | |
rscriptTypeMasked = /^true\/(.*)/, | |
rcleanScript = /^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g; | |
// Prefer a tbody over its parent table for containing new rows | |
function manipulationTarget(elem, content) { | |
if (nodeName(elem, "table") && nodeName(content.nodeType !== 11 ? content : content.firstChild, "tr")) { | |
return jQuery(">tbody", elem)[0] || elem; | |
} | |
return elem; | |
} | |
// Replace/restore the type attribute of script elements for safe DOM manipulation | |
function disableScript(elem) { | |
elem.type = (elem.getAttribute("type") !== null) + "/" + elem.type; | |
return elem; | |
} | |
function restoreScript(elem) { | |
var match = rscriptTypeMasked.exec(elem.type); | |
if (match) { | |
elem.type = match[1]; | |
} else { | |
elem.removeAttribute("type"); | |
} | |
return elem; | |
} | |
function cloneCopyEvent(src, dest) { | |
var i, l, type, pdataOld, pdataCur, udataOld, udataCur, events; | |
if (dest.nodeType !== 1) { | |
return; | |
} | |
// 1. Copy private data: events, handlers, etc. | |
if (dataPriv.hasData(src)) { | |
pdataOld = dataPriv.access(src); | |
pdataCur = dataPriv.set(dest, pdataOld); | |
events = pdataOld.events; | |
if (events) { | |
delete pdataCur.handle; | |
pdataCur.events = {}; | |
for (type in events) { | |
for (i = 0, l = events[type].length; i < l; i++) { | |
jQuery.event.add(dest, type, events[type][i]); | |
} | |
} | |
} | |
} | |
// 2. Copy user data | |
if (dataUser.hasData(src)) { | |
udataOld = dataUser.access(src); | |
udataCur = jQuery.extend({}, udataOld); | |
dataUser.set(dest, udataCur); | |
} | |
} | |
// Fix IE bugs, see support tests | |
function fixInput(src, dest) { | |
var nodeName = dest.nodeName.toLowerCase(); | |
// Fails to persist the checked state of a cloned checkbox or radio button. | |
if (nodeName === "input" && rcheckableType.test(src.type)) { | |
dest.checked = src.checked; | |
// Fails to return the selected option to the default selected state when cloning options | |
} else if (nodeName === "input" || nodeName === "textarea") { | |
dest.defaultValue = src.defaultValue; | |
} | |
} | |
function domManip(collection, args, callback, ignored) { | |
// Flatten any nested arrays | |
args = concat.apply([], args); | |
var fragment, | |
first, | |
scripts, | |
hasScripts, | |
node, | |
doc, | |
i = 0, | |
l = collection.length, | |
iNoClone = l - 1, | |
value = args[0], | |
isFunction = jQuery.isFunction(value); | |
// We can't cloneNode fragments that contain checked, in WebKit | |
if (isFunction || l > 1 && typeof value === "string" && !support.checkClone && rchecked.test(value)) { | |
return collection.each(function (index) { | |
var self = collection.eq(index); | |
if (isFunction) { | |
args[0] = value.call(this, index, self.html()); | |
} | |
domManip(self, args, callback, ignored); | |
}); | |
} | |
if (l) { | |
fragment = buildFragment(args, collection[0].ownerDocument, false, collection, ignored); | |
first = fragment.firstChild; | |
if (fragment.childNodes.length === 1) { | |
fragment = first; | |
} | |
// Require either new content or an interest in ignored elements to invoke the callback | |
if (first || ignored) { | |
scripts = jQuery.map(getAll(fragment, "script"), disableScript); | |
hasScripts = scripts.length; | |
// Use the original fragment for the last item | |
// instead of the first because it can end up | |
// being emptied incorrectly in certain situations (#8070). | |
for (; i < l; i++) { | |
node = fragment; | |
if (i !== iNoClone) { | |
node = jQuery.clone(node, true, true); | |
// Keep references to cloned scripts for later restoration | |
if (hasScripts) { | |
// Support: Android <=4.0 only, PhantomJS 1 only | |
// push.apply(_, arraylike) throws on ancient WebKit | |
jQuery.merge(scripts, getAll(node, "script")); | |
} | |
} | |
callback.call(collection[i], node, i); | |
} | |
if (hasScripts) { | |
doc = scripts[scripts.length - 1].ownerDocument; | |
// Reenable scripts | |
jQuery.map(scripts, restoreScript); | |
// Evaluate executable scripts on first document insertion | |
for (i = 0; i < hasScripts; i++) { | |
node = scripts[i]; | |
if (rscriptType.test(node.type || "") && !dataPriv.access(node, "globalEval") && jQuery.contains(doc, node)) { | |
if (node.src) { | |
// Optional AJAX dependency, but won't run scripts if not present | |
if (jQuery._evalUrl) { | |
jQuery._evalUrl(node.src); | |
} | |
} else { | |
DOMEval(node.textContent.replace(rcleanScript, ""), doc); | |
} | |
} | |
} | |
} | |
} | |
} | |
return collection; | |
} | |
function _remove(elem, selector, keepData) { | |
var node, | |
nodes = selector ? jQuery.filter(selector, elem) : elem, | |
i = 0; | |
for (; (node = nodes[i]) != null; i++) { | |
if (!keepData && node.nodeType === 1) { | |
jQuery.cleanData(getAll(node)); | |
} | |
if (node.parentNode) { | |
if (keepData && jQuery.contains(node.ownerDocument, node)) { | |
setGlobalEval(getAll(node, "script")); | |
} | |
node.parentNode.removeChild(node); | |
} | |
} | |
return elem; | |
} | |
jQuery.extend({ | |
htmlPrefilter: function htmlPrefilter(html) { | |
return html.replace(rxhtmlTag, "<$1></$2>"); | |
}, | |
clone: function clone(elem, dataAndEvents, deepDataAndEvents) { | |
var i, | |
l, | |
srcElements, | |
destElements, | |
clone = elem.cloneNode(true), | |
inPage = jQuery.contains(elem.ownerDocument, elem); | |
// Fix IE cloning issues | |
if (!support.noCloneChecked && (elem.nodeType === 1 || elem.nodeType === 11) && !jQuery.isXMLDoc(elem)) { | |
// We eschew Sizzle here for performance reasons: https://jsperf.com/getall-vs-sizzle/2 | |
destElements = getAll(clone); | |
srcElements = getAll(elem); | |
for (i = 0, l = srcElements.length; i < l; i++) { | |
fixInput(srcElements[i], destElements[i]); | |
} | |
} | |
// Copy the events from the original to the clone | |
if (dataAndEvents) { | |
if (deepDataAndEvents) { | |
srcElements = srcElements || getAll(elem); | |
destElements = destElements || getAll(clone); | |
for (i = 0, l = srcElements.length; i < l; i++) { | |
cloneCopyEvent(srcElements[i], destElements[i]); | |
} | |
} else { | |
cloneCopyEvent(elem, clone); | |
} | |
} | |
// Preserve script evaluation history | |
destElements = getAll(clone, "script"); | |
if (destElements.length > 0) { | |
setGlobalEval(destElements, !inPage && getAll(elem, "script")); | |
} | |
// Return the cloned set | |
return clone; | |
}, | |
cleanData: function cleanData(elems) { | |
var data, | |
elem, | |
type, | |
special = jQuery.event.special, | |
i = 0; | |
for (; (elem = elems[i]) !== undefined; i++) { | |
if (acceptData(elem)) { | |
if (data = elem[dataPriv.expando]) { | |
if (data.events) { | |
for (type in data.events) { | |
if (special[type]) { | |
jQuery.event.remove(elem, type); | |
// This is a shortcut to avoid jQuery.event.remove's overhead | |
} else { | |
jQuery.removeEvent(elem, type, data.handle); | |
} | |
} | |
} | |
// Support: Chrome <=35 - 45+ | |
// Assign undefined instead of using delete, see Data#remove | |
elem[dataPriv.expando] = undefined; | |
} | |
if (elem[dataUser.expando]) { | |
// Support: Chrome <=35 - 45+ | |
// Assign undefined instead of using delete, see Data#remove | |
elem[dataUser.expando] = undefined; | |
} | |
} | |
} | |
} | |
}); | |
jQuery.fn.extend({ | |
detach: function detach(selector) { | |
return _remove(this, selector, true); | |
}, | |
remove: function remove(selector) { | |
return _remove(this, selector); | |
}, | |
text: function text(value) { | |
return access(this, function (value) { | |
return value === undefined ? jQuery.text(this) : this.empty().each(function () { | |
if (this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9) { | |
this.textContent = value; | |
} | |
}); | |
}, null, value, arguments.length); | |
}, | |
append: function append() { | |
return domManip(this, arguments, function (elem) { | |
if (this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9) { | |
var target = manipulationTarget(this, elem); | |
target.appendChild(elem); | |
} | |
}); | |
}, | |
prepend: function prepend() { | |
return domManip(this, arguments, function (elem) { | |
if (this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9) { | |
var target = manipulationTarget(this, elem); | |
target.insertBefore(elem, target.firstChild); | |
} | |
}); | |
}, | |
before: function before() { | |
return domManip(this, arguments, function (elem) { | |
if (this.parentNode) { | |
this.parentNode.insertBefore(elem, this); | |
} | |
}); | |
}, | |
after: function after() { | |
return domManip(this, arguments, function (elem) { | |
if (this.parentNode) { | |
this.parentNode.insertBefore(elem, this.nextSibling); | |
} | |
}); | |
}, | |
empty: function empty() { | |
var elem, | |
i = 0; | |
for (; (elem = this[i]) != null; i++) { | |
if (elem.nodeType === 1) { | |
// Prevent memory leaks | |
jQuery.cleanData(getAll(elem, false)); | |
// Remove any remaining nodes | |
elem.textContent = ""; | |
} | |
} | |
return this; | |
}, | |
clone: function clone(dataAndEvents, deepDataAndEvents) { | |
dataAndEvents = dataAndEvents == null ? false : dataAndEvents; | |
deepDataAndEvents = deepDataAndEvents == null ? dataAndEvents : deepDataAndEvents; | |
return this.map(function () { | |
return jQuery.clone(this, dataAndEvents, deepDataAndEvents); | |
}); | |
}, | |
html: function html(value) { | |
return access(this, function (value) { | |
var elem = this[0] || {}, | |
i = 0, | |
l = this.length; | |
if (value === undefined && elem.nodeType === 1) { | |
return elem.innerHTML; | |
} | |
// See if we can take a shortcut and just use innerHTML | |
if (typeof value === "string" && !rnoInnerhtml.test(value) && !wrapMap[(rtagName.exec(value) || ["", ""])[1].toLowerCase()]) { | |
value = jQuery.htmlPrefilter(value); | |
try { | |
for (; i < l; i++) { | |
elem = this[i] || {}; | |
// Remove element nodes and prevent memory leaks | |
if (elem.nodeType === 1) { | |
jQuery.cleanData(getAll(elem, false)); | |
elem.innerHTML = value; | |
} | |
} | |
elem = 0; | |
// If using innerHTML throws an exception, use the fallback method | |
} catch (e) {} | |
} | |
if (elem) { | |
this.empty().append(value); | |
} | |
}, null, value, arguments.length); | |
}, | |
replaceWith: function replaceWith() { | |
var ignored = []; | |
// Make the changes, replacing each non-ignored context element with the new content | |
return domManip(this, arguments, function (elem) { | |
var parent = this.parentNode; | |
if (jQuery.inArray(this, ignored) < 0) { | |
jQuery.cleanData(getAll(this)); | |
if (parent) { | |
parent.replaceChild(elem, this); | |
} | |
} | |
// Force callback invocation | |
}, ignored); | |
} | |
}); | |
jQuery.each({ | |
appendTo: "append", | |
prependTo: "prepend", | |
insertBefore: "before", | |
insertAfter: "after", | |
replaceAll: "replaceWith" | |
}, function (name, original) { | |
jQuery.fn[name] = function (selector) { | |
var elems, | |
ret = [], | |
insert = jQuery(selector), | |
last = insert.length - 1, | |
i = 0; | |
for (; i <= last; i++) { | |
elems = i === last ? this : this.clone(true); | |
jQuery(insert[i])[original](elems); | |
// Support: Android <=4.0 only, PhantomJS 1 only | |
// .get() because push.apply(_, arraylike) throws on ancient WebKit | |
push.apply(ret, elems.get()); | |
} | |
return this.pushStack(ret); | |
}; | |
}); | |
var rmargin = /^margin/; | |
var rnumnonpx = new RegExp("^(" + pnum + ")(?!px)[a-z%]+$", "i"); | |
var getStyles = function getStyles(elem) { | |
// Support: IE <=11 only, Firefox <=30 (#15098, #14150) | |
// IE throws on elements created in popups | |
// FF meanwhile throws on frame elements through "defaultView.getComputedStyle" | |
var view = elem.ownerDocument.defaultView; | |
if (!view || !view.opener) { | |
view = window; | |
} | |
return view.getComputedStyle(elem); | |
}; | |
(function () { | |
// Executing both pixelPosition & boxSizingReliable tests require only one layout | |
// so they're executed at the same time to save the second computation. | |
function computeStyleTests() { | |
// This is a singleton, we need to execute it only once | |
if (!div) { | |
return; | |
} | |
div.style.cssText = "box-sizing:border-box;" + "position:relative;display:block;" + "margin:auto;border:1px;padding:1px;" + "top:1%;width:50%"; | |
div.innerHTML = ""; | |
documentElement.appendChild(container); | |
var divStyle = window.getComputedStyle(div); | |
pixelPositionVal = divStyle.top !== "1%"; | |
// Support: Android 4.0 - 4.3 only, Firefox <=3 - 44 | |
reliableMarginLeftVal = divStyle.marginLeft === "2px"; | |
boxSizingReliableVal = divStyle.width === "4px"; | |
// Support: Android 4.0 - 4.3 only | |
// Some styles come back with percentage values, even though they shouldn't | |
div.style.marginRight = "50%"; | |
pixelMarginRightVal = divStyle.marginRight === "4px"; | |
documentElement.removeChild(container); | |
// Nullify the div so it wouldn't be stored in the memory and | |
// it will also be a sign that checks already performed | |
div = null; | |
} | |
var pixelPositionVal, | |
boxSizingReliableVal, | |
pixelMarginRightVal, | |
reliableMarginLeftVal, | |
container = document.createElement("div"), | |
div = document.createElement("div"); | |
// Finish early in limited (non-browser) environments | |
if (!div.style) { | |
return; | |
} | |
// Support: IE <=9 - 11 only | |
// Style of cloned element affects source element cloned (#8908) | |
div.style.backgroundClip = "content-box"; | |
div.cloneNode(true).style.backgroundClip = ""; | |
support.clearCloneStyle = div.style.backgroundClip === "content-box"; | |
container.style.cssText = "border:0;width:8px;height:0;top:0;left:-9999px;" + "padding:0;margin-top:1px;position:absolute"; | |
container.appendChild(div); | |
jQuery.extend(support, { | |
pixelPosition: function pixelPosition() { | |
computeStyleTests(); | |
return pixelPositionVal; | |
}, | |
boxSizingReliable: function boxSizingReliable() { | |
computeStyleTests(); | |
return boxSizingReliableVal; | |
}, | |
pixelMarginRight: function pixelMarginRight() { | |
computeStyleTests(); | |
return pixelMarginRightVal; | |
}, | |
reliableMarginLeft: function reliableMarginLeft() { | |
computeStyleTests(); | |
return reliableMarginLeftVal; | |
} | |
}); | |
})(); | |
function curCSS(elem, name, computed) { | |
var width, | |
minWidth, | |
maxWidth, | |
ret, | |
// Support: Firefox 51+ | |
// Retrieving style before computed somehow | |
// fixes an issue with getting wrong values | |
// on detached elements | |
style = elem.style; | |
computed = computed || getStyles(elem); | |
// getPropertyValue is needed for: | |
// .css('filter') (IE 9 only, #12537) | |
// .css('--customProperty) (#3144) | |
if (computed) { | |
ret = computed.getPropertyValue(name) || computed[name]; | |
if (ret === "" && !jQuery.contains(elem.ownerDocument, elem)) { | |
ret = jQuery.style(elem, name); | |
} | |
// A tribute to the "awesome hack by Dean Edwards" | |
// Android Browser returns percentage for some values, | |
// but width seems to be reliably pixels. | |
// This is against the CSSOM draft spec: | |
// https://drafts.csswg.org/cssom/#resolved-values | |
if (!support.pixelMarginRight() && rnumnonpx.test(ret) && rmargin.test(name)) { | |
// Remember the original values | |
width = style.width; | |
minWidth = style.minWidth; | |
maxWidth = style.maxWidth; | |
// Put in the new values to get a computed value out | |
style.minWidth = style.maxWidth = style.width = ret; | |
ret = computed.width; | |
// Revert the changed values | |
style.width = width; | |
style.minWidth = minWidth; | |
style.maxWidth = maxWidth; | |
} | |
} | |
return ret !== undefined ? | |
// Support: IE <=9 - 11 only | |
// IE returns zIndex value as an integer. | |
ret + "" : ret; | |
} | |
function addGetHookIf(conditionFn, hookFn) { | |
// Define the hook, we'll check on the first run if it's really needed. | |
return { | |
get: function get() { | |
if (conditionFn()) { | |
// Hook not needed (or it's not possible to use it due | |
// to missing dependency), remove it. | |
delete this.get; | |
return; | |
} | |
// Hook needed; redefine it so that the support test is not executed again. | |
return (this.get = hookFn).apply(this, arguments); | |
} | |
}; | |
} | |
var | |
// Swappable if display is none or starts with table | |
// except "table", "table-cell", or "table-caption" | |
// See here for display values: https://developer.mozilla.org/en-US/docs/CSS/display | |
rdisplayswap = /^(none|table(?!-c[ea]).+)/, | |
rcustomProp = /^--/, | |
cssShow = { position: "absolute", visibility: "hidden", display: "block" }, | |
cssNormalTransform = { | |
letterSpacing: "0", | |
fontWeight: "400" | |
}, | |
cssPrefixes = ["Webkit", "Moz", "ms"], | |
emptyStyle = document.createElement("div").style; | |
// Return a css property mapped to a potentially vendor prefixed property | |
function vendorPropName(name) { | |
// Shortcut for names that are not vendor prefixed | |
if (name in emptyStyle) { | |
return name; | |
} | |
// Check for vendor prefixed names | |
var capName = name[0].toUpperCase() + name.slice(1), | |
i = cssPrefixes.length; | |
while (i--) { | |
name = cssPrefixes[i] + capName; | |
if (name in emptyStyle) { | |
return name; | |
} | |
} | |
} | |
// Return a property mapped along what jQuery.cssProps suggests or to | |
// a vendor prefixed property. | |
function finalPropName(name) { | |
var ret = jQuery.cssProps[name]; | |
if (!ret) { | |
ret = jQuery.cssProps[name] = vendorPropName(name) || name; | |
} | |
return ret; | |
} | |
function setPositiveNumber(elem, value, subtract) { | |
// Any relative (+/-) values have already been | |
// normalized at this point | |
var matches = rcssNum.exec(value); | |
return matches ? | |
// Guard against undefined "subtract", e.g., when used as in cssHooks | |
Math.max(0, matches[2] - (subtract || 0)) + (matches[3] || "px") : value; | |
} | |
function augmentWidthOrHeight(elem, name, extra, isBorderBox, styles) { | |
var i, | |
val = 0; | |
// If we already have the right measurement, avoid augmentation | |
if (extra === (isBorderBox ? "border" : "content")) { | |
i = 4; | |
// Otherwise initialize for horizontal or vertical properties | |
} else { | |
i = name === "width" ? 1 : 0; | |
} | |
for (; i < 4; i += 2) { | |
// Both box models exclude margin, so add it if we want it | |
if (extra === "margin") { | |
val += jQuery.css(elem, extra + cssExpand[i], true, styles); | |
} | |
if (isBorderBox) { | |
// border-box includes padding, so remove it if we want content | |
if (extra === "content") { | |
val -= jQuery.css(elem, "padding" + cssExpand[i], true, styles); | |
} | |
// At this point, extra isn't border nor margin, so remove border | |
if (extra !== "margin") { | |
val -= jQuery.css(elem, "border" + cssExpand[i] + "Width", true, styles); | |
} | |
} else { | |
// At this point, extra isn't content, so add padding | |
val += jQuery.css(elem, "padding" + cssExpand[i], true, styles); | |
// At this point, extra isn't content nor padding, so add border | |
if (extra !== "padding") { | |
val += jQuery.css(elem, "border" + cssExpand[i] + "Width", true, styles); | |
} | |
} | |
} | |
return val; | |
} | |
function getWidthOrHeight(elem, name, extra) { | |
// Start with computed style | |
var valueIsBorderBox, | |
styles = getStyles(elem), | |
val = curCSS(elem, name, styles), | |
isBorderBox = jQuery.css(elem, "boxSizing", false, styles) === "border-box"; | |
// Computed unit is not pixels. Stop here and return. | |
if (rnumnonpx.test(val)) { | |
return val; | |
} | |
// Check for style in case a browser which returns unreliable values | |
// for getComputedStyle silently falls back to the reliable elem.style | |
valueIsBorderBox = isBorderBox && (support.boxSizingReliable() || val === elem.style[name]); | |
// Fall back to offsetWidth/Height when value is "auto" | |
// This happens for inline elements with no explicit setting (gh-3571) | |
if (val === "auto") { | |
val = elem["offset" + name[0].toUpperCase() + name.slice(1)]; | |
} | |
// Normalize "", auto, and prepare for extra | |
val = parseFloat(val) || 0; | |
// Use the active box-sizing model to add/subtract irrelevant styles | |
return val + augmentWidthOrHeight(elem, name, extra || (isBorderBox ? "border" : "content"), valueIsBorderBox, styles) + "px"; | |
} | |
jQuery.extend({ | |
// Add in style property hooks for overriding the default | |
// behavior of getting and setting a style property | |
cssHooks: { | |
opacity: { | |
get: function get(elem, computed) { | |
if (computed) { | |
// We should always get a number back from opacity | |
var ret = curCSS(elem, "opacity"); | |
return ret === "" ? "1" : ret; | |
} | |
} | |
} | |
}, | |
// Don't automatically add "px" to these possibly-unitless properties | |
cssNumber: { | |
"animationIterationCount": true, | |
"columnCount": true, | |
"fillOpacity": true, | |
"flexGrow": true, | |
"flexShrink": true, | |
"fontWeight": true, | |
"lineHeight": true, | |
"opacity": true, | |
"order": true, | |
"orphans": true, | |
"widows": true, | |
"zIndex": true, | |
"zoom": true | |
}, | |
// Add in properties whose names you wish to fix before | |
// setting or getting the value | |
cssProps: { | |
"float": "cssFloat" | |
}, | |
// Get and set the style property on a DOM Node | |
style: function style(elem, name, value, extra) { | |
// Don't set styles on text and comment nodes | |
if (!elem || elem.nodeType === 3 || elem.nodeType === 8 || !elem.style) { | |
return; | |
} | |
// Make sure that we're working with the right name | |
var ret, | |
type, | |
hooks, | |
origName = jQuery.camelCase(name), | |
isCustomProp = rcustomProp.test(name), | |
style = elem.style; | |
// Make sure that we're working with the right name. We don't | |
// want to query the value if it is a CSS custom property | |
// since they are user-defined. | |
if (!isCustomProp) { | |
name = finalPropName(origName); | |
} | |
// Gets hook for the prefixed version, then unprefixed version | |
hooks = jQuery.cssHooks[name] || jQuery.cssHooks[origName]; | |
// Check if we're setting a value | |
if (value !== undefined) { | |
type = typeof value === "undefined" ? "undefined" : _typeof(value); | |
// Convert "+=" or "-=" to relative numbers (#7345) | |
if (type === "string" && (ret = rcssNum.exec(value)) && ret[1]) { | |
value = adjustCSS(elem, name, ret); | |
// Fixes bug #9237 | |
type = "number"; | |
} | |
// Make sure that null and NaN values aren't set (#7116) | |
if (value == null || value !== value) { | |
return; | |
} | |
// If a number was passed in, add the unit (except for certain CSS properties) | |
if (type === "number") { | |
value += ret && ret[3] || (jQuery.cssNumber[origName] ? "" : "px"); | |
} | |
// background-* props affect original clone's values | |
if (!support.clearCloneStyle && value === "" && name.indexOf("background") === 0) { | |
style[name] = "inherit"; | |
} | |
// If a hook was provided, use that value, otherwise just set the specified value | |
if (!hooks || !("set" in hooks) || (value = hooks.set(elem, value, extra)) !== undefined) { | |
if (isCustomProp) { | |
style.setProperty(name, value); | |
} else { | |
style[name] = value; | |
} | |
} | |
} else { | |
// If a hook was provided get the non-computed value from there | |
if (hooks && "get" in hooks && (ret = hooks.get(elem, false, extra)) !== undefined) { | |
return ret; | |
} | |
// Otherwise just get the value from the style object | |
return style[name]; | |
} | |
}, | |
css: function css(elem, name, extra, styles) { | |
var val, | |
num, | |
hooks, | |
origName = jQuery.camelCase(name), | |
isCustomProp = rcustomProp.test(name); | |
// Make sure that we're working with the right name. We don't | |
// want to modify the value if it is a CSS custom property | |
// since they are user-defined. | |
if (!isCustomProp) { | |
name = finalPropName(origName); | |
} | |
// Try prefixed name followed by the unprefixed name | |
hooks = jQuery.cssHooks[name] || jQuery.cssHooks[origName]; | |
// If a hook was provided get the computed value from there | |
if (hooks && "get" in hooks) { | |
val = hooks.get(elem, true, extra); | |
} | |
// Otherwise, if a way to get the computed value exists, use that | |
if (val === undefined) { | |
val = curCSS(elem, name, styles); | |
} | |
// Convert "normal" to computed value | |
if (val === "normal" && name in cssNormalTransform) { | |
val = cssNormalTransform[name]; | |
} | |
// Make numeric if forced or a qualifier was provided and val looks numeric | |
if (extra === "" || extra) { | |
num = parseFloat(val); | |
return extra === true || isFinite(num) ? num || 0 : val; | |
} | |
return val; | |
} | |
}); | |
jQuery.each(["height", "width"], function (i, name) { | |
jQuery.cssHooks[name] = { | |
get: function get(elem, computed, extra) { | |
if (computed) { | |
// Certain elements can have dimension info if we invisibly show them | |
// but it must have a current display style that would benefit | |
return rdisplayswap.test(jQuery.css(elem, "display")) && ( | |
// Support: Safari 8+ | |
// Table columns in Safari have non-zero offsetWidth & zero | |
// getBoundingClientRect().width unless display is changed. | |
// Support: IE <=11 only | |
// Running getBoundingClientRect on a disconnected node | |
// in IE throws an error. | |
!elem.getClientRects().length || !elem.getBoundingClientRect().width) ? swap(elem, cssShow, function () { | |
return getWidthOrHeight(elem, name, extra); | |
}) : getWidthOrHeight(elem, name, extra); | |
} | |
}, | |
set: function set(elem, value, extra) { | |
var matches, | |
styles = extra && getStyles(elem), | |
subtract = extra && augmentWidthOrHeight(elem, name, extra, jQuery.css(elem, "boxSizing", false, styles) === "border-box", styles); | |
// Convert to pixels if value adjustment is needed | |
if (subtract && (matches = rcssNum.exec(value)) && (matches[3] || "px") !== "px") { | |
elem.style[name] = value; | |
value = jQuery.css(elem, name); | |
} | |
return setPositiveNumber(elem, value, subtract); | |
} | |
}; | |
}); | |
jQuery.cssHooks.marginLeft = addGetHookIf(support.reliableMarginLeft, function (elem, computed) { | |
if (computed) { | |
return (parseFloat(curCSS(elem, "marginLeft")) || elem.getBoundingClientRect().left - swap(elem, { marginLeft: 0 }, function () { | |
return elem.getBoundingClientRect().left; | |
})) + "px"; | |
} | |
}); | |
// These hooks are used by animate to expand properties | |
jQuery.each({ | |
margin: "", | |
padding: "", | |
border: "Width" | |
}, function (prefix, suffix) { | |
jQuery.cssHooks[prefix + suffix] = { | |
expand: function expand(value) { | |
var i = 0, | |
expanded = {}, | |
// Assumes a single number if not a string | |
parts = typeof value === "string" ? value.split(" ") : [value]; | |
for (; i < 4; i++) { | |
expanded[prefix + cssExpand[i] + suffix] = parts[i] || parts[i - 2] || parts[0]; | |
} | |
return expanded; | |
} | |
}; | |
if (!rmargin.test(prefix)) { | |
jQuery.cssHooks[prefix + suffix].set = setPositiveNumber; | |
} | |
}); | |
jQuery.fn.extend({ | |
css: function css(name, value) { | |
return access(this, function (elem, name, value) { | |
var styles, | |
len, | |
map = {}, | |
i = 0; | |
if (Array.isArray(name)) { | |
styles = getStyles(elem); | |
len = name.length; | |
for (; i < len; i++) { | |
map[name[i]] = jQuery.css(elem, name[i], false, styles); | |
} | |
return map; | |
} | |
return value !== undefined ? jQuery.style(elem, name, value) : jQuery.css(elem, name); | |
}, name, value, arguments.length > 1); | |
} | |
}); | |
function Tween(elem, options, prop, end, easing) { | |
return new Tween.prototype.init(elem, options, prop, end, easing); | |
} | |
jQuery.Tween = Tween; | |
Tween.prototype = { | |
constructor: Tween, | |
init: function init(elem, options, prop, end, easing, unit) { | |
this.elem = elem; | |
this.prop = prop; | |
this.easing = easing || jQuery.easing._default; | |
this.options = options; | |
this.start = this.now = this.cur(); | |
this.end = end; | |
this.unit = unit || (jQuery.cssNumber[prop] ? "" : "px"); | |
}, | |
cur: function cur() { | |
var hooks = Tween.propHooks[this.prop]; | |
return hooks && hooks.get ? hooks.get(this) : Tween.propHooks._default.get(this); | |
}, | |
run: function run(percent) { | |
var eased, | |
hooks = Tween.propHooks[this.prop]; | |
if (this.options.duration) { | |
this.pos = eased = jQuery.easing[this.easing](percent, this.options.duration * percent, 0, 1, this.options.duration); | |
} else { | |
this.pos = eased = percent; | |
} | |
this.now = (this.end - this.start) * eased + this.start; | |
if (this.options.step) { | |
this.options.step.call(this.elem, this.now, this); | |
} | |
if (hooks && hooks.set) { | |
hooks.set(this); | |
} else { | |
Tween.propHooks._default.set(this); | |
} | |
return this; | |
} | |
}; | |
Tween.prototype.init.prototype = Tween.prototype; | |
Tween.propHooks = { | |
_default: { | |
get: function get(tween) { | |
var result; | |
// Use a property on the element directly when it is not a DOM element, | |
// or when there is no matching style property that exists. | |
if (tween.elem.nodeType !== 1 || tween.elem[tween.prop] != null && tween.elem.style[tween.prop] == null) { | |
return tween.elem[tween.prop]; | |
} | |
// Passing an empty string as a 3rd parameter to .css will automatically | |
// attempt a parseFloat and fallback to a string if the parse fails. | |
// Simple values such as "10px" are parsed to Float; | |
// complex values such as "rotate(1rad)" are returned as-is. | |
result = jQuery.css(tween.elem, tween.prop, ""); | |
// Empty strings, null, undefined and "auto" are converted to 0. | |
return !result || result === "auto" ? 0 : result; | |
}, | |
set: function set(tween) { | |
// Use step hook for back compat. | |
// Use cssHook if its there. | |
// Use .style if available and use plain properties where available. | |
if (jQuery.fx.step[tween.prop]) { | |
jQuery.fx.step[tween.prop](tween); | |
} else if (tween.elem.nodeType === 1 && (tween.elem.style[jQuery.cssProps[tween.prop]] != null || jQuery.cssHooks[tween.prop])) { | |
jQuery.style(tween.elem, tween.prop, tween.now + tween.unit); | |
} else { | |
tween.elem[tween.prop] = tween.now; | |
} | |
} | |
} | |
}; | |
// Support: IE <=9 only | |
// Panic based approach to setting things on disconnected nodes | |
Tween.propHooks.scrollTop = Tween.propHooks.scrollLeft = { | |
set: function set(tween) { | |
if (tween.elem.nodeType && tween.elem.parentNode) { | |
tween.elem[tween.prop] = tween.now; | |
} | |
} | |
}; | |
jQuery.easing = { | |
linear: function linear(p) { | |
return p; | |
}, | |
swing: function swing(p) { | |
return 0.5 - Math.cos(p * Math.PI) / 2; | |
}, | |
_default: "swing" | |
}; | |
jQuery.fx = Tween.prototype.init; | |
// Back compat <1.8 extension point | |
jQuery.fx.step = {}; | |
var fxNow, | |
inProgress, | |
rfxtypes = /^(?:toggle|show|hide)$/, | |
rrun = /queueHooks$/; | |
function schedule() { | |
if (inProgress) { | |
if (document.hidden === false && window.requestAnimationFrame) { | |
window.requestAnimationFrame(schedule); | |
} else { | |
window.setTimeout(schedule, jQuery.fx.interval); | |
} | |
jQuery.fx.tick(); | |
} | |
} | |
// Animations created synchronously will run synchronously | |
function createFxNow() { | |
window.setTimeout(function () { | |
fxNow = undefined; | |
}); | |
return fxNow = jQuery.now(); | |
} | |
// Generate parameters to create a standard animation | |
function genFx(type, includeWidth) { | |
var which, | |
i = 0, | |
attrs = { height: type }; | |
// If we include width, step value is 1 to do all cssExpand values, | |
// otherwise step value is 2 to skip over Left and Right | |
includeWidth = includeWidth ? 1 : 0; | |
for (; i < 4; i += 2 - includeWidth) { | |
which = cssExpand[i]; | |
attrs["margin" + which] = attrs["padding" + which] = type; | |
} | |
if (includeWidth) { | |
attrs.opacity = attrs.width = type; | |
} | |
return attrs; | |
} | |
function createTween(value, prop, animation) { | |
var tween, | |
collection = (Animation.tweeners[prop] || []).concat(Animation.tweeners["*"]), | |
index = 0, | |
length = collection.length; | |
for (; index < length; index++) { | |
if (tween = collection[index].call(animation, prop, value)) { | |
// We're done with this property | |
return tween; | |
} | |
} | |
} | |
function defaultPrefilter(elem, props, opts) { | |
var prop, | |
value, | |
toggle, | |
hooks, | |
oldfire, | |
propTween, | |
restoreDisplay, | |
display, | |
isBox = "width" in props || "height" in props, | |
anim = this, | |
orig = {}, | |
style = elem.style, | |
hidden = elem.nodeType && isHiddenWithinTree(elem), | |
dataShow = dataPriv.get(elem, "fxshow"); | |
// Queue-skipping animations hijack the fx hooks | |
if (!opts.queue) { | |
hooks = jQuery._queueHooks(elem, "fx"); | |
if (hooks.unqueued == null) { | |
hooks.unqueued = 0; | |
oldfire = hooks.empty.fire; | |
hooks.empty.fire = function () { | |
if (!hooks.unqueued) { | |
oldfire(); | |
} | |
}; | |
} | |
hooks.unqueued++; | |
anim.always(function () { | |
// Ensure the complete handler is called before this completes | |
anim.always(function () { | |
hooks.unqueued--; | |
if (!jQuery.queue(elem, "fx").length) { | |
hooks.empty.fire(); | |
} | |
}); | |
}); | |
} | |
// Detect show/hide animations | |
for (prop in props) { | |
value = props[prop]; | |
if (rfxtypes.test(value)) { | |
delete props[prop]; | |
toggle = toggle || value === "toggle"; | |
if (value === (hidden ? "hide" : "show")) { | |
// Pretend to be hidden if this is a "show" and | |
// there is still data from a stopped show/hide | |
if (value === "show" && dataShow && dataShow[prop] !== undefined) { | |
hidden = true; | |
// Ignore all other no-op show/hide data | |
} else { | |
continue; | |
} | |
} | |
orig[prop] = dataShow && dataShow[prop] || jQuery.style(elem, prop); | |
} | |
} | |
// Bail out if this is a no-op like .hide().hide() | |
propTween = !jQuery.isEmptyObject(props); | |
if (!propTween && jQuery.isEmptyObject(orig)) { | |
return; | |
} | |
// Restrict "overflow" and "display" styles during box animations | |
if (isBox && elem.nodeType === 1) { | |
// Support: IE <=9 - 11, Edge 12 - 13 | |
// Record all 3 overflow attributes because IE does not infer the shorthand | |
// from identically-valued overflowX and overflowY | |
opts.overflow = [style.overflow, style.overflowX, style.overflowY]; | |
// Identify a display type, preferring old show/hide data over the CSS cascade | |
restoreDisplay = dataShow && dataShow.display; | |
if (restoreDisplay == null) { | |
restoreDisplay = dataPriv.get(elem, "display"); | |
} | |
display = jQuery.css(elem, "display"); | |
if (display === "none") { | |
if (restoreDisplay) { | |
display = restoreDisplay; | |
} else { | |
// Get nonempty value(s) by temporarily forcing visibility | |
showHide([elem], true); | |
restoreDisplay = elem.style.display || restoreDisplay; | |
display = jQuery.css(elem, "display"); | |
showHide([elem]); | |
} | |
} | |
// Animate inline elements as inline-block | |
if (display === "inline" || display === "inline-block" && restoreDisplay != null) { | |
if (jQuery.css(elem, "float") === "none") { | |
// Restore the original display value at the end of pure show/hide animations | |
if (!propTween) { | |
anim.done(function () { | |
style.display = restoreDisplay; | |
}); | |
if (restoreDisplay == null) { | |
display = style.display; | |
restoreDisplay = display === "none" ? "" : display; | |
} | |
} | |
style.display = "inline-block"; | |
} | |
} | |
} | |
if (opts.overflow) { | |
style.overflow = "hidden"; | |
anim.always(function () { | |
style.overflow = opts.overflow[0]; | |
style.overflowX = opts.overflow[1]; | |
style.overflowY = opts.overflow[2]; | |
}); | |
} | |
// Implement show/hide animations | |
propTween = false; | |
for (prop in orig) { | |
// General show/hide setup for this element animation | |
if (!propTween) { | |
if (dataShow) { | |
if ("hidden" in dataShow) { | |
hidden = dataShow.hidden; | |
} | |
} else { | |
dataShow = dataPriv.access(elem, "fxshow", { display: restoreDisplay }); | |
} | |
// Store hidden/visible for toggle so `.stop().toggle()` "reverses" | |
if (toggle) { | |
dataShow.hidden = !hidden; | |
} | |
// Show elements before animating them | |
if (hidden) { | |
showHide([elem], true); | |
} | |
/* eslint-disable no-loop-func */ | |
anim.done(function () { | |
/* eslint-enable no-loop-func */ | |
// The final step of a "hide" animation is actually hiding the element | |
if (!hidden) { | |
showHide([elem]); | |
} | |
dataPriv.remove(elem, "fxshow"); | |
for (prop in orig) { | |
jQuery.style(elem, prop, orig[prop]); | |
} | |
}); | |
} | |
// Per-property setup | |
propTween = createTween(hidden ? dataShow[prop] : 0, prop, anim); | |
if (!(prop in dataShow)) { | |
dataShow[prop] = propTween.start; | |
if (hidden) { | |
propTween.end = propTween.start; | |
propTween.start = 0; | |
} | |
} | |
} | |
} | |
function propFilter(props, specialEasing) { | |
var index, name, easing, value, hooks; | |
// camelCase, specialEasing and expand cssHook pass | |
for (index in props) { | |
name = jQuery.camelCase(index); | |
easing = specialEasing[name]; | |
value = props[index]; | |
if (Array.isArray(value)) { | |
easing = value[1]; | |
value = props[index] = value[0]; | |
} | |
if (index !== name) { | |
props[name] = value; | |
delete props[index]; | |
} | |
hooks = jQuery.cssHooks[name]; | |
if (hooks && "expand" in hooks) { | |
value = hooks.expand(value); | |
delete props[name]; | |
// Not quite $.extend, this won't overwrite existing keys. | |
// Reusing 'index' because we have the correct "name" | |
for (index in value) { | |
if (!(index in props)) { | |
props[index] = value[index]; | |
specialEasing[index] = easing; | |
} | |
} | |
} else { | |
specialEasing[name] = easing; | |
} | |
} | |
} | |
function Animation(elem, properties, options) { | |
var result, | |
stopped, | |
index = 0, | |
length = Animation.prefilters.length, | |
deferred = jQuery.Deferred().always(function () { | |
// Don't match elem in the :animated selector | |
delete tick.elem; | |
}), | |
tick = function tick() { | |
if (stopped) { | |
return false; | |
} | |
var currentTime = fxNow || createFxNow(), | |
remaining = Math.max(0, animation.startTime + animation.duration - currentTime), | |
// Support: Android 2.3 only | |
// Archaic crash bug won't allow us to use `1 - ( 0.5 || 0 )` (#12497) | |
temp = remaining / animation.duration || 0, | |
percent = 1 - temp, | |
index = 0, | |
length = animation.tweens.length; | |
for (; index < length; index++) { | |
animation.tweens[index].run(percent); | |
} | |
deferred.notifyWith(elem, [animation, percent, remaining]); | |
// If there's more to do, yield | |
if (percent < 1 && length) { | |
return remaining; | |
} | |
// If this was an empty animation, synthesize a final progress notification | |
if (!length) { | |
deferred.notifyWith(elem, [animation, 1, 0]); | |
} | |
// Resolve the animation and report its conclusion | |
deferred.resolveWith(elem, [animation]); | |
return false; | |
}, | |
animation = deferred.promise({ | |
elem: elem, | |
props: jQuery.extend({}, properties), | |
opts: jQuery.extend(true, { | |
specialEasing: {}, | |
easing: jQuery.easing._default | |
}, options), | |
originalProperties: properties, | |
originalOptions: options, | |
startTime: fxNow || createFxNow(), | |
duration: options.duration, | |
tweens: [], | |
createTween: function createTween(prop, end) { | |
var tween = jQuery.Tween(elem, animation.opts, prop, end, animation.opts.specialEasing[prop] || animation.opts.easing); | |
animation.tweens.push(tween); | |
return tween; | |
}, | |
stop: function stop(gotoEnd) { | |
var index = 0, | |
// If we are going to the end, we want to run all the tweens | |
// otherwise we skip this part | |
length = gotoEnd ? animation.tweens.length : 0; | |
if (stopped) { | |
return this; | |
} | |
stopped = true; | |
for (; index < length; index++) { | |
animation.tweens[index].run(1); | |
} | |
// Resolve when we played the last frame; otherwise, reject | |
if (gotoEnd) { | |
deferred.notifyWith(elem, [animation, 1, 0]); | |
deferred.resolveWith(elem, [animation, gotoEnd]); | |
} else { | |
deferred.rejectWith(elem, [animation, gotoEnd]); | |
} | |
return this; | |
} | |
}), | |
props = animation.props; | |
propFilter(props, animation.opts.specialEasing); | |
for (; index < length; index++) { | |
result = Animation.prefilters[index].call(animation, elem, props, animation.opts); | |
if (result) { | |
if (jQuery.isFunction(result.stop)) { | |
jQuery._queueHooks(animation.elem, animation.opts.queue).stop = jQuery.proxy(result.stop, result); | |
} | |
return result; | |
} | |
} | |
jQuery.map(props, createTween, animation); | |
if (jQuery.isFunction(animation.opts.start)) { | |
animation.opts.start.call(elem, animation); | |
} | |
// Attach callbacks from options | |
animation.progress(animation.opts.progress).done(animation.opts.done, animation.opts.complete).fail(animation.opts.fail).always(animation.opts.always); | |
jQuery.fx.timer(jQuery.extend(tick, { | |
elem: elem, | |
anim: animation, | |
queue: animation.opts.queue | |
})); | |
return animation; | |
} | |
jQuery.Animation = jQuery.extend(Animation, { | |
tweeners: { | |
"*": [function (prop, value) { | |
var tween = this.createTween(prop, value); | |
adjustCSS(tween.elem, prop, rcssNum.exec(value), tween); | |
return tween; | |
}] | |
}, | |
tweener: function tweener(props, callback) { | |
if (jQuery.isFunction(props)) { | |
callback = props; | |
props = ["*"]; | |
} else { | |
props = props.match(rnothtmlwhite); | |
} | |
var prop, | |
index = 0, | |
length = props.length; | |
for (; index < length; index++) { | |
prop = props[index]; | |
Animation.tweeners[prop] = Animation.tweeners[prop] || []; | |
Animation.tweeners[prop].unshift(callback); | |
} | |
}, | |
prefilters: [defaultPrefilter], | |
prefilter: function prefilter(callback, prepend) { | |
if (prepend) { | |
Animation.prefilters.unshift(callback); | |
} else { | |
Animation.prefilters.push(callback); | |
} | |
} | |
}); | |
jQuery.speed = function (speed, easing, fn) { | |
var opt = speed && (typeof speed === "undefined" ? "undefined" : _typeof(speed)) === "object" ? jQuery.extend({}, speed) : { | |
complete: fn || !fn && easing || jQuery.isFunction(speed) && speed, | |
duration: speed, | |
easing: fn && easing || easing && !jQuery.isFunction(easing) && easing | |
}; | |
// Go to the end state if fx are off | |
if (jQuery.fx.off) { | |
opt.duration = 0; | |
} else { | |
if (typeof opt.duration !== "number") { | |
if (opt.duration in jQuery.fx.speeds) { | |
opt.duration = jQuery.fx.speeds[opt.duration]; | |
} else { | |
opt.duration = jQuery.fx.speeds._default; | |
} | |
} | |
} | |
// Normalize opt.queue - true/undefined/null -> "fx" | |
if (opt.queue == null || opt.queue === true) { | |
opt.queue = "fx"; | |
} | |
// Queueing | |
opt.old = opt.complete; | |
opt.complete = function () { | |
if (jQuery.isFunction(opt.old)) { | |
opt.old.call(this); | |
} | |
if (opt.queue) { | |
jQuery.dequeue(this, opt.queue); | |
} | |
}; | |
return opt; | |
}; | |
jQuery.fn.extend({ | |
fadeTo: function fadeTo(speed, to, easing, callback) { | |
// Show any hidden elements after setting opacity to 0 | |
return this.filter(isHiddenWithinTree).css("opacity", 0).show() | |
// Animate to the value specified | |
.end().animate({ opacity: to }, speed, easing, callback); | |
}, | |
animate: function animate(prop, speed, easing, callback) { | |
var empty = jQuery.isEmptyObject(prop), | |
optall = jQuery.speed(speed, easing, callback), | |
doAnimation = function doAnimation() { | |
// Operate on a copy of prop so per-property easing won't be lost | |
var anim = Animation(this, jQuery.extend({}, prop), optall); | |
// Empty animations, or finishing resolves immediately | |
if (empty || dataPriv.get(this, "finish")) { | |
anim.stop(true); | |
} | |
}; | |
doAnimation.finish = doAnimation; | |
return empty || optall.queue === false ? this.each(doAnimation) : this.queue(optall.queue, doAnimation); | |
}, | |
stop: function stop(type, clearQueue, gotoEnd) { | |
var stopQueue = function stopQueue(hooks) { | |
var stop = hooks.stop; | |
delete hooks.stop; | |
stop(gotoEnd); | |
}; | |
if (typeof type !== "string") { | |
gotoEnd = clearQueue; | |
clearQueue = type; | |
type = undefined; | |
} | |
if (clearQueue && type !== false) { | |
this.queue(type || "fx", []); | |
} | |
return this.each(function () { | |
var dequeue = true, | |
index = type != null && type + "queueHooks", | |
timers = jQuery.timers, | |
data = dataPriv.get(this); | |
if (index) { | |
if (data[index] && data[index].stop) { | |
stopQueue(data[index]); | |
} | |
} else { | |
for (index in data) { | |
if (data[index] && data[index].stop && rrun.test(index)) { | |
stopQueue(data[index]); | |
} | |
} | |
} | |
for (index = timers.length; index--;) { | |
if (timers[index].elem === this && (type == null || timers[index].queue === type)) { | |
timers[index].anim.stop(gotoEnd); | |
dequeue = false; | |
timers.splice(index, 1); | |
} | |
} | |
// Start the next in the queue if the last step wasn't forced. | |
// Timers currently will call their complete callbacks, which | |
// will dequeue but only if they were gotoEnd. | |
if (dequeue || !gotoEnd) { | |
jQuery.dequeue(this, type); | |
} | |
}); | |
}, | |
finish: function finish(type) { | |
if (type !== false) { | |
type = type || "fx"; | |
} | |
return this.each(function () { | |
var index, | |
data = dataPriv.get(this), | |
queue = data[type + "queue"], | |
hooks = data[type + "queueHooks"], | |
timers = jQuery.timers, | |
length = queue ? queue.length : 0; | |
// Enable finishing flag on private data | |
data.finish = true; | |
// Empty the queue first | |
jQuery.queue(this, type, []); | |
if (hooks && hooks.stop) { | |
hooks.stop.call(this, true); | |
} | |
// Look for any active animations, and finish them | |
for (index = timers.length; index--;) { | |
if (timers[index].elem === this && timers[index].queue === type) { | |
timers[index].anim.stop(true); | |
timers.splice(index, 1); | |
} | |
} | |
// Look for any animations in the old queue and finish them | |
for (index = 0; index < length; index++) { | |
if (queue[index] && queue[index].finish) { | |
queue[index].finish.call(this); | |
} | |
} | |
// Turn off finishing flag | |
delete data.finish; | |
}); | |
} | |
}); | |
jQuery.each(["toggle", "show", "hide"], function (i, name) { | |
var cssFn = jQuery.fn[name]; | |
jQuery.fn[name] = function (speed, easing, callback) { | |
return speed == null || typeof speed === "boolean" ? cssFn.apply(this, arguments) : this.animate(genFx(name, true), speed, easing, callback); | |
}; | |
}); | |
// Generate shortcuts for custom animations | |
jQuery.each({ | |
slideDown: genFx("show"), | |
slideUp: genFx("hide"), | |
slideToggle: genFx("toggle"), | |
fadeIn: { opacity: "show" }, | |
fadeOut: { opacity: "hide" }, | |
fadeToggle: { opacity: "toggle" } | |
}, function (name, props) { | |
jQuery.fn[name] = function (speed, easing, callback) { | |
return this.animate(props, speed, easing, callback); | |
}; | |
}); | |
jQuery.timers = []; | |
jQuery.fx.tick = function () { | |
var timer, | |
i = 0, | |
timers = jQuery.timers; | |
fxNow = jQuery.now(); | |
for (; i < timers.length; i++) { | |
timer = timers[i]; | |
// Run the timer and safely remove it when done (allowing for external removal) | |
if (!timer() && timers[i] === timer) { | |
timers.splice(i--, 1); | |
} | |
} | |
if (!timers.length) { | |
jQuery.fx.stop(); | |
} | |
fxNow = undefined; | |
}; | |
jQuery.fx.timer = function (timer) { | |
jQuery.timers.push(timer); | |
jQuery.fx.start(); | |
}; | |
jQuery.fx.interval = 13; | |
jQuery.fx.start = function () { | |
if (inProgress) { | |
return; | |
} | |
inProgress = true; | |
schedule(); | |
}; | |
jQuery.fx.stop = function () { | |
inProgress = null; | |
}; | |
jQuery.fx.speeds = { | |
slow: 600, | |
fast: 200, | |
// Default speed | |
_default: 400 | |
}; | |
// Based off of the plugin by Clint Helfers, with permission. | |
// https://web.archive.org/web/20100324014747/http://blindsignals.com/index.php/2009/07/jquery-delay/ | |
jQuery.fn.delay = function (time, type) { | |
time = jQuery.fx ? jQuery.fx.speeds[time] || time : time; | |
type = type || "fx"; | |
return this.queue(type, function (next, hooks) { | |
var timeout = window.setTimeout(next, time); | |
hooks.stop = function () { | |
window.clearTimeout(timeout); | |
}; | |
}); | |
}; | |
(function () { | |
var input = document.createElement("input"), | |
select = document.createElement("select"), | |
opt = select.appendChild(document.createElement("option")); | |
input.type = "checkbox"; | |
// Support: Android <=4.3 only | |
// Default value for a checkbox should be "on" | |
support.checkOn = input.value !== ""; | |
// Support: IE <=11 only | |
// Must access selectedIndex to make default options select | |
support.optSelected = opt.selected; | |
// Support: IE <=11 only | |
// An input loses its value after becoming a radio | |
input = document.createElement("input"); | |
input.value = "t"; | |
input.type = "radio"; | |
support.radioValue = input.value === "t"; | |
})(); | |
var boolHook, | |
attrHandle = jQuery.expr.attrHandle; | |
jQuery.fn.extend({ | |
attr: function attr(name, value) { | |
return access(this, jQuery.attr, name, value, arguments.length > 1); | |
}, | |
removeAttr: function removeAttr(name) { | |
return this.each(function () { | |
jQuery.removeAttr(this, name); | |
}); | |
} | |
}); | |
jQuery.extend({ | |
attr: function attr(elem, name, value) { | |
var ret, | |
hooks, | |
nType = elem.nodeType; | |
// Don't get/set attributes on text, comment and attribute nodes | |
if (nType === 3 || nType === 8 || nType === 2) { | |
return; | |
} | |
// Fallback to prop when attributes are not supported | |
if (typeof elem.getAttribute === "undefined") { | |
return jQuery.prop(elem, name, value); | |
} | |
// Attribute hooks are determined by the lowercase version | |
// Grab necessary hook if one is defined | |
if (nType !== 1 || !jQuery.isXMLDoc(elem)) { | |
hooks = jQuery.attrHooks[name.toLowerCase()] || (jQuery.expr.match.bool.test(name) ? boolHook : undefined); | |
} | |
if (value !== undefined) { | |
if (value === null) { | |
jQuery.removeAttr(elem, name); | |
return; | |
} | |
if (hooks && "set" in hooks && (ret = hooks.set(elem, value, name)) !== undefined) { | |
return ret; | |
} | |
elem.setAttribute(name, value + ""); | |
return value; | |
} | |
if (hooks && "get" in hooks && (ret = hooks.get(elem, name)) !== null) { | |
return ret; | |
} | |
ret = jQuery.find.attr(elem, name); | |
// Non-existent attributes return null, we normalize to undefined | |
return ret == null ? undefined : ret; | |
}, | |
attrHooks: { | |
type: { | |
set: function set(elem, value) { | |
if (!support.radioValue && value === "radio" && nodeName(elem, "input")) { | |
var val = elem.value; | |
elem.setAttribute("type", value); | |
if (val) { | |
elem.value = val; | |
} | |
return value; | |
} | |
} | |
} | |
}, | |
removeAttr: function removeAttr(elem, value) { | |
var name, | |
i = 0, | |
// Attribute names can contain non-HTML whitespace characters | |
// https://html.spec.whatwg.org/multipage/syntax.html#attributes-2 | |
attrNames = value && value.match(rnothtmlwhite); | |
if (attrNames && elem.nodeType === 1) { | |
while (name = attrNames[i++]) { | |
elem.removeAttribute(name); | |
} | |
} | |
} | |
}); | |
// Hooks for boolean attributes | |
boolHook = { | |
set: function set(elem, value, name) { | |
if (value === false) { | |
// Remove boolean attributes when set to false | |
jQuery.removeAttr(elem, name); | |
} else { | |
elem.setAttribute(name, name); | |
} | |
return name; | |
} | |
}; | |
jQuery.each(jQuery.expr.match.bool.source.match(/\w+/g), function (i, name) { | |
var getter = attrHandle[name] || jQuery.find.attr; | |
attrHandle[name] = function (elem, name, isXML) { | |
var ret, | |
handle, | |
lowercaseName = name.toLowerCase(); | |
if (!isXML) { | |
// Avoid an infinite loop by temporarily removing this function from the getter | |
handle = attrHandle[lowercaseName]; | |
attrHandle[lowercaseName] = ret; | |
ret = getter(elem, name, isXML) != null ? lowercaseName : null; | |
attrHandle[lowercaseName] = handle; | |
} | |
return ret; | |
}; | |
}); | |
var rfocusable = /^(?:input|select|textarea|button)$/i, | |
rclickable = /^(?:a|area)$/i; | |
jQuery.fn.extend({ | |
prop: function prop(name, value) { | |
return access(this, jQuery.prop, name, value, arguments.length > 1); | |
}, | |
removeProp: function removeProp(name) { | |
return this.each(function () { | |
delete this[jQuery.propFix[name] || name]; | |
}); | |
} | |
}); | |
jQuery.extend({ | |
prop: function prop(elem, name, value) { | |
var ret, | |
hooks, | |
nType = elem.nodeType; | |
// Don't get/set properties on text, comment and attribute nodes | |
if (nType === 3 || nType === 8 || nType === 2) { | |
return; | |
} | |
if (nType !== 1 || !jQuery.isXMLDoc(elem)) { | |
// Fix name and attach hooks | |
name = jQuery.propFix[name] || name; | |
hooks = jQuery.propHooks[name]; | |
} | |
if (value !== undefined) { | |
if (hooks && "set" in hooks && (ret = hooks.set(elem, value, name)) !== undefined) { | |
return ret; | |
} | |
return elem[name] = value; | |
} | |
if (hooks && "get" in hooks && (ret = hooks.get(elem, name)) !== null) { | |
return ret; | |
} | |
return elem[name]; | |
}, | |
propHooks: { | |
tabIndex: { | |
get: function get(elem) { | |
// Support: IE <=9 - 11 only | |
// elem.tabIndex doesn't always return the | |
// correct value when it hasn't been explicitly set | |
// https://web.archive.org/web/20141116233347/http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/ | |
// Use proper attribute retrieval(#12072) | |
var tabindex = jQuery.find.attr(elem, "tabindex"); | |
if (tabindex) { | |
return parseInt(tabindex, 10); | |
} | |
if (rfocusable.test(elem.nodeName) || rclickable.test(elem.nodeName) && elem.href) { | |
return 0; | |
} | |
return -1; | |
} | |
} | |
}, | |
propFix: { | |
"for": "htmlFor", | |
"class": "className" | |
} | |
}); | |
// Support: IE <=11 only | |
// Accessing the selectedIndex property | |
// forces the browser to respect setting selected | |
// on the option | |
// The getter ensures a default option is selected | |
// when in an optgroup | |
// eslint rule "no-unused-expressions" is disabled for this code | |
// since it considers such accessions noop | |
if (!support.optSelected) { | |
jQuery.propHooks.selected = { | |
get: function get(elem) { | |
/* eslint no-unused-expressions: "off" */ | |
var parent = elem.parentNode; | |
if (parent && parent.parentNode) { | |
parent.parentNode.selectedIndex; | |
} | |
return null; | |
}, | |
set: function set(elem) { | |
/* eslint no-unused-expressions: "off" */ | |
var parent = elem.parentNode; | |
if (parent) { | |
parent.selectedIndex; | |
if (parent.parentNode) { | |
parent.parentNode.selectedIndex; | |
} | |
} | |
} | |
}; | |
} | |
jQuery.each(["tabIndex", "readOnly", "maxLength", "cellSpacing", "cellPadding", "rowSpan", "colSpan", "useMap", "frameBorder", "contentEditable"], function () { | |
jQuery.propFix[this.toLowerCase()] = this; | |
}); | |
// Strip and collapse whitespace according to HTML spec | |
// https://html.spec.whatwg.org/multipage/infrastructure.html#strip-and-collapse-whitespace | |
function stripAndCollapse(value) { | |
var tokens = value.match(rnothtmlwhite) || []; | |
return tokens.join(" "); | |
} | |
function getClass(elem) { | |
return elem.getAttribute && elem.getAttribute("class") || ""; | |
} | |
jQuery.fn.extend({ | |
addClass: function addClass(value) { | |
var classes, | |
elem, | |
cur, | |
curValue, | |
clazz, | |
j, | |
finalValue, | |
i = 0; | |
if (jQuery.isFunction(value)) { | |
return this.each(function (j) { | |
jQuery(this).addClass(value.call(this, j, getClass(this))); | |
}); | |
} | |
if (typeof value === "string" && value) { | |
classes = value.match(rnothtmlwhite) || []; | |
while (elem = this[i++]) { | |
curValue = getClass(elem); | |
cur = elem.nodeType === 1 && " " + stripAndCollapse(curValue) + " "; | |
if (cur) { | |
j = 0; | |
while (clazz = classes[j++]) { | |
if (cur.indexOf(" " + clazz + " ") < 0) { | |
cur += clazz + " "; | |
} | |
} | |
// Only assign if different to avoid unneeded rendering. | |
finalValue = stripAndCollapse(cur); | |
if (curValue !== finalValue) { | |
elem.setAttribute("class", finalValue); | |
} | |
} | |
} | |
} | |
return this; | |
}, | |
removeClass: function removeClass(value) { | |
var classes, | |
elem, | |
cur, | |
curValue, | |
clazz, | |
j, | |
finalValue, | |
i = 0; | |
if (jQuery.isFunction(value)) { | |
return this.each(function (j) { | |
jQuery(this).removeClass(value.call(this, j, getClass(this))); | |
}); | |
} | |
if (!arguments.length) { | |
return this.attr("class", ""); | |
} | |
if (typeof value === "string" && value) { | |
classes = value.match(rnothtmlwhite) || []; | |
while (elem = this[i++]) { | |
curValue = getClass(elem); | |
// This expression is here for better compressibility (see addClass) | |
cur = elem.nodeType === 1 && " " + stripAndCollapse(curValue) + " "; | |
if (cur) { | |
j = 0; | |
while (clazz = classes[j++]) { | |
// Remove *all* instances | |
while (cur.indexOf(" " + clazz + " ") > -1) { | |
cur = cur.replace(" " + clazz + " ", " "); | |
} | |
} | |
// Only assign if different to avoid unneeded rendering. | |
finalValue = stripAndCollapse(cur); | |
if (curValue !== finalValue) { | |
elem.setAttribute("class", finalValue); | |
} | |
} | |
} | |
} | |
return this; | |
}, | |
toggleClass: function toggleClass(value, stateVal) { | |
var type = typeof value === "undefined" ? "undefined" : _typeof(value); | |
if (typeof stateVal === "boolean" && type === "string") { | |
return stateVal ? this.addClass(value) : this.removeClass(value); | |
} | |
if (jQuery.isFunction(value)) { | |
return this.each(function (i) { | |
jQuery(this).toggleClass(value.call(this, i, getClass(this), stateVal), stateVal); | |
}); | |
} | |
return this.each(function () { | |
var className, i, self, classNames; | |
if (type === "string") { | |
// Toggle individual class names | |
i = 0; | |
self = jQuery(this); | |
classNames = value.match(rnothtmlwhite) || []; | |
while (className = classNames[i++]) { | |
// Check each className given, space separated list | |
if (self.hasClass(className)) { | |
self.removeClass(className); | |
} else { | |
self.addClass(className); | |
} | |
} | |
// Toggle whole class name | |
} else if (value === undefined || type === "boolean") { | |
className = getClass(this); | |
if (className) { | |
// Store className if set | |
dataPriv.set(this, "__className__", className); | |
} | |
// If the element has a class name or if we're passed `false`, | |
// then remove the whole classname (if there was one, the above saved it). | |
// Otherwise bring back whatever was previously saved (if anything), | |
// falling back to the empty string if nothing was stored. | |
if (this.setAttribute) { | |
this.setAttribute("class", className || value === false ? "" : dataPriv.get(this, "__className__") || ""); | |
} | |
} | |
}); | |
}, | |
hasClass: function hasClass(selector) { | |
var className, | |
elem, | |
i = 0; | |
className = " " + selector + " "; | |
while (elem = this[i++]) { | |
if (elem.nodeType === 1 && (" " + stripAndCollapse(getClass(elem)) + " ").indexOf(className) > -1) { | |
return true; | |
} | |
} | |
return false; | |
} | |
}); | |
var rreturn = /\r/g; | |
jQuery.fn.extend({ | |
val: function val(value) { | |
var hooks, | |
ret, | |
isFunction, | |
elem = this[0]; | |
if (!arguments.length) { | |
if (elem) { | |
hooks = jQuery.valHooks[elem.type] || jQuery.valHooks[elem.nodeName.toLowerCase()]; | |
if (hooks && "get" in hooks && (ret = hooks.get(elem, "value")) !== undefined) { | |
return ret; | |
} | |
ret = elem.value; | |
// Handle most common string cases | |
if (typeof ret === "string") { | |
return ret.replace(rreturn, ""); | |
} | |
// Handle cases where value is null/undef or number | |
return ret == null ? "" : ret; | |
} | |
return; | |
} | |
isFunction = jQuery.isFunction(value); | |
return this.each(function (i) { | |
var val; | |
if (this.nodeType !== 1) { | |
return; | |
} | |
if (isFunction) { | |
val = value.call(this, i, jQuery(this).val()); | |
} else { | |
val = value; | |
} | |
// Treat null/undefined as ""; convert numbers to string | |
if (val == null) { | |
val = ""; | |
} else if (typeof val === "number") { | |
val += ""; | |
} else if (Array.isArray(val)) { | |
val = jQuery.map(val, function (value) { | |
return value == null ? "" : value + ""; | |
}); | |
} | |
hooks = jQuery.valHooks[this.type] || jQuery.valHooks[this.nodeName.toLowerCase()]; | |
// If set returns undefined, fall back to normal setting | |
if (!hooks || !("set" in hooks) || hooks.set(this, val, "value") === undefined) { | |
this.value = val; | |
} | |
}); | |
} | |
}); | |
jQuery.extend({ | |
valHooks: { | |
option: { | |
get: function get(elem) { | |
var val = jQuery.find.attr(elem, "value"); | |
return val != null ? val : | |
// Support: IE <=10 - 11 only | |
// option.text throws exceptions (#14686, #14858) | |
// Strip and collapse whitespace | |
// https://html.spec.whatwg.org/#strip-and-collapse-whitespace | |
stripAndCollapse(jQuery.text(elem)); | |
} | |
}, | |
select: { | |
get: function get(elem) { | |
var value, | |
option, | |
i, | |
options = elem.options, | |
index = elem.selectedIndex, | |
one = elem.type === "select-one", | |
values = one ? null : [], | |
max = one ? index + 1 : options.length; | |
if (index < 0) { | |
i = max; | |
} else { | |
i = one ? index : 0; | |
} | |
// Loop through all the selected options | |
for (; i < max; i++) { | |
option = options[i]; | |
// Support: IE <=9 only | |
// IE8-9 doesn't update selected after form reset (#2551) | |
if ((option.selected || i === index) && | |
// Don't return options that are disabled or in a disabled optgroup | |
!option.disabled && (!option.parentNode.disabled || !nodeName(option.parentNode, "optgroup"))) { | |
// Get the specific value for the option | |
value = jQuery(option).val(); | |
// We don't need an array for one selects | |
if (one) { | |
return value; | |
} | |
// Multi-Selects return an array | |
values.push(value); | |
} | |
} | |
return values; | |
}, | |
set: function set(elem, value) { | |
var optionSet, | |
option, | |
options = elem.options, | |
values = jQuery.makeArray(value), | |
i = options.length; | |
while (i--) { | |
option = options[i]; | |
/* eslint-disable no-cond-assign */ | |
if (option.selected = jQuery.inArray(jQuery.valHooks.option.get(option), values) > -1) { | |
optionSet = true; | |
} | |
/* eslint-enable no-cond-assign */ | |
} | |
// Force browsers to behave consistently when non-matching value is set | |
if (!optionSet) { | |
elem.selectedIndex = -1; | |
} | |
return values; | |
} | |
} | |
} | |
}); | |
// Radios and checkboxes getter/setter | |
jQuery.each(["radio", "checkbox"], function () { | |
jQuery.valHooks[this] = { | |
set: function set(elem, value) { | |
if (Array.isArray(value)) { | |
return elem.checked = jQuery.inArray(jQuery(elem).val(), value) > -1; | |
} | |
} | |
}; | |
if (!support.checkOn) { | |
jQuery.valHooks[this].get = function (elem) { | |
return elem.getAttribute("value") === null ? "on" : elem.value; | |
}; | |
} | |
}); | |
// Return jQuery for attributes-only inclusion | |
var rfocusMorph = /^(?:focusinfocus|focusoutblur)$/; | |
jQuery.extend(jQuery.event, { | |
trigger: function trigger(event, data, elem, onlyHandlers) { | |
var i, | |
cur, | |
tmp, | |
bubbleType, | |
ontype, | |
handle, | |
special, | |
eventPath = [elem || document], | |
type = hasOwn.call(event, "type") ? event.type : event, | |
namespaces = hasOwn.call(event, "namespace") ? event.namespace.split(".") : []; | |
cur = tmp = elem = elem || document; | |
// Don't do events on text and comment nodes | |
if (elem.nodeType === 3 || elem.nodeType === 8) { | |
return; | |
} | |
// focus/blur morphs to focusin/out; ensure we're not firing them right now | |
if (rfocusMorph.test(type + jQuery.event.triggered)) { | |
return; | |
} | |
if (type.indexOf(".") > -1) { | |
// Namespaced trigger; create a regexp to match event type in handle() | |
namespaces = type.split("."); | |
type = namespaces.shift(); | |
namespaces.sort(); | |
} | |
ontype = type.indexOf(":") < 0 && "on" + type; | |
// Caller can pass in a jQuery.Event object, Object, or just an event type string | |
event = event[jQuery.expando] ? event : new jQuery.Event(type, (typeof event === "undefined" ? "undefined" : _typeof(event)) === "object" && event); | |
// Trigger bitmask: & 1 for native handlers; & 2 for jQuery (always true) | |
event.isTrigger = onlyHandlers ? 2 : 3; | |
event.namespace = namespaces.join("."); | |
event.rnamespace = event.namespace ? new RegExp("(^|\\.)" + namespaces.join("\\.(?:.*\\.|)") + "(\\.|$)") : null; | |
// Clean up the event in case it is being reused | |
event.result = undefined; | |
if (!event.target) { | |
event.target = elem; | |
} | |
// Clone any incoming data and prepend the event, creating the handler arg list | |
data = data == null ? [event] : jQuery.makeArray(data, [event]); | |
// Allow special events to draw outside the lines | |
special = jQuery.event.special[type] || {}; | |
if (!onlyHandlers && special.trigger && special.trigger.apply(elem, data) === false) { | |
return; | |
} | |
// Determine event propagation path in advance, per W3C events spec (#9951) | |
// Bubble up to document, then to window; watch for a global ownerDocument var (#9724) | |
if (!onlyHandlers && !special.noBubble && !jQuery.isWindow(elem)) { | |
bubbleType = special.delegateType || type; | |
if (!rfocusMorph.test(bubbleType + type)) { | |
cur = cur.parentNode; | |
} | |
for (; cur; cur = cur.parentNode) { | |
eventPath.push(cur); | |
tmp = cur; | |
} | |
// Only add window if we got to document (e.g., not plain obj or detached DOM) | |
if (tmp === (elem.ownerDocument || document)) { | |
eventPath.push(tmp.defaultView || tmp.parentWindow || window); | |
} | |
} | |
// Fire handlers on the event path | |
i = 0; | |
while ((cur = eventPath[i++]) && !event.isPropagationStopped()) { | |
event.type = i > 1 ? bubbleType : special.bindType || type; | |
// jQuery handler | |
handle = (dataPriv.get(cur, "events") || {})[event.type] && dataPriv.get(cur, "handle"); | |
if (handle) { | |
handle.apply(cur, data); | |
} | |
// Native handler | |
handle = ontype && cur[ontype]; | |
if (handle && handle.apply && acceptData(cur)) { | |
event.result = handle.apply(cur, data); | |
if (event.result === false) { | |
event.preventDefault(); | |
} | |
} | |
} | |
event.type = type; | |
// If nobody prevented the default action, do it now | |
if (!onlyHandlers && !event.isDefaultPrevented()) { | |
if ((!special._default || special._default.apply(eventPath.pop(), data) === false) && acceptData(elem)) { | |
// Call a native DOM method on the target with the same name as the event. | |
// Don't do default actions on window, that's where global variables be (#6170) | |
if (ontype && jQuery.isFunction(elem[type]) && !jQuery.isWindow(elem)) { | |
// Don't re-trigger an onFOO event when we call its FOO() method | |
tmp = elem[ontype]; | |
if (tmp) { | |
elem[ontype] = null; | |
} | |
// Prevent re-triggering of the same event, since we already bubbled it above | |
jQuery.event.triggered = type; | |
elem[type](); | |
jQuery.event.triggered = undefined; | |
if (tmp) { | |
elem[ontype] = tmp; | |
} | |
} | |
} | |
} | |
return event.result; | |
}, | |
// Piggyback on a donor event to simulate a different one | |
// Used only for `focus(in | out)` events | |
simulate: function simulate(type, elem, event) { | |
var e = jQuery.extend(new jQuery.Event(), event, { | |
type: type, | |
isSimulated: true | |
}); | |
jQuery.event.trigger(e, null, elem); | |
} | |
}); | |
jQuery.fn.extend({ | |
trigger: function trigger(type, data) { | |
return this.each(function () { | |
jQuery.event.trigger(type, data, this); | |
}); | |
}, | |
triggerHandler: function triggerHandler(type, data) { | |
var elem = this[0]; | |
if (elem) { | |
return jQuery.event.trigger(type, data, elem, true); | |
} | |
} | |
}); | |
jQuery.each(("blur focus focusin focusout resize scroll click dblclick " + "mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " + "change select submit keydown keypress keyup contextmenu").split(" "), function (i, name) { | |
// Handle event binding | |
jQuery.fn[name] = function (data, fn) { | |
return arguments.length > 0 ? this.on(name, null, data, fn) : this.trigger(name); | |
}; | |
}); | |
jQuery.fn.extend({ | |
hover: function hover(fnOver, fnOut) { | |
return this.mouseenter(fnOver).mouseleave(fnOut || fnOver); | |
} | |
}); | |
support.focusin = "onfocusin" in window; | |
// Support: Firefox <=44 | |
// Firefox doesn't have focus(in | out) events | |
// Related ticket - https://bugzilla.mozilla.org/show_bug.cgi?id=687787 | |
// | |
// Support: Chrome <=48 - 49, Safari <=9.0 - 9.1 | |
// focus(in | out) events fire after focus & blur events, | |
// which is spec violation - http://www.w3.org/TR/DOM-Level-3-Events/#events-focusevent-event-order | |
// Related ticket - https://bugs.chromium.org/p/chromium/issues/detail?id=449857 | |
if (!support.focusin) { | |
jQuery.each({ focus: "focusin", blur: "focusout" }, function (orig, fix) { | |
// Attach a single capturing handler on the document while someone wants focusin/focusout | |
var handler = function handler(event) { | |
jQuery.event.simulate(fix, event.target, jQuery.event.fix(event)); | |
}; | |
jQuery.event.special[fix] = { | |
setup: function setup() { | |
var doc = this.ownerDocument || this, | |
attaches = dataPriv.access(doc, fix); | |
if (!attaches) { | |
doc.addEventListener(orig, handler, true); | |
} | |
dataPriv.access(doc, fix, (attaches || 0) + 1); | |
}, | |
teardown: function teardown() { | |
var doc = this.ownerDocument || this, | |
attaches = dataPriv.access(doc, fix) - 1; | |
if (!attaches) { | |
doc.removeEventListener(orig, handler, true); | |
dataPriv.remove(doc, fix); | |
} else { | |
dataPriv.access(doc, fix, attaches); | |
} | |
} | |
}; | |
}); | |
} | |
var location = window.location; | |
var nonce = jQuery.now(); | |
var rquery = /\?/; | |
// Cross-browser xml parsing | |
jQuery.parseXML = function (data) { | |
var xml; | |
if (!data || typeof data !== "string") { | |
return null; | |
} | |
// Support: IE 9 - 11 only | |
// IE throws on parseFromString with invalid input. | |
try { | |
xml = new window.DOMParser().parseFromString(data, "text/xml"); | |
} catch (e) { | |
xml = undefined; | |
} | |
if (!xml || xml.getElementsByTagName("parsererror").length) { | |
jQuery.error("Invalid XML: " + data); | |
} | |
return xml; | |
}; | |
var rbracket = /\[\]$/, | |
rCRLF = /\r?\n/g, | |
rsubmitterTypes = /^(?:submit|button|image|reset|file)$/i, | |
rsubmittable = /^(?:input|select|textarea|keygen)/i; | |
function buildParams(prefix, obj, traditional, add) { | |
var name; | |
if (Array.isArray(obj)) { | |
// Serialize array item. | |
jQuery.each(obj, function (i, v) { | |
if (traditional || rbracket.test(prefix)) { | |
// Treat each array item as a scalar. | |
add(prefix, v); | |
} else { | |
// Item is non-scalar (array or object), encode its numeric index. | |
buildParams(prefix + "[" + ((typeof v === "undefined" ? "undefined" : _typeof(v)) === "object" && v != null ? i : "") + "]", v, traditional, add); | |
} | |
}); | |
} else if (!traditional && jQuery.type(obj) === "object") { | |
// Serialize object item. | |
for (name in obj) { | |
buildParams(prefix + "[" + name + "]", obj[name], traditional, add); | |
} | |
} else { | |
// Serialize scalar item. | |
add(prefix, obj); | |
} | |
} | |
// Serialize an array of form elements or a set of | |
// key/values into a query string | |
jQuery.param = function (a, traditional) { | |
var prefix, | |
s = [], | |
add = function add(key, valueOrFunction) { | |
// If value is a function, invoke it and use its return value | |
var value = jQuery.isFunction(valueOrFunction) ? valueOrFunction() : valueOrFunction; | |
s[s.length] = encodeURIComponent(key) + "=" + encodeURIComponent(value == null ? "" : value); | |
}; | |
// If an array was passed in, assume that it is an array of form elements. | |
if (Array.isArray(a) || a.jquery && !jQuery.isPlainObject(a)) { | |
// Serialize the form elements | |
jQuery.each(a, function () { | |
add(this.name, this.value); | |
}); | |
} else { | |
// If traditional, encode the "old" way (the way 1.3.2 or older | |
// did it), otherwise encode params recursively. | |
for (prefix in a) { | |
buildParams(prefix, a[prefix], traditional, add); | |
} | |
} | |
// Return the resulting serialization | |
return s.join("&"); | |
}; | |
jQuery.fn.extend({ | |
serialize: function serialize() { | |
return jQuery.param(this.serializeArray()); | |
}, | |
serializeArray: function serializeArray() { | |
return this.map(function () { | |
// Can add propHook for "elements" to filter or add form elements | |
var elements = jQuery.prop(this, "elements"); | |
return elements ? jQuery.makeArray(elements) : this; | |
}).filter(function () { | |
var type = this.type; | |
// Use .is( ":disabled" ) so that fieldset[disabled] works | |
return this.name && !jQuery(this).is(":disabled") && rsubmittable.test(this.nodeName) && !rsubmitterTypes.test(type) && (this.checked || !rcheckableType.test(type)); | |
}).map(function (i, elem) { | |
var val = jQuery(this).val(); | |
if (val == null) { | |
return null; | |
} | |
if (Array.isArray(val)) { | |
return jQuery.map(val, function (val) { | |
return { name: elem.name, value: val.replace(rCRLF, "\r\n") }; | |
}); | |
} | |
return { name: elem.name, value: val.replace(rCRLF, "\r\n") }; | |
}).get(); | |
} | |
}); | |
var r20 = /%20/g, | |
rhash = /#.*$/, | |
rantiCache = /([?&])_=[^&]*/, | |
rheaders = /^(.*?):[ \t]*([^\r\n]*)$/mg, | |
// #7653, #8125, #8152: local protocol detection | |
rlocalProtocol = /^(?:about|app|app-storage|.+-extension|file|res|widget):$/, | |
rnoContent = /^(?:GET|HEAD)$/, | |
rprotocol = /^\/\//, | |
/* Prefilters | |
* 1) They are useful to introduce custom dataTypes (see ajax/jsonp.js for an example) | |
* 2) These are called: | |
* - BEFORE asking for a transport | |
* - AFTER param serialization (s.data is a string if s.processData is true) | |
* 3) key is the dataType | |
* 4) the catchall symbol "*" can be used | |
* 5) execution will start with transport dataType and THEN continue down to "*" if needed | |
*/ | |
prefilters = {}, | |
/* Transports bindings | |
* 1) key is the dataType | |
* 2) the catchall symbol "*" can be used | |
* 3) selection will start with transport dataType and THEN go to "*" if needed | |
*/ | |
transports = {}, | |
// Avoid comment-prolog char sequence (#10098); must appease lint and evade compression | |
allTypes = "*/".concat("*"), | |
// Anchor tag for parsing the document origin | |
originAnchor = document.createElement("a"); | |
originAnchor.href = location.href; | |
// Base "constructor" for jQuery.ajaxPrefilter and jQuery.ajaxTransport | |
function addToPrefiltersOrTransports(structure) { | |
// dataTypeExpression is optional and defaults to "*" | |
return function (dataTypeExpression, func) { | |
if (typeof dataTypeExpression !== "string") { | |
func = dataTypeExpression; | |
dataTypeExpression = "*"; | |
} | |
var dataType, | |
i = 0, | |
dataTypes = dataTypeExpression.toLowerCase().match(rnothtmlwhite) || []; | |
if (jQuery.isFunction(func)) { | |
// For each dataType in the dataTypeExpression | |
while (dataType = dataTypes[i++]) { | |
// Prepend if requested | |
if (dataType[0] === "+") { | |
dataType = dataType.slice(1) || "*"; | |
(structure[dataType] = structure[dataType] || []).unshift(func); | |
// Otherwise append | |
} else { | |
(structure[dataType] = structure[dataType] || []).push(func); | |
} | |
} | |
} | |
}; | |
} | |
// Base inspection function for prefilters and transports | |
function inspectPrefiltersOrTransports(structure, options, originalOptions, jqXHR) { | |
var inspected = {}, | |
seekingTransport = structure === transports; | |
function inspect(dataType) { | |
var selected; | |
inspected[dataType] = true; | |
jQuery.each(structure[dataType] || [], function (_, prefilterOrFactory) { | |
var dataTypeOrTransport = prefilterOrFactory(options, originalOptions, jqXHR); | |
if (typeof dataTypeOrTransport === "string" && !seekingTransport && !inspected[dataTypeOrTransport]) { | |
options.dataTypes.unshift(dataTypeOrTransport); | |
inspect(dataTypeOrTransport); | |
return false; | |
} else if (seekingTransport) { | |
return !(selected = dataTypeOrTransport); | |
} | |
}); | |
return selected; | |
} | |
return inspect(options.dataTypes[0]) || !inspected["*"] && inspect("*"); | |
} | |
// A special extend for ajax options | |
// that takes "flat" options (not to be deep extended) | |
// Fixes #9887 | |
function ajaxExtend(target, src) { | |
var key, | |
deep, | |
flatOptions = jQuery.ajaxSettings.flatOptions || {}; | |
for (key in src) { | |
if (src[key] !== undefined) { | |
(flatOptions[key] ? target : deep || (deep = {}))[key] = src[key]; | |
} | |
} | |
if (deep) { | |
jQuery.extend(true, target, deep); | |
} | |
return target; | |
} | |
/* Handles responses to an ajax request: | |
* - finds the right dataType (mediates between content-type and expected dataType) | |
* - returns the corresponding response | |
*/ | |
function ajaxHandleResponses(s, jqXHR, responses) { | |
var ct, | |
type, | |
finalDataType, | |
firstDataType, | |
contents = s.contents, | |
dataTypes = s.dataTypes; | |
// Remove auto dataType and get content-type in the process | |
while (dataTypes[0] === "*") { | |
dataTypes.shift(); | |
if (ct === undefined) { | |
ct = s.mimeType || jqXHR.getResponseHeader("Content-Type"); | |
} | |
} | |
// Check if we're dealing with a known content-type | |
if (ct) { | |
for (type in contents) { | |
if (contents[type] && contents[type].test(ct)) { | |
dataTypes.unshift(type); | |
break; | |
} | |
} | |
} | |
// Check to see if we have a response for the expected dataType | |
if (dataTypes[0] in responses) { | |
finalDataType = dataTypes[0]; | |
} else { | |
// Try convertible dataTypes | |
for (type in responses) { | |
if (!dataTypes[0] || s.converters[type + " " + dataTypes[0]]) { | |
finalDataType = type; | |
break; | |
} | |
if (!firstDataType) { | |
firstDataType = type; | |
} | |
} | |
// Or just use first one | |
finalDataType = finalDataType || firstDataType; | |
} | |
// If we found a dataType | |
// We add the dataType to the list if needed | |
// and return the corresponding response | |
if (finalDataType) { | |
if (finalDataType !== dataTypes[0]) { | |
dataTypes.unshift(finalDataType); | |
} | |
return responses[finalDataType]; | |
} | |
} | |
/* Chain conversions given the request and the original response | |
* Also sets the responseXXX fields on the jqXHR instance | |
*/ | |
function ajaxConvert(s, response, jqXHR, isSuccess) { | |
var conv2, | |
current, | |
conv, | |
tmp, | |
prev, | |
converters = {}, | |
// Work with a copy of dataTypes in case we need to modify it for conversion | |
dataTypes = s.dataTypes.slice(); | |
// Create converters map with lowercased keys | |
if (dataTypes[1]) { | |
for (conv in s.converters) { | |
converters[conv.toLowerCase()] = s.converters[conv]; | |
} | |
} | |
current = dataTypes.shift(); | |
// Convert to each sequential dataType | |
while (current) { | |
if (s.responseFields[current]) { | |
jqXHR[s.responseFields[current]] = response; | |
} | |
// Apply the dataFilter if provided | |
if (!prev && isSuccess && s.dataFilter) { | |
response = s.dataFilter(response, s.dataType); | |
} | |
prev = current; | |
current = dataTypes.shift(); | |
if (current) { | |
// There's only work to do if current dataType is non-auto | |
if (current === "*") { | |
current = prev; | |
// Convert response if prev dataType is non-auto and differs from current | |
} else if (prev !== "*" && prev !== current) { | |
// Seek a direct converter | |
conv = converters[prev + " " + current] || converters["* " + current]; | |
// If none found, seek a pair | |
if (!conv) { | |
for (conv2 in converters) { | |
// If conv2 outputs current | |
tmp = conv2.split(" "); | |
if (tmp[1] === current) { | |
// If prev can be converted to accepted input | |
conv = converters[prev + " " + tmp[0]] || converters["* " + tmp[0]]; | |
if (conv) { | |
// Condense equivalence converters | |
if (conv === true) { | |
conv = converters[conv2]; | |
// Otherwise, insert the intermediate dataType | |
} else if (converters[conv2] !== true) { | |
current = tmp[0]; | |
dataTypes.unshift(tmp[1]); | |
} | |
break; | |
} | |
} | |
} | |
} | |
// Apply converter (if not an equivalence) | |
if (conv !== true) { | |
// Unless errors are allowed to bubble, catch and return them | |
if (conv && s.throws) { | |
response = conv(response); | |
} else { | |
try { | |
response = conv(response); | |
} catch (e) { | |
return { | |
state: "parsererror", | |
error: conv ? e : "No conversion from " + prev + " to " + current | |
}; | |
} | |
} | |
} | |
} | |
} | |
} | |
return { state: "success", data: response }; | |
} | |
jQuery.extend({ | |
// Counter for holding the number of active queries | |
active: 0, | |
// Last-Modified header cache for next request | |
lastModified: {}, | |
etag: {}, | |
ajaxSettings: { | |
url: location.href, | |
type: "GET", | |
isLocal: rlocalProtocol.test(location.protocol), | |
global: true, | |
processData: true, | |
async: true, | |
contentType: "application/x-www-form-urlencoded; charset=UTF-8", | |
/* | |
timeout: 0, | |
data: null, | |
dataType: null, | |
username: null, | |
password: null, | |
cache: null, | |
throws: false, | |
traditional: false, | |
headers: {}, | |
*/ | |
accepts: { | |
"*": allTypes, | |
text: "text/plain", | |
html: "text/html", | |
xml: "application/xml, text/xml", | |
json: "application/json, text/javascript" | |
}, | |
contents: { | |
xml: /\bxml\b/, | |
html: /\bhtml/, | |
json: /\bjson\b/ | |
}, | |
responseFields: { | |
xml: "responseXML", | |
text: "responseText", | |
json: "responseJSON" | |
}, | |
// Data converters | |
// Keys separate source (or catchall "*") and destination types with a single space | |
converters: { | |
// Convert anything to text | |
"* text": String, | |
// Text to html (true = no transformation) | |
"text html": true, | |
// Evaluate text as a json expression | |
"text json": JSON.parse, | |
// Parse text as xml | |
"text xml": jQuery.parseXML | |
}, | |
// For options that shouldn't be deep extended: | |
// you can add your own custom options here if | |
// and when you create one that shouldn't be | |
// deep extended (see ajaxExtend) | |
flatOptions: { | |
url: true, | |
context: true | |
} | |
}, | |
// Creates a full fledged settings object into target | |
// with both ajaxSettings and settings fields. | |
// If target is omitted, writes into ajaxSettings. | |
ajaxSetup: function ajaxSetup(target, settings) { | |
return settings ? | |
// Building a settings object | |
ajaxExtend(ajaxExtend(target, jQuery.ajaxSettings), settings) : | |
// Extending ajaxSettings | |
ajaxExtend(jQuery.ajaxSettings, target); | |
}, | |
ajaxPrefilter: addToPrefiltersOrTransports(prefilters), | |
ajaxTransport: addToPrefiltersOrTransports(transports), | |
// Main method | |
ajax: function ajax(url, options) { | |
// If url is an object, simulate pre-1.5 signature | |
if ((typeof url === "undefined" ? "undefined" : _typeof(url)) === "object") { | |
options = url; | |
url = undefined; | |
} | |
// Force options to be an object | |
options = options || {}; | |
var transport, | |
// URL without anti-cache param | |
cacheURL, | |
// Response headers | |
responseHeadersString, | |
responseHeaders, | |
// timeout handle | |
timeoutTimer, | |
// Url cleanup var | |
urlAnchor, | |
// Request state (becomes false upon send and true upon completion) | |
completed, | |
// To know if global events are to be dispatched | |
fireGlobals, | |
// Loop variable | |
i, | |
// uncached part of the url | |
uncached, | |
// Create the final options object | |
s = jQuery.ajaxSetup({}, options), | |
// Callbacks context | |
callbackContext = s.context || s, | |
// Context for global events is callbackContext if it is a DOM node or jQuery collection | |
globalEventContext = s.context && (callbackContext.nodeType || callbackContext.jquery) ? jQuery(callbackContext) : jQuery.event, | |
// Deferreds | |
deferred = jQuery.Deferred(), | |
completeDeferred = jQuery.Callbacks("once memory"), | |
// Status-dependent callbacks | |
_statusCode = s.statusCode || {}, | |
// Headers (they are sent all at once) | |
requestHeaders = {}, | |
requestHeadersNames = {}, | |
// Default abort message | |
strAbort = "canceled", | |
// Fake xhr | |
jqXHR = { | |
readyState: 0, | |
// Builds headers hashtable if needed | |
getResponseHeader: function getResponseHeader(key) { | |
var match; | |
if (completed) { | |
if (!responseHeaders) { | |
responseHeaders = {}; | |
while (match = rheaders.exec(responseHeadersString)) { | |
responseHeaders[match[1].toLowerCase()] = match[2]; | |
} | |
} | |
match = responseHeaders[key.toLowerCase()]; | |
} | |
return match == null ? null : match; | |
}, | |
// Raw string | |
getAllResponseHeaders: function getAllResponseHeaders() { | |
return completed ? responseHeadersString : null; | |
}, | |
// Caches the header | |
setRequestHeader: function setRequestHeader(name, value) { | |
if (completed == null) { | |
name = requestHeadersNames[name.toLowerCase()] = requestHeadersNames[name.toLowerCase()] || name; | |
requestHeaders[name] = value; | |
} | |
return this; | |
}, | |
// Overrides response content-type header | |
overrideMimeType: function overrideMimeType(type) { | |
if (completed == null) { | |
s.mimeType = type; | |
} | |
return this; | |
}, | |
// Status-dependent callbacks | |
statusCode: function statusCode(map) { | |
var code; | |
if (map) { | |
if (completed) { | |
// Execute the appropriate callbacks | |
jqXHR.always(map[jqXHR.status]); | |
} else { | |
// Lazy-add the new callbacks in a way that preserves old ones | |
for (code in map) { | |
_statusCode[code] = [_statusCode[code], map[code]]; | |
} | |
} | |
} | |
return this; | |
}, | |
// Cancel the request | |
abort: function abort(statusText) { | |
var finalText = statusText || strAbort; | |
if (transport) { | |
transport.abort(finalText); | |
} | |
done(0, finalText); | |
return this; | |
} | |
}; | |
// Attach deferreds | |
deferred.promise(jqXHR); | |
// Add protocol if not provided (prefilters might expect it) | |
// Handle falsy url in the settings object (#10093: consistency with old signature) | |
// We also use the url parameter if available | |
s.url = ((url || s.url || location.href) + "").replace(rprotocol, location.protocol + "//"); | |
// Alias method option to type as per ticket #12004 | |
s.type = options.method || options.type || s.method || s.type; | |
// Extract dataTypes list | |
s.dataTypes = (s.dataType || "*").toLowerCase().match(rnothtmlwhite) || [""]; | |
// A cross-domain request is in order when the origin doesn't match the current origin. | |
if (s.crossDomain == null) { | |
urlAnchor = document.createElement("a"); | |
// Support: IE <=8 - 11, Edge 12 - 13 | |
// IE throws exception on accessing the href property if url is malformed, | |
// e.g. http://example.com:80x/ | |
try { | |
urlAnchor.href = s.url; | |
// Support: IE <=8 - 11 only | |
// Anchor's host property isn't correctly set when s.url is relative | |
urlAnchor.href = urlAnchor.href; | |
s.crossDomain = originAnchor.protocol + "//" + originAnchor.host !== urlAnchor.protocol + "//" + urlAnchor.host; | |
} catch (e) { | |
// If there is an error parsing the URL, assume it is crossDomain, | |
// it can be rejected by the transport if it is invalid | |
s.crossDomain = true; | |
} | |
} | |
// Convert data if not already a string | |
if (s.data && s.processData && typeof s.data !== "string") { | |
s.data = jQuery.param(s.data, s.traditional); | |
} | |
// Apply prefilters | |
inspectPrefiltersOrTransports(prefilters, s, options, jqXHR); | |
// If request was aborted inside a prefilter, stop there | |
if (completed) { | |
return jqXHR; | |
} | |
// We can fire global events as of now if asked to | |
// Don't fire events if jQuery.event is undefined in an AMD-usage scenario (#15118) | |
fireGlobals = jQuery.event && s.global; | |
// Watch for a new set of requests | |
if (fireGlobals && jQuery.active++ === 0) { | |
jQuery.event.trigger("ajaxStart"); | |
} | |
// Uppercase the type | |
s.type = s.type.toUpperCase(); | |
// Determine if request has content | |
s.hasContent = !rnoContent.test(s.type); | |
// Save the URL in case we're toying with the If-Modified-Since | |
// and/or If-None-Match header later on | |
// Remove hash to simplify url manipulation | |
cacheURL = s.url.replace(rhash, ""); | |
// More options handling for requests with no content | |
if (!s.hasContent) { | |
// Remember the hash so we can put it back | |
uncached = s.url.slice(cacheURL.length); | |
// If data is available, append data to url | |
if (s.data) { | |
cacheURL += (rquery.test(cacheURL) ? "&" : "?") + s.data; | |
// #9682: remove data so that it's not used in an eventual retry | |
delete s.data; | |
} | |
// Add or update anti-cache param if needed | |
if (s.cache === false) { | |
cacheURL = cacheURL.replace(rantiCache, "$1"); | |
uncached = (rquery.test(cacheURL) ? "&" : "?") + "_=" + nonce++ + uncached; | |
} | |
// Put hash and anti-cache on the URL that will be requested (gh-1732) | |
s.url = cacheURL + uncached; | |
// Change '%20' to '+' if this is encoded form body content (gh-2658) | |
} else if (s.data && s.processData && (s.contentType || "").indexOf("application/x-www-form-urlencoded") === 0) { | |
s.data = s.data.replace(r20, "+"); | |
} | |
// Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode. | |
if (s.ifModified) { | |
if (jQuery.lastModified[cacheURL]) { | |
jqXHR.setRequestHeader("If-Modified-Since", jQuery.lastModified[cacheURL]); | |
} | |
if (jQuery.etag[cacheURL]) { | |
jqXHR.setRequestHeader("If-None-Match", jQuery.etag[cacheURL]); | |
} | |
} | |
// Set the correct header, if data is being sent | |
if (s.data && s.hasContent && s.contentType !== false || options.contentType) { | |
jqXHR.setRequestHeader("Content-Type", s.contentType); | |
} | |
// Set the Accepts header for the server, depending on the dataType | |
jqXHR.setRequestHeader("Accept", s.dataTypes[0] && s.accepts[s.dataTypes[0]] ? s.accepts[s.dataTypes[0]] + (s.dataTypes[0] !== "*" ? ", " + allTypes + "; q=0.01" : "") : s.accepts["*"]); | |
// Check for headers option | |
for (i in s.headers) { | |
jqXHR.setRequestHeader(i, s.headers[i]); | |
} | |
// Allow custom headers/mimetypes and early abort | |
if (s.beforeSend && (s.beforeSend.call(callbackContext, jqXHR, s) === false || completed)) { | |
// Abort if not done already and return | |
return jqXHR.abort(); | |
} | |
// Aborting is no longer a cancellation | |
strAbort = "abort"; | |
// Install callbacks on deferreds | |
completeDeferred.add(s.complete); | |
jqXHR.done(s.success); | |
jqXHR.fail(s.error); | |
// Get transport | |
transport = inspectPrefiltersOrTransports(transports, s, options, jqXHR); | |
// If no transport, we auto-abort | |
if (!transport) { | |
done(-1, "No Transport"); | |
} else { | |
jqXHR.readyState = 1; | |
// Send global event | |
if (fireGlobals) { | |
globalEventContext.trigger("ajaxSend", [jqXHR, s]); | |
} | |
// If request was aborted inside ajaxSend, stop there | |
if (completed) { | |
return jqXHR; | |
} | |
// Timeout | |
if (s.async && s.timeout > 0) { | |
timeoutTimer = window.setTimeout(function () { | |
jqXHR.abort("timeout"); | |
}, s.timeout); | |
} | |
try { | |
completed = false; | |
transport.send(requestHeaders, done); | |
} catch (e) { | |
// Rethrow post-completion exceptions | |
if (completed) { | |
throw e; | |
} | |
// Propagate others as results | |
done(-1, e); | |
} | |
} | |
// Callback for when everything is done | |
function done(status, nativeStatusText, responses, headers) { | |
var isSuccess, | |
success, | |
error, | |
response, | |
modified, | |
statusText = nativeStatusText; | |
// Ignore repeat invocations | |
if (completed) { | |
return; | |
} | |
completed = true; | |
// Clear timeout if it exists | |
if (timeoutTimer) { | |
window.clearTimeout(timeoutTimer); | |
} | |
// Dereference transport for early garbage collection | |
// (no matter how long the jqXHR object will be used) | |
transport = undefined; | |
// Cache response headers | |
responseHeadersString = headers || ""; | |
// Set readyState | |
jqXHR.readyState = status > 0 ? 4 : 0; | |
// Determine if successful | |
isSuccess = status >= 200 && status < 300 || status === 304; | |
// Get response data | |
if (responses) { | |
response = ajaxHandleResponses(s, jqXHR, responses); | |
} | |
// Convert no matter what (that way responseXXX fields are always set) | |
response = ajaxConvert(s, response, jqXHR, isSuccess); | |
// If successful, handle type chaining | |
if (isSuccess) { | |
// Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode. | |
if (s.ifModified) { | |
modified = jqXHR.getResponseHeader("Last-Modified"); | |
if (modified) { | |
jQuery.lastModified[cacheURL] = modified; | |
} | |
modified = jqXHR.getResponseHeader("etag"); | |
if (modified) { | |
jQuery.etag[cacheURL] = modified; | |
} | |
} | |
// if no content | |
if (status === 204 || s.type === "HEAD") { | |
statusText = "nocontent"; | |
// if not modified | |
} else if (status === 304) { | |
statusText = "notmodified"; | |
// If we have data, let's convert it | |
} else { | |
statusText = response.state; | |
success = response.data; | |
error = response.error; | |
isSuccess = !error; | |
} | |
} else { | |
// Extract error from statusText and normalize for non-aborts | |
error = statusText; | |
if (status || !statusText) { | |
statusText = "error"; | |
if (status < 0) { | |
status = 0; | |
} | |
} | |
} | |
// Set data for the fake xhr object | |
jqXHR.status = status; | |
jqXHR.statusText = (nativeStatusText || statusText) + ""; | |
// Success/Error | |
if (isSuccess) { | |
deferred.resolveWith(callbackContext, [success, statusText, jqXHR]); | |
} else { | |
deferred.rejectWith(callbackContext, [jqXHR, statusText, error]); | |
} | |
// Status-dependent callbacks | |
jqXHR.statusCode(_statusCode); | |
_statusCode = undefined; | |
if (fireGlobals) { | |
globalEventContext.trigger(isSuccess ? "ajaxSuccess" : "ajaxError", [jqXHR, s, isSuccess ? success : error]); | |
} | |
// Complete | |
completeDeferred.fireWith(callbackContext, [jqXHR, statusText]); | |
if (fireGlobals) { | |
globalEventContext.trigger("ajaxComplete", [jqXHR, s]); | |
// Handle the global AJAX counter | |
if (! --jQuery.active) { | |
jQuery.event.trigger("ajaxStop"); | |
} | |
} | |
} | |
return jqXHR; | |
}, | |
getJSON: function getJSON(url, data, callback) { | |
return jQuery.get(url, data, callback, "json"); | |
}, | |
getScript: function getScript(url, callback) { | |
return jQuery.get(url, undefined, callback, "script"); | |
} | |
}); | |
jQuery.each(["get", "post"], function (i, method) { | |
jQuery[method] = function (url, data, callback, type) { | |
// Shift arguments if data argument was omitted | |
if (jQuery.isFunction(data)) { | |
type = type || callback; | |
callback = data; | |
data = undefined; | |
} | |
// The url can be an options object (which then must have .url) | |
return jQuery.ajax(jQuery.extend({ | |
url: url, | |
type: method, | |
dataType: type, | |
data: data, | |
success: callback | |
}, jQuery.isPlainObject(url) && url)); | |
}; | |
}); | |
jQuery._evalUrl = function (url) { | |
return jQuery.ajax({ | |
url: url, | |
// Make this explicit, since user can override this through ajaxSetup (#11264) | |
type: "GET", | |
dataType: "script", | |
cache: true, | |
async: false, | |
global: false, | |
"throws": true | |
}); | |
}; | |
jQuery.fn.extend({ | |
wrapAll: function wrapAll(html) { | |
var wrap; | |
if (this[0]) { | |
if (jQuery.isFunction(html)) { | |
html = html.call(this[0]); | |
} | |
// The elements to wrap the target around | |
wrap = jQuery(html, this[0].ownerDocument).eq(0).clone(true); | |
if (this[0].parentNode) { | |
wrap.insertBefore(this[0]); | |
} | |
wrap.map(function () { | |
var elem = this; | |
while (elem.firstElementChild) { | |
elem = elem.firstElementChild; | |
} | |
return elem; | |
}).append(this); | |
} | |
return this; | |
}, | |
wrapInner: function wrapInner(html) { | |
if (jQuery.isFunction(html)) { | |
return this.each(function (i) { | |
jQuery(this).wrapInner(html.call(this, i)); | |
}); | |
} | |
return this.each(function () { | |
var self = jQuery(this), | |
contents = self.contents(); | |
if (contents.length) { | |
contents.wrapAll(html); | |
} else { | |
self.append(html); | |
} | |
}); | |
}, | |
wrap: function wrap(html) { | |
var isFunction = jQuery.isFunction(html); | |
return this.each(function (i) { | |
jQuery(this).wrapAll(isFunction ? html.call(this, i) : html); | |
}); | |
}, | |
unwrap: function unwrap(selector) { | |
this.parent(selector).not("body").each(function () { | |
jQuery(this).replaceWith(this.childNodes); | |
}); | |
return this; | |
} | |
}); | |
jQuery.expr.pseudos.hidden = function (elem) { | |
return !jQuery.expr.pseudos.visible(elem); | |
}; | |
jQuery.expr.pseudos.visible = function (elem) { | |
return !!(elem.offsetWidth || elem.offsetHeight || elem.getClientRects().length); | |
}; | |
jQuery.ajaxSettings.xhr = function () { | |
try { | |
return new window.XMLHttpRequest(); | |
} catch (e) {} | |
}; | |
var xhrSuccessStatus = { | |
// File protocol always yields status code 0, assume 200 | |
0: 200, | |
// Support: IE <=9 only | |
// #1450: sometimes IE returns 1223 when it should be 204 | |
1223: 204 | |
}, | |
xhrSupported = jQuery.ajaxSettings.xhr(); | |
support.cors = !!xhrSupported && "withCredentials" in xhrSupported; | |
support.ajax = xhrSupported = !!xhrSupported; | |
jQuery.ajaxTransport(function (options) { | |
var _callback, errorCallback; | |
// Cross domain only allowed if supported through XMLHttpRequest | |
if (support.cors || xhrSupported && !options.crossDomain) { | |
return { | |
send: function send(headers, complete) { | |
var i, | |
xhr = options.xhr(); | |
xhr.open(options.type, options.url, options.async, options.username, options.password); | |
// Apply custom fields if provided | |
if (options.xhrFields) { | |
for (i in options.xhrFields) { | |
xhr[i] = options.xhrFields[i]; | |
} | |
} | |
// Override mime type if needed | |
if (options.mimeType && xhr.overrideMimeType) { | |
xhr.overrideMimeType(options.mimeType); | |
} | |
// X-Requested-With header | |
// For cross-domain requests, seeing as conditions for a preflight are | |
// akin to a jigsaw puzzle, we simply never set it to be sure. | |
// (it can always be set on a per-request basis or even using ajaxSetup) | |
// For same-domain requests, won't change header if already provided. | |
if (!options.crossDomain && !headers["X-Requested-With"]) { | |
headers["X-Requested-With"] = "XMLHttpRequest"; | |
} | |
// Set headers | |
for (i in headers) { | |
xhr.setRequestHeader(i, headers[i]); | |
} | |
// Callback | |
_callback = function callback(type) { | |
return function () { | |
if (_callback) { | |
_callback = errorCallback = xhr.onload = xhr.onerror = xhr.onabort = xhr.onreadystatechange = null; | |
if (type === "abort") { | |
xhr.abort(); | |
} else if (type === "error") { | |
// Support: IE <=9 only | |
// On a manual native abort, IE9 throws | |
// errors on any property access that is not readyState | |
if (typeof xhr.status !== "number") { | |
complete(0, "error"); | |
} else { | |
complete( | |
// File: protocol always yields status 0; see #8605, #14207 | |
xhr.status, xhr.statusText); | |
} | |
} else { | |
complete(xhrSuccessStatus[xhr.status] || xhr.status, xhr.statusText, | |
// Support: IE <=9 only | |
// IE9 has no XHR2 but throws on binary (trac-11426) | |
// For XHR2 non-text, let the caller handle it (gh-2498) | |
(xhr.responseType || "text") !== "text" || typeof xhr.responseText !== "string" ? { binary: xhr.response } : { text: xhr.responseText }, xhr.getAllResponseHeaders()); | |
} | |
} | |
}; | |
}; | |
// Listen to events | |
xhr.onload = _callback(); | |
errorCallback = xhr.onerror = _callback("error"); | |
// Support: IE 9 only | |
// Use onreadystatechange to replace onabort | |
// to handle uncaught aborts | |
if (xhr.onabort !== undefined) { | |
xhr.onabort = errorCallback; | |
} else { | |
xhr.onreadystatechange = function () { | |
// Check readyState before timeout as it changes | |
if (xhr.readyState === 4) { | |
// Allow onerror to be called first, | |
// but that will not handle a native abort | |
// Also, save errorCallback to a variable | |
// as xhr.onerror cannot be accessed | |
window.setTimeout(function () { | |
if (_callback) { | |
errorCallback(); | |
} | |
}); | |
} | |
}; | |
} | |
// Create the abort callback | |
_callback = _callback("abort"); | |
try { | |
// Do send the request (this may raise an exception) | |
xhr.send(options.hasContent && options.data || null); | |
} catch (e) { | |
// #14683: Only rethrow if this hasn't been notified as an error yet | |
if (_callback) { | |
throw e; | |
} | |
} | |
}, | |
abort: function abort() { | |
if (_callback) { | |
_callback(); | |
} | |
} | |
}; | |
} | |
}); | |
// Prevent auto-execution of scripts when no explicit dataType was provided (See gh-2432) | |
jQuery.ajaxPrefilter(function (s) { | |
if (s.crossDomain) { | |
s.contents.script = false; | |
} | |
}); | |
// Install script dataType | |
jQuery.ajaxSetup({ | |
accepts: { | |
script: "text/javascript, application/javascript, " + "application/ecmascript, application/x-ecmascript" | |
}, | |
contents: { | |
script: /\b(?:java|ecma)script\b/ | |
}, | |
converters: { | |
"text script": function textScript(text) { | |
jQuery.globalEval(text); | |
return text; | |
} | |
} | |
}); | |
// Handle cache's special case and crossDomain | |
jQuery.ajaxPrefilter("script", function (s) { | |
if (s.cache === undefined) { | |
s.cache = false; | |
} | |
if (s.crossDomain) { | |
s.type = "GET"; | |
} | |
}); | |
// Bind script tag hack transport | |
jQuery.ajaxTransport("script", function (s) { | |
// This transport only deals with cross domain requests | |
if (s.crossDomain) { | |
var script, _callback2; | |
return { | |
send: function send(_, complete) { | |
script = jQuery("<script>").prop({ | |
charset: s.scriptCharset, | |
src: s.url | |
}).on("load error", _callback2 = function callback(evt) { | |
script.remove(); | |
_callback2 = null; | |
if (evt) { | |
complete(evt.type === "error" ? 404 : 200, evt.type); | |
} | |
}); | |
// Use native DOM manipulation to avoid our domManip AJAX trickery | |
document.head.appendChild(script[0]); | |
}, | |
abort: function abort() { | |
if (_callback2) { | |
_callback2(); | |
} | |
} | |
}; | |
} | |
}); | |
var oldCallbacks = [], | |
rjsonp = /(=)\?(?=&|$)|\?\?/; | |
// Default jsonp settings | |
jQuery.ajaxSetup({ | |
jsonp: "callback", | |
jsonpCallback: function jsonpCallback() { | |
var callback = oldCallbacks.pop() || jQuery.expando + "_" + nonce++; | |
this[callback] = true; | |
return callback; | |
} | |
}); | |
// Detect, normalize options and install callbacks for jsonp requests | |
jQuery.ajaxPrefilter("json jsonp", function (s, originalSettings, jqXHR) { | |
var callbackName, | |
overwritten, | |
responseContainer, | |
jsonProp = s.jsonp !== false && (rjsonp.test(s.url) ? "url" : typeof s.data === "string" && (s.contentType || "").indexOf("application/x-www-form-urlencoded") === 0 && rjsonp.test(s.data) && "data"); | |
// Handle iff the expected data type is "jsonp" or we have a parameter to set | |
if (jsonProp || s.dataTypes[0] === "jsonp") { | |
// Get callback name, remembering preexisting value associated with it | |
callbackName = s.jsonpCallback = jQuery.isFunction(s.jsonpCallback) ? s.jsonpCallback() : s.jsonpCallback; | |
// Insert callback into url or form data | |
if (jsonProp) { | |
s[jsonProp] = s[jsonProp].replace(rjsonp, "$1" + callbackName); | |
} else if (s.jsonp !== false) { | |
s.url += (rquery.test(s.url) ? "&" : "?") + s.jsonp + "=" + callbackName; | |
} | |
// Use data converter to retrieve json after script execution | |
s.converters["script json"] = function () { | |
if (!responseContainer) { | |
jQuery.error(callbackName + " was not called"); | |
} | |
return responseContainer[0]; | |
}; | |
// Force json dataType | |
s.dataTypes[0] = "json"; | |
// Install callback | |
overwritten = window[callbackName]; | |
window[callbackName] = function () { | |
responseContainer = arguments; | |
}; | |
// Clean-up function (fires after converters) | |
jqXHR.always(function () { | |
// If previous value didn't exist - remove it | |
if (overwritten === undefined) { | |
jQuery(window).removeProp(callbackName); | |
// Otherwise restore preexisting value | |
} else { | |
window[callbackName] = overwritten; | |
} | |
// Save back as free | |
if (s[callbackName]) { | |
// Make sure that re-using the options doesn't screw things around | |
s.jsonpCallback = originalSettings.jsonpCallback; | |
// Save the callback name for future use | |
oldCallbacks.push(callbackName); | |
} | |
// Call if it was a function and we have a response | |
if (responseContainer && jQuery.isFunction(overwritten)) { | |
overwritten(responseContainer[0]); | |
} | |
responseContainer = overwritten = undefined; | |
}); | |
// Delegate to script | |
return "script"; | |
} | |
}); | |
// Support: Safari 8 only | |
// In Safari 8 documents created via document.implementation.createHTMLDocument | |
// collapse sibling forms: the second one becomes a child of the first one. | |
// Because of that, this security measure has to be disabled in Safari 8. | |
// https://bugs.webkit.org/show_bug.cgi?id=137337 | |
support.createHTMLDocument = function () { | |
var body = document.implementation.createHTMLDocument("").body; | |
body.innerHTML = "<form></form><form></form>"; | |
return body.childNodes.length === 2; | |
}(); | |
// Argument "data" should be string of html | |
// context (optional): If specified, the fragment will be created in this context, | |
// defaults to document | |
// keepScripts (optional): If true, will include scripts passed in the html string | |
jQuery.parseHTML = function (data, context, keepScripts) { | |
if (typeof data !== "string") { | |
return []; | |
} | |
if (typeof context === "boolean") { | |
keepScripts = context; | |
context = false; | |
} | |
var base, parsed, scripts; | |
if (!context) { | |
// Stop scripts or inline event handlers from being executed immediately | |
// by using document.implementation | |
if (support.createHTMLDocument) { | |
context = document.implementation.createHTMLDocument(""); | |
// Set the base href for the created document | |
// so any parsed elements with URLs | |
// are based on the document's URL (gh-2965) | |
base = context.createElement("base"); | |
base.href = document.location.href; | |
context.head.appendChild(base); | |
} else { | |
context = document; | |
} | |
} | |
parsed = rsingleTag.exec(data); | |
scripts = !keepScripts && []; | |
// Single tag | |
if (parsed) { | |
return [context.createElement(parsed[1])]; | |
} | |
parsed = buildFragment([data], context, scripts); | |
if (scripts && scripts.length) { | |
jQuery(scripts).remove(); | |
} | |
return jQuery.merge([], parsed.childNodes); | |
}; | |
/** | |
* Load a url into a page | |
*/ | |
jQuery.fn.load = function (url, params, callback) { | |
var selector, | |
type, | |
response, | |
self = this, | |
off = url.indexOf(" "); | |
if (off > -1) { | |
selector = stripAndCollapse(url.slice(off)); | |
url = url.slice(0, off); | |
} | |
// If it's a function | |
if (jQuery.isFunction(params)) { | |
// We assume that it's the callback | |
callback = params; | |
params = undefined; | |
// Otherwise, build a param string | |
} else if (params && (typeof params === "undefined" ? "undefined" : _typeof(params)) === "object") { | |
type = "POST"; | |
} | |
// If we have elements to modify, make the request | |
if (self.length > 0) { | |
jQuery.ajax({ | |
url: url, | |
// If "type" variable is undefined, then "GET" method will be used. | |
// Make value of this field explicit since | |
// user can override it through ajaxSetup method | |
type: type || "GET", | |
dataType: "html", | |
data: params | |
}).done(function (responseText) { | |
// Save response for use in complete callback | |
response = arguments; | |
self.html(selector ? | |
// If a selector was specified, locate the right elements in a dummy div | |
// Exclude scripts to avoid IE 'Permission Denied' errors | |
jQuery("<div>").append(jQuery.parseHTML(responseText)).find(selector) : | |
// Otherwise use the full result | |
responseText); | |
// If the request succeeds, this function gets "data", "status", "jqXHR" | |
// but they are ignored because response was set above. | |
// If it fails, this function gets "jqXHR", "status", "error" | |
}).always(callback && function (jqXHR, status) { | |
self.each(function () { | |
callback.apply(this, response || [jqXHR.responseText, status, jqXHR]); | |
}); | |
}); | |
} | |
return this; | |
}; | |
// Attach a bunch of functions for handling common AJAX events | |
jQuery.each(["ajaxStart", "ajaxStop", "ajaxComplete", "ajaxError", "ajaxSuccess", "ajaxSend"], function (i, type) { | |
jQuery.fn[type] = function (fn) { | |
return this.on(type, fn); | |
}; | |
}); | |
jQuery.expr.pseudos.animated = function (elem) { | |
return jQuery.grep(jQuery.timers, function (fn) { | |
return elem === fn.elem; | |
}).length; | |
}; | |
jQuery.offset = { | |
setOffset: function setOffset(elem, options, i) { | |
var curPosition, | |
curLeft, | |
curCSSTop, | |
curTop, | |
curOffset, | |
curCSSLeft, | |
calculatePosition, | |
position = jQuery.css(elem, "position"), | |
curElem = jQuery(elem), | |
props = {}; | |
// Set position first, in-case top/left are set even on static elem | |
if (position === "static") { | |
elem.style.position = "relative"; | |
} | |
curOffset = curElem.offset(); | |
curCSSTop = jQuery.css(elem, "top"); | |
curCSSLeft = jQuery.css(elem, "left"); | |
calculatePosition = (position === "absolute" || position === "fixed") && (curCSSTop + curCSSLeft).indexOf("auto") > -1; | |
// Need to be able to calculate position if either | |
// top or left is auto and position is either absolute or fixed | |
if (calculatePosition) { | |
curPosition = curElem.position(); | |
curTop = curPosition.top; | |
curLeft = curPosition.left; | |
} else { | |
curTop = parseFloat(curCSSTop) || 0; | |
curLeft = parseFloat(curCSSLeft) || 0; | |
} | |
if (jQuery.isFunction(options)) { | |
// Use jQuery.extend here to allow modification of coordinates argument (gh-1848) | |
options = options.call(elem, i, jQuery.extend({}, curOffset)); | |
} | |
if (options.top != null) { | |
props.top = options.top - curOffset.top + curTop; | |
} | |
if (options.left != null) { | |
props.left = options.left - curOffset.left + curLeft; | |
} | |
if ("using" in options) { | |
options.using.call(elem, props); | |
} else { | |
curElem.css(props); | |
} | |
} | |
}; | |
jQuery.fn.extend({ | |
offset: function offset(options) { | |
// Preserve chaining for setter | |
if (arguments.length) { | |
return options === undefined ? this : this.each(function (i) { | |
jQuery.offset.setOffset(this, options, i); | |
}); | |
} | |
var doc, | |
docElem, | |
rect, | |
win, | |
elem = this[0]; | |
if (!elem) { | |
return; | |
} | |
// Return zeros for disconnected and hidden (display: none) elements (gh-2310) | |
// Support: IE <=11 only | |
// Running getBoundingClientRect on a | |
// disconnected node in IE throws an error | |
if (!elem.getClientRects().length) { | |
return { top: 0, left: 0 }; | |
} | |
rect = elem.getBoundingClientRect(); | |
doc = elem.ownerDocument; | |
docElem = doc.documentElement; | |
win = doc.defaultView; | |
return { | |
top: rect.top + win.pageYOffset - docElem.clientTop, | |
left: rect.left + win.pageXOffset - docElem.clientLeft | |
}; | |
}, | |
position: function position() { | |
if (!this[0]) { | |
return; | |
} | |
var offsetParent, | |
offset, | |
elem = this[0], | |
parentOffset = { top: 0, left: 0 }; | |
// Fixed elements are offset from window (parentOffset = {top:0, left: 0}, | |
// because it is its only offset parent | |
if (jQuery.css(elem, "position") === "fixed") { | |
// Assume getBoundingClientRect is there when computed position is fixed | |
offset = elem.getBoundingClientRect(); | |
} else { | |
// Get *real* offsetParent | |
offsetParent = this.offsetParent(); | |
// Get correct offsets | |
offset = this.offset(); | |
if (!nodeName(offsetParent[0], "html")) { | |
parentOffset = offsetParent.offset(); | |
} | |
// Add offsetParent borders | |
parentOffset = { | |
top: parentOffset.top + jQuery.css(offsetParent[0], "borderTopWidth", true), | |
left: parentOffset.left + jQuery.css(offsetParent[0], "borderLeftWidth", true) | |
}; | |
} | |
// Subtract parent offsets and element margins | |
return { | |
top: offset.top - parentOffset.top - jQuery.css(elem, "marginTop", true), | |
left: offset.left - parentOffset.left - jQuery.css(elem, "marginLeft", true) | |
}; | |
}, | |
// This method will return documentElement in the following cases: | |
// 1) For the element inside the iframe without offsetParent, this method will return | |
// documentElement of the parent window | |
// 2) For the hidden or detached element | |
// 3) For body or html element, i.e. in case of the html node - it will return itself | |
// | |
// but those exceptions were never presented as a real life use-cases | |
// and might be considered as more preferable results. | |
// | |
// This logic, however, is not guaranteed and can change at any point in the future | |
offsetParent: function offsetParent() { | |
return this.map(function () { | |
var offsetParent = this.offsetParent; | |
while (offsetParent && jQuery.css(offsetParent, "position") === "static") { | |
offsetParent = offsetParent.offsetParent; | |
} | |
return offsetParent || documentElement; | |
}); | |
} | |
}); | |
// Create scrollLeft and scrollTop methods | |
jQuery.each({ scrollLeft: "pageXOffset", scrollTop: "pageYOffset" }, function (method, prop) { | |
var top = "pageYOffset" === prop; | |
jQuery.fn[method] = function (val) { | |
return access(this, function (elem, method, val) { | |
// Coalesce documents and windows | |
var win; | |
if (jQuery.isWindow(elem)) { | |
win = elem; | |
} else if (elem.nodeType === 9) { | |
win = elem.defaultView; | |
} | |
if (val === undefined) { | |
return win ? win[prop] : elem[method]; | |
} | |
if (win) { | |
win.scrollTo(!top ? val : win.pageXOffset, top ? val : win.pageYOffset); | |
} else { | |
elem[method] = val; | |
} | |
}, method, val, arguments.length); | |
}; | |
}); | |
// Support: Safari <=7 - 9.1, Chrome <=37 - 49 | |
// Add the top/left cssHooks using jQuery.fn.position | |
// Webkit bug: https://bugs.webkit.org/show_bug.cgi?id=29084 | |
// Blink bug: https://bugs.chromium.org/p/chromium/issues/detail?id=589347 | |
// getComputedStyle returns percent when specified for top/left/bottom/right; | |
// rather than make the css module depend on the offset module, just check for it here | |
jQuery.each(["top", "left"], function (i, prop) { | |
jQuery.cssHooks[prop] = addGetHookIf(support.pixelPosition, function (elem, computed) { | |
if (computed) { | |
computed = curCSS(elem, prop); | |
// If curCSS returns percentage, fallback to offset | |
return rnumnonpx.test(computed) ? jQuery(elem).position()[prop] + "px" : computed; | |
} | |
}); | |
}); | |
// Create innerHeight, innerWidth, height, width, outerHeight and outerWidth methods | |
jQuery.each({ Height: "height", Width: "width" }, function (name, type) { | |
jQuery.each({ padding: "inner" + name, content: type, "": "outer" + name }, function (defaultExtra, funcName) { | |
// Margin is only for outerHeight, outerWidth | |
jQuery.fn[funcName] = function (margin, value) { | |
var chainable = arguments.length && (defaultExtra || typeof margin !== "boolean"), | |
extra = defaultExtra || (margin === true || value === true ? "margin" : "border"); | |
return access(this, function (elem, type, value) { | |
var doc; | |
if (jQuery.isWindow(elem)) { | |
// $( window ).outerWidth/Height return w/h including scrollbars (gh-1729) | |
return funcName.indexOf("outer") === 0 ? elem["inner" + name] : elem.document.documentElement["client" + name]; | |
} | |
// Get document width or height | |
if (elem.nodeType === 9) { | |
doc = elem.documentElement; | |
// Either scroll[Width/Height] or offset[Width/Height] or client[Width/Height], | |
// whichever is greatest | |
return Math.max(elem.body["scroll" + name], doc["scroll" + name], elem.body["offset" + name], doc["offset" + name], doc["client" + name]); | |
} | |
return value === undefined ? | |
// Get width or height on the element, requesting but not forcing parseFloat | |
jQuery.css(elem, type, extra) : | |
// Set width or height on the element | |
jQuery.style(elem, type, value, extra); | |
}, type, chainable ? margin : undefined, chainable); | |
}; | |
}); | |
}); | |
jQuery.fn.extend({ | |
bind: function bind(types, data, fn) { | |
return this.on(types, null, data, fn); | |
}, | |
unbind: function unbind(types, fn) { | |
return this.off(types, null, fn); | |
}, | |
delegate: function delegate(selector, types, data, fn) { | |
return this.on(types, selector, data, fn); | |
}, | |
undelegate: function undelegate(selector, types, fn) { | |
// ( namespace ) or ( selector, types [, fn] ) | |
return arguments.length === 1 ? this.off(selector, "**") : this.off(types, selector || "**", fn); | |
} | |
}); | |
jQuery.holdReady = function (hold) { | |
if (hold) { | |
jQuery.readyWait++; | |
} else { | |
jQuery.ready(true); | |
} | |
}; | |
jQuery.isArray = Array.isArray; | |
jQuery.parseJSON = JSON.parse; | |
jQuery.nodeName = nodeName; | |
// Register as a named AMD module, since jQuery can be concatenated with other | |
// files that may use define, but not via a proper concatenation script that | |
// understands anonymous AMD modules. A named AMD is safest and most robust | |
// way to register. Lowercase jquery is used because AMD module names are | |
// derived from file names, and jQuery is normally delivered in a lowercase | |
// file name. Do this after creating the global so that if an AMD module wants | |
// to call noConflict to hide this version of jQuery, it will work. | |
// Note that for maximum portability, libraries that are not jQuery should | |
// declare themselves as anonymous modules, and avoid setting a global if an | |
// AMD loader is present. jQuery is a special case. For more information, see | |
// https://github.com/jrburke/requirejs/wiki/Updating-existing-libraries#wiki-anon | |
if (true) { | |
!(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_RESULT__ = function () { | |
return jQuery; | |
}.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), | |
__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)); | |
} | |
var | |
// Map over jQuery in case of overwrite | |
_jQuery = window.jQuery, | |
// Map over the $ in case of overwrite | |
_$ = window.$; | |
jQuery.noConflict = function (deep) { | |
if (window.$ === jQuery) { | |
window.$ = _$; | |
} | |
if (deep && window.jQuery === jQuery) { | |
window.jQuery = _jQuery; | |
} | |
return jQuery; | |
}; | |
// Expose jQuery and $ identifiers, even in AMD | |
// (#7102#comment:10, https://github.com/jquery/jquery/pull/557) | |
// and CommonJS for browser emulators (#13566) | |
if (!noGlobal) { | |
window.jQuery = window.$ = jQuery; | |
} | |
return jQuery; | |
}); | |
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(395)(module))) | |
/***/ }), | |
/* 29 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
"use strict"; | |
/* WEBPACK VAR INJECTION */(function(process) {/** | |
* Copyright 2013-present, Facebook, Inc. | |
* All rights reserved. | |
* | |
* This source code is licensed under the BSD-style license found in the | |
* LICENSE file in the root directory of this source tree. An additional grant | |
* of patent rights can be found in the PATENTS file in the same directory. | |
* | |
* | |
*/ | |
var _prodInvariant = __webpack_require__(3); | |
var invariant = __webpack_require__(1); | |
/** | |
* Injectable ordering of event plugins. | |
*/ | |
var eventPluginOrder = null; | |
/** | |
* Injectable mapping from names to event plugin modules. | |
*/ | |
var namesToPlugins = {}; | |
/** | |
* Recomputes the plugin list using the injected plugins and plugin ordering. | |
* | |
* @private | |
*/ | |
function recomputePluginOrdering() { | |
if (!eventPluginOrder) { | |
// Wait until an `eventPluginOrder` is injected. | |
return; | |
} | |
for (var pluginName in namesToPlugins) { | |
var pluginModule = namesToPlugins[pluginName]; | |
var pluginIndex = eventPluginOrder.indexOf(pluginName); | |
!(pluginIndex > -1) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'EventPluginRegistry: Cannot inject event plugins that do not exist in the plugin ordering, `%s`.', pluginName) : _prodInvariant('96', pluginName) : void 0; | |
if (EventPluginRegistry.plugins[pluginIndex]) { | |
continue; | |
} | |
!pluginModule.extractEvents ? process.env.NODE_ENV !== 'production' ? invariant(false, 'EventPluginRegistry: Event plugins must implement an `extractEvents` method, but `%s` does not.', pluginName) : _prodInvariant('97', pluginName) : void 0; | |
EventPluginRegistry.plugins[pluginIndex] = pluginModule; | |
var publishedEvents = pluginModule.eventTypes; | |
for (var eventName in publishedEvents) { | |
!publishEventForPlugin(publishedEvents[eventName], pluginModule, eventName) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'EventPluginRegistry: Failed to publish event `%s` for plugin `%s`.', eventName, pluginName) : _prodInvariant('98', eventName, pluginName) : void 0; | |
} | |
} | |
} | |
/** | |
* Publishes an event so that it can be dispatched by the supplied plugin. | |
* | |
* @param {object} dispatchConfig Dispatch configuration for the event. | |
* @param {object} PluginModule Plugin publishing the event. | |
* @return {boolean} True if the event was successfully published. | |
* @private | |
*/ | |
function publishEventForPlugin(dispatchConfig, pluginModule, eventName) { | |
!!EventPluginRegistry.eventNameDispatchConfigs.hasOwnProperty(eventName) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'EventPluginHub: More than one plugin attempted to publish the same event name, `%s`.', eventName) : _prodInvariant('99', eventName) : void 0; | |
EventPluginRegistry.eventNameDispatchConfigs[eventName] = dispatchConfig; | |
var phasedRegistrationNames = dispatchConfig.phasedRegistrationNames; | |
if (phasedRegistrationNames) { | |
for (var phaseName in phasedRegistrationNames) { | |
if (phasedRegistrationNames.hasOwnProperty(phaseName)) { | |
var phasedRegistrationName = phasedRegistrationNames[phaseName]; | |
publishRegistrationName(phasedRegistrationName, pluginModule, eventName); | |
} | |
} | |
return true; | |
} else if (dispatchConfig.registrationName) { | |
publishRegistrationName(dispatchConfig.registrationName, pluginModule, eventName); | |
return true; | |
} | |
return false; | |
} | |
/** | |
* Publishes a registration name that is used to identify dispatched events and | |
* can be used with `EventPluginHub.putListener` to register listeners. | |
* | |
* @param {string} registrationName Registration name to add. | |
* @param {object} PluginModule Plugin publishing the event. | |
* @private | |
*/ | |
function publishRegistrationName(registrationName, pluginModule, eventName) { | |
!!EventPluginRegistry.registrationNameModules[registrationName] ? process.env.NODE_ENV !== 'production' ? invariant(false, 'EventPluginHub: More than one plugin attempted to publish the same registration name, `%s`.', registrationName) : _prodInvariant('100', registrationName) : void 0; | |
EventPluginRegistry.registrationNameModules[registrationName] = pluginModule; | |
EventPluginRegistry.registrationNameDependencies[registrationName] = pluginModule.eventTypes[eventName].dependencies; | |
if (process.env.NODE_ENV !== 'production') { | |
var lowerCasedName = registrationName.toLowerCase(); | |
EventPluginRegistry.possibleRegistrationNames[lowerCasedName] = registrationName; | |
if (registrationName === 'onDoubleClick') { | |
EventPluginRegistry.possibleRegistrationNames.ondblclick = registrationName; | |
} | |
} | |
} | |
/** | |
* Registers plugins so that they can extract and dispatch events. | |
* | |
* @see {EventPluginHub} | |
*/ | |
var EventPluginRegistry = { | |
/** | |
* Ordered list of injected plugins. | |
*/ | |
plugins: [], | |
/** | |
* Mapping from event name to dispatch config | |
*/ | |
eventNameDispatchConfigs: {}, | |
/** | |
* Mapping from registration name to plugin module | |
*/ | |
registrationNameModules: {}, | |
/** | |
* Mapping from registration name to event name | |
*/ | |
registrationNameDependencies: {}, | |
/** | |
* Mapping from lowercase registration names to the properly cased version, | |
* used to warn in the case of missing event handlers. Available | |
* only in __DEV__. | |
* @type {Object} | |
*/ | |
possibleRegistrationNames: process.env.NODE_ENV !== 'production' ? {} : null, | |
// Trust the developer to only use possibleRegistrationNames in __DEV__ | |
/** | |
* Injects an ordering of plugins (by plugin name). This allows the ordering | |
* to be decoupled from injection of the actual plugins so that ordering is | |
* always deterministic regardless of packaging, on-the-fly injection, etc. | |
* | |
* @param {array} InjectedEventPluginOrder | |
* @internal | |
* @see {EventPluginHub.injection.injectEventPluginOrder} | |
*/ | |
injectEventPluginOrder: function injectEventPluginOrder(injectedEventPluginOrder) { | |
!!eventPluginOrder ? process.env.NODE_ENV !== 'production' ? invariant(false, 'EventPluginRegistry: Cannot inject event plugin ordering more than once. You are likely trying to load more than one copy of React.') : _prodInvariant('101') : void 0; | |
// Clone the ordering so it cannot be dynamically mutated. | |
eventPluginOrder = Array.prototype.slice.call(injectedEventPluginOrder); | |
recomputePluginOrdering(); | |
}, | |
/** | |
* Injects plugins to be used by `EventPluginHub`. The plugin names must be | |
* in the ordering injected by `injectEventPluginOrder`. | |
* | |
* Plugins can be injected as part of page initialization or on-the-fly. | |
* | |
* @param {object} injectedNamesToPlugins Map from names to plugin modules. | |
* @internal | |
* @see {EventPluginHub.injection.injectEventPluginsByName} | |
*/ | |
injectEventPluginsByName: function injectEventPluginsByName(injectedNamesToPlugins) { | |
var isOrderingDirty = false; | |
for (var pluginName in injectedNamesToPlugins) { | |
if (!injectedNamesToPlugins.hasOwnProperty(pluginName)) { | |
continue; | |
} | |
var pluginModule = injectedNamesToPlugins[pluginName]; | |
if (!namesToPlugins.hasOwnProperty(pluginName) || namesToPlugins[pluginName] !== pluginModule) { | |
!!namesToPlugins[pluginName] ? process.env.NODE_ENV !== 'production' ? invariant(false, 'EventPluginRegistry: Cannot inject two different event plugins using the same name, `%s`.', pluginName) : _prodInvariant('102', pluginName) : void 0; | |
namesToPlugins[pluginName] = pluginModule; | |
isOrderingDirty = true; | |
} | |
} | |
if (isOrderingDirty) { | |
recomputePluginOrdering(); | |
} | |
}, | |
/** | |
* Looks up the plugin for the supplied event. | |
* | |
* @param {object} event A synthetic event. | |
* @return {?object} The plugin that created the supplied event. | |
* @internal | |
*/ | |
getPluginModuleForEvent: function getPluginModuleForEvent(event) { | |
var dispatchConfig = event.dispatchConfig; | |
if (dispatchConfig.registrationName) { | |
return EventPluginRegistry.registrationNameModules[dispatchConfig.registrationName] || null; | |
} | |
if (dispatchConfig.phasedRegistrationNames !== undefined) { | |
// pulling phasedRegistrationNames out of dispatchConfig helps Flow see | |
// that it is not undefined. | |
var phasedRegistrationNames = dispatchConfig.phasedRegistrationNames; | |
for (var phase in phasedRegistrationNames) { | |
if (!phasedRegistrationNames.hasOwnProperty(phase)) { | |
continue; | |
} | |
var pluginModule = EventPluginRegistry.registrationNameModules[phasedRegistrationNames[phase]]; | |
if (pluginModule) { | |
return pluginModule; | |
} | |
} | |
} | |
return null; | |
}, | |
/** | |
* Exposed for unit testing. | |
* @private | |
*/ | |
_resetEventPlugins: function _resetEventPlugins() { | |
eventPluginOrder = null; | |
for (var pluginName in namesToPlugins) { | |
if (namesToPlugins.hasOwnProperty(pluginName)) { | |
delete namesToPlugins[pluginName]; | |
} | |
} | |
EventPluginRegistry.plugins.length = 0; | |
var eventNameDispatchConfigs = EventPluginRegistry.eventNameDispatchConfigs; | |
for (var eventName in eventNameDispatchConfigs) { | |
if (eventNameDispatchConfigs.hasOwnProperty(eventName)) { | |
delete eventNameDispatchConfigs[eventName]; | |
} | |
} | |
var registrationNameModules = EventPluginRegistry.registrationNameModules; | |
for (var registrationName in registrationNameModules) { | |
if (registrationNameModules.hasOwnProperty(registrationName)) { | |
delete registrationNameModules[registrationName]; | |
} | |
} | |
if (process.env.NODE_ENV !== 'production') { | |
var possibleRegistrationNames = EventPluginRegistry.possibleRegistrationNames; | |
for (var lowerCasedName in possibleRegistrationNames) { | |
if (possibleRegistrationNames.hasOwnProperty(lowerCasedName)) { | |
delete possibleRegistrationNames[lowerCasedName]; | |
} | |
} | |
} | |
} | |
}; | |
module.exports = EventPluginRegistry; | |
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0))) | |
/***/ }), | |
/* 30 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
"use strict"; | |
/** | |
* Copyright 2013-present, Facebook, Inc. | |
* All rights reserved. | |
* | |
* This source code is licensed under the BSD-style license found in the | |
* LICENSE file in the root directory of this source tree. An additional grant | |
* of patent rights can be found in the PATENTS file in the same directory. | |
* | |
*/ | |
var _assign = __webpack_require__(4); | |
var EventPluginRegistry = __webpack_require__(29); | |
var ReactEventEmitterMixin = __webpack_require__(340); | |
var ViewportMetrics = __webpack_require__(74); | |
var getVendorPrefixedEventName = __webpack_require__(375); | |
var isEventSupported = __webpack_require__(51); | |
/** | |
* Summary of `ReactBrowserEventEmitter` event handling: | |
* | |
* - Top-level delegation is used to trap most native browser events. This | |
* may only occur in the main thread and is the responsibility of | |
* ReactEventListener, which is injected and can therefore support pluggable | |
* event sources. This is the only work that occurs in the main thread. | |
* | |
* - We normalize and de-duplicate events to account for browser quirks. This | |
* may be done in the worker thread. | |
* | |
* - Forward these native events (with the associated top-level type used to | |
* trap it) to `EventPluginHub`, which in turn will ask plugins if they want | |
* to extract any synthetic events. | |
* | |
* - The `EventPluginHub` will then process each event by annotating them with | |
* "dispatches", a sequence of listeners and IDs that care about that event. | |
* | |
* - The `EventPluginHub` then dispatches the events. | |
* | |
* Overview of React and the event system: | |
* | |
* +------------+ . | |
* | DOM | . | |
* +------------+ . | |
* | . | |
* v . | |
* +------------+ . | |
* | ReactEvent | . | |
* | Listener | . | |
* +------------+ . +-----------+ | |
* | . +--------+|SimpleEvent| | |
* | . | |Plugin | | |
* +-----|------+ . v +-----------+ | |
* | | | . +--------------+ +------------+ | |
* | +-----------.--->|EventPluginHub| | Event | | |
* | | . | | +-----------+ | Propagators| | |
* | ReactEvent | . | | |TapEvent | |------------| | |
* | Emitter | . | |<---+|Plugin | |other plugin| | |
* | | . | | +-----------+ | utilities | | |
* | +-----------.--->| | +------------+ | |
* | | | . +--------------+ | |
* +-----|------+ . ^ +-----------+ | |
* | . | |Enter/Leave| | |
* + . +-------+|Plugin | | |
* +-------------+ . +-----------+ | |
* | application | . | |
* |-------------| . | |
* | | . | |
* | | . | |
* +-------------+ . | |
* . | |
* React Core . General Purpose Event Plugin System | |
*/ | |
var hasEventPageXY; | |
var alreadyListeningTo = {}; | |
var isMonitoringScrollValue = false; | |
var reactTopListenersCounter = 0; | |
// For events like 'submit' which don't consistently bubble (which we trap at a | |
// lower node than `document`), binding at `document` would cause duplicate | |
// events so we don't include them here | |
var topEventMapping = { | |
topAbort: 'abort', | |
topAnimationEnd: getVendorPrefixedEventName('animationend') || 'animationend', | |
topAnimationIteration: getVendorPrefixedEventName('animationiteration') || 'animationiteration', | |
topAnimationStart: getVendorPrefixedEventName('animationstart') || 'animationstart', | |
topBlur: 'blur', | |
topCanPlay: 'canplay', | |
topCanPlayThrough: 'canplaythrough', | |
topChange: 'change', | |
topClick: 'click', | |
topCompositionEnd: 'compositionend', | |
topCompositionStart: 'compositionstart', | |
topCompositionUpdate: 'compositionupdate', | |
topContextMenu: 'contextmenu', | |
topCopy: 'copy', | |
topCut: 'cut', | |
topDoubleClick: 'dblclick', | |
topDrag: 'drag', | |
topDragEnd: 'dragend', | |
topDragEnter: 'dragenter', | |
topDragExit: 'dragexit', | |
topDragLeave: 'dragleave', | |
topDragOver: 'dragover', | |
topDragStart: 'dragstart', | |
topDrop: 'drop', | |
topDurationChange: 'durationchange', | |
topEmptied: 'emptied', | |
topEncrypted: 'encrypted', | |
topEnded: 'ended', | |
topError: 'error', | |
topFocus: 'focus', | |
topInput: 'input', | |
topKeyDown: 'keydown', | |
topKeyPress: 'keypress', | |
topKeyUp: 'keyup', | |
topLoadedData: 'loadeddata', | |
topLoadedMetadata: 'loadedmetadata', | |
topLoadStart: 'loadstart', | |
topMouseDown: 'mousedown', | |
topMouseMove: 'mousemove', | |
topMouseOut: 'mouseout', | |
topMouseOver: 'mouseover', | |
topMouseUp: 'mouseup', | |
topPaste: 'paste', | |
topPause: 'pause', | |
topPlay: 'play', | |
topPlaying: 'playing', | |
topProgress: 'progress', | |
topRateChange: 'ratechange', | |
topScroll: 'scroll', | |
topSeeked: 'seeked', | |
topSeeking: 'seeking', | |
topSelectionChange: 'selectionchange', | |
topStalled: 'stalled', | |
topSuspend: 'suspend', | |
topTextInput: 'textInput', | |
topTimeUpdate: 'timeupdate', | |
topTouchCancel: 'touchcancel', | |
topTouchEnd: 'touchend', | |
topTouchMove: 'touchmove', | |
topTouchStart: 'touchstart', | |
topTransitionEnd: getVendorPrefixedEventName('transitionend') || 'transitionend', | |
topVolumeChange: 'volumechange', | |
topWaiting: 'waiting', | |
topWheel: 'wheel' | |
}; | |
/** | |
* To ensure no conflicts with other potential React instances on the page | |
*/ | |
var topListenersIDKey = '_reactListenersID' + String(Math.random()).slice(2); | |
function getListeningForDocument(mountAt) { | |
// In IE8, `mountAt` is a host object and doesn't have `hasOwnProperty` | |
// directly. | |
if (!Object.prototype.hasOwnProperty.call(mountAt, topListenersIDKey)) { | |
mountAt[topListenersIDKey] = reactTopListenersCounter++; | |
alreadyListeningTo[mountAt[topListenersIDKey]] = {}; | |
} | |
return alreadyListeningTo[mountAt[topListenersIDKey]]; | |
} | |
/** | |
* `ReactBrowserEventEmitter` is used to attach top-level event listeners. For | |
* example: | |
* | |
* EventPluginHub.putListener('myID', 'onClick', myFunction); | |
* | |
* This would allocate a "registration" of `('onClick', myFunction)` on 'myID'. | |
* | |
* @internal | |
*/ | |
var ReactBrowserEventEmitter = _assign({}, ReactEventEmitterMixin, { | |
/** | |
* Injectable event backend | |
*/ | |
ReactEventListener: null, | |
injection: { | |
/** | |
* @param {object} ReactEventListener | |
*/ | |
injectReactEventListener: function injectReactEventListener(ReactEventListener) { | |
ReactEventListener.setHandleTopLevel(ReactBrowserEventEmitter.handleTopLevel); | |
ReactBrowserEventEmitter.ReactEventListener = ReactEventListener; | |
} | |
}, | |
/** | |
* Sets whether or not any created callbacks should be enabled. | |
* | |
* @param {boolean} enabled True if callbacks should be enabled. | |
*/ | |
setEnabled: function setEnabled(enabled) { | |
if (ReactBrowserEventEmitter.ReactEventListener) { | |
ReactBrowserEventEmitter.ReactEventListener.setEnabled(enabled); | |
} | |
}, | |
/** | |
* @return {boolean} True if callbacks are enabled. | |
*/ | |
isEnabled: function isEnabled() { | |
return !!(ReactBrowserEventEmitter.ReactEventListener && ReactBrowserEventEmitter.ReactEventListener.isEnabled()); | |
}, | |
/** | |
* We listen for bubbled touch events on the document object. | |
* | |
* Firefox v8.01 (and possibly others) exhibited strange behavior when | |
* mounting `onmousemove` events at some node that was not the document | |
* element. The symptoms were that if your mouse is not moving over something | |
* contained within that mount point (for example on the background) the | |
* top-level listeners for `onmousemove` won't be called. However, if you | |
* register the `mousemove` on the document object, then it will of course | |
* catch all `mousemove`s. This along with iOS quirks, justifies restricting | |
* top-level listeners to the document object only, at least for these | |
* movement types of events and possibly all events. | |
* | |
* @see http://www.quirksmode.org/blog/archives/2010/09/click_event_del.html | |
* | |
* Also, `keyup`/`keypress`/`keydown` do not bubble to the window on IE, but | |
* they bubble to document. | |
* | |
* @param {string} registrationName Name of listener (e.g. `onClick`). | |
* @param {object} contentDocumentHandle Document which owns the container | |
*/ | |
listenTo: function listenTo(registrationName, contentDocumentHandle) { | |
var mountAt = contentDocumentHandle; | |
var isListening = getListeningForDocument(mountAt); | |
var dependencies = EventPluginRegistry.registrationNameDependencies[registrationName]; | |
for (var i = 0; i < dependencies.length; i++) { | |
var dependency = dependencies[i]; | |
if (!(isListening.hasOwnProperty(dependency) && isListening[dependency])) { | |
if (dependency === 'topWheel') { | |
if (isEventSupported('wheel')) { | |
ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent('topWheel', 'wheel', mountAt); | |
} else if (isEventSupported('mousewheel')) { | |
ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent('topWheel', 'mousewheel', mountAt); | |
} else { | |
// Firefox needs to capture a different mouse scroll event. | |
// @see http://www.quirksmode.org/dom/events/tests/scroll.html | |
ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent('topWheel', 'DOMMouseScroll', mountAt); | |
} | |
} else if (dependency === 'topScroll') { | |
if (isEventSupported('scroll', true)) { | |
ReactBrowserEventEmitter.ReactEventListener.trapCapturedEvent('topScroll', 'scroll', mountAt); | |
} else { | |
ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent('topScroll', 'scroll', ReactBrowserEventEmitter.ReactEventListener.WINDOW_HANDLE); | |
} | |
} else if (dependency === 'topFocus' || dependency === 'topBlur') { | |
if (isEventSupported('focus', true)) { | |
ReactBrowserEventEmitter.ReactEventListener.trapCapturedEvent('topFocus', 'focus', mountAt); | |
ReactBrowserEventEmitter.ReactEventListener.trapCapturedEvent('topBlur', 'blur', mountAt); | |
} else if (isEventSupported('focusin')) { | |
// IE has `focusin` and `focusout` events which bubble. | |
// @see http://www.quirksmode.org/blog/archives/2008/04/delegating_the.html | |
ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent('topFocus', 'focusin', mountAt); | |
ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent('topBlur', 'focusout', mountAt); | |
} | |
// to make sure blur and focus event listeners are only attached once | |
isListening.topBlur = true; | |
isListening.topFocus = true; | |
} else if (topEventMapping.hasOwnProperty(dependency)) { | |
ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent(dependency, topEventMapping[dependency], mountAt); | |
} | |
isListening[dependency] = true; | |
} | |
} | |
}, | |
trapBubbledEvent: function trapBubbledEvent(topLevelType, handlerBaseName, handle) { | |
return ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent(topLevelType, handlerBaseName, handle); | |
}, | |
trapCapturedEvent: function trapCapturedEvent(topLevelType, handlerBaseName, handle) { | |
return ReactBrowserEventEmitter.ReactEventListener.trapCapturedEvent(topLevelType, handlerBaseName, handle); | |
}, | |
/** | |
* Protect against document.createEvent() returning null | |
* Some popup blocker extensions appear to do this: | |
* https://github.com/facebook/react/issues/6887 | |
*/ | |
supportsEventPageXY: function supportsEventPageXY() { | |
if (!document.createEvent) { | |
return false; | |
} | |
var ev = document.createEvent('MouseEvent'); | |
return ev != null && 'pageX' in ev; | |
}, | |
/** | |
* Listens to window scroll and resize events. We cache scroll values so that | |
* application code can access them without triggering reflows. | |
* | |
* ViewportMetrics is only used by SyntheticMouse/TouchEvent and only when | |
* pageX/pageY isn't supported (legacy browsers). | |
* | |
* NOTE: Scroll events do not bubble. | |
* | |
* @see http://www.quirksmode.org/dom/events/scroll.html | |
*/ | |
ensureScrollValueMonitoring: function ensureScrollValueMonitoring() { | |
if (hasEventPageXY === undefined) { | |
hasEventPageXY = ReactBrowserEventEmitter.supportsEventPageXY(); | |
} | |
if (!hasEventPageXY && !isMonitoringScrollValue) { | |
var refresh = ViewportMetrics.refreshScrollValues; | |
ReactBrowserEventEmitter.ReactEventListener.monitorScrollValue(refresh); | |
isMonitoringScrollValue = true; | |
} | |
} | |
}); | |
module.exports = ReactBrowserEventEmitter; | |
/***/ }), | |
/* 31 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
"use strict"; | |
/** | |
* Copyright 2013-present, Facebook, Inc. | |
* All rights reserved. | |
* | |
* This source code is licensed under the BSD-style license found in the | |
* LICENSE file in the root directory of this source tree. An additional grant | |
* of patent rights can be found in the PATENTS file in the same directory. | |
* | |
*/ | |
var SyntheticUIEvent = __webpack_require__(26); | |
var ViewportMetrics = __webpack_require__(74); | |
var getEventModifierState = __webpack_require__(49); | |
/** | |
* @interface MouseEvent | |
* @see http://www.w3.org/TR/DOM-Level-3-Events/ | |
*/ | |
var MouseEventInterface = { | |
screenX: null, | |
screenY: null, | |
clientX: null, | |
clientY: null, | |
ctrlKey: null, | |
shiftKey: null, | |
altKey: null, | |
metaKey: null, | |
getModifierState: getEventModifierState, | |
button: function button(event) { | |
// Webkit, Firefox, IE9+ | |
// which: 1 2 3 | |
// button: 0 1 2 (standard) | |
var button = event.button; | |
if ('which' in event) { | |
return button; | |
} | |
// IE<9 | |
// which: undefined | |
// button: 0 0 0 | |
// button: 1 4 2 (onmouseup) | |
return button === 2 ? 2 : button === 4 ? 1 : 0; | |
}, | |
buttons: null, | |
relatedTarget: function relatedTarget(event) { | |
return event.relatedTarget || (event.fromElement === event.srcElement ? event.toElement : event.fromElement); | |
}, | |
// "Proprietary" Interface. | |
pageX: function pageX(event) { | |
return 'pageX' in event ? event.pageX : event.clientX + ViewportMetrics.currentScrollLeft; | |
}, | |
pageY: function pageY(event) { | |
return 'pageY' in event ? event.pageY : event.clientY + ViewportMetrics.currentScrollTop; | |
} | |
}; | |
/** | |
* @param {object} dispatchConfig Configuration used to dispatch this event. | |
* @param {string} dispatchMarker Marker identifying the event target. | |
* @param {object} nativeEvent Native browser event. | |
* @extends {SyntheticUIEvent} | |
*/ | |
function SyntheticMouseEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) { | |
return SyntheticUIEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget); | |
} | |
SyntheticUIEvent.augmentClass(SyntheticMouseEvent, MouseEventInterface); | |
module.exports = SyntheticMouseEvent; | |
/***/ }), | |
/* 32 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
"use strict"; | |
/* WEBPACK VAR INJECTION */(function(process) {/** | |
* Copyright 2013-present, Facebook, Inc. | |
* All rights reserved. | |
* | |
* This source code is licensed under the BSD-style license found in the | |
* LICENSE file in the root directory of this source tree. An additional grant | |
* of patent rights can be found in the PATENTS file in the same directory. | |
* | |
* | |
*/ | |
var _prodInvariant = __webpack_require__(3); | |
var invariant = __webpack_require__(1); | |
var OBSERVED_ERROR = {}; | |
/** | |
* `Transaction` creates a black box that is able to wrap any method such that | |
* certain invariants are maintained before and after the method is invoked | |
* (Even if an exception is thrown while invoking the wrapped method). Whoever | |
* instantiates a transaction can provide enforcers of the invariants at | |
* creation time. The `Transaction` class itself will supply one additional | |
* automatic invariant for you - the invariant that any transaction instance | |
* should not be run while it is already being run. You would typically create a | |
* single instance of a `Transaction` for reuse multiple times, that potentially | |
* is used to wrap several different methods. Wrappers are extremely simple - | |
* they only require implementing two methods. | |
* | |
* <pre> | |
* wrappers (injected at creation time) | |
* + + | |
* | | | |
* +-----------------|--------|--------------+ | |
* | v | | | |
* | +---------------+ | | | |
* | +--| wrapper1 |---|----+ | | |
* | | +---------------+ v | | | |
* | | +-------------+ | | | |
* | | +----| wrapper2 |--------+ | | |
* | | | +-------------+ | | | | |
* | | | | | | | |
* | v v v v | wrapper | |
* | +---+ +---+ +---------+ +---+ +---+ | invariants | |
* perform(anyMethod) | | | | | | | | | | | | maintained | |
* +----------------->|-|---|-|---|-->|anyMethod|---|---|-|---|-|--------> | |
* | | | | | | | | | | | | | |
* | | | | | | | | | | | | | |
* | | | | | | | | | | | | | |
* | +---+ +---+ +---------+ +---+ +---+ | | |
* | initialize close | | |
* +-----------------------------------------+ | |
* </pre> | |
* | |
* Use cases: | |
* - Preserving the input selection ranges before/after reconciliation. | |
* Restoring selection even in the event of an unexpected error. | |
* - Deactivating events while rearranging the DOM, preventing blurs/focuses, | |
* while guaranteeing that afterwards, the event system is reactivated. | |
* - Flushing a queue of collected DOM mutations to the main UI thread after a | |
* reconciliation takes place in a worker thread. | |
* - Invoking any collected `componentDidUpdate` callbacks after rendering new | |
* content. | |
* - (Future use case): Wrapping particular flushes of the `ReactWorker` queue | |
* to preserve the `scrollTop` (an automatic scroll aware DOM). | |
* - (Future use case): Layout calculations before and after DOM updates. | |
* | |
* Transactional plugin API: | |
* - A module that has an `initialize` method that returns any precomputation. | |
* - and a `close` method that accepts the precomputation. `close` is invoked | |
* when the wrapped process is completed, or has failed. | |
* | |
* @param {Array<TransactionalWrapper>} transactionWrapper Wrapper modules | |
* that implement `initialize` and `close`. | |
* @return {Transaction} Single transaction for reuse in thread. | |
* | |
* @class Transaction | |
*/ | |
var TransactionImpl = { | |
/** | |
* Sets up this instance so that it is prepared for collecting metrics. Does | |
* so such that this setup method may be used on an instance that is already | |
* initialized, in a way that does not consume additional memory upon reuse. | |
* That can be useful if you decide to make your subclass of this mixin a | |
* "PooledClass". | |
*/ | |
reinitializeTransaction: function reinitializeTransaction() { | |
this.transactionWrappers = this.getTransactionWrappers(); | |
if (this.wrapperInitData) { | |
this.wrapperInitData.length = 0; | |
} else { | |
this.wrapperInitData = []; | |
} | |
this._isInTransaction = false; | |
}, | |
_isInTransaction: false, | |
/** | |
* @abstract | |
* @return {Array<TransactionWrapper>} Array of transaction wrappers. | |
*/ | |
getTransactionWrappers: null, | |
isInTransaction: function isInTransaction() { | |
return !!this._isInTransaction; | |
}, | |
/* eslint-disable space-before-function-paren */ | |
/** | |
* Executes the function within a safety window. Use this for the top level | |
* methods that result in large amounts of computation/mutations that would | |
* need to be safety checked. The optional arguments helps prevent the need | |
* to bind in many cases. | |
* | |
* @param {function} method Member of scope to call. | |
* @param {Object} scope Scope to invoke from. | |
* @param {Object?=} a Argument to pass to the method. | |
* @param {Object?=} b Argument to pass to the method. | |
* @param {Object?=} c Argument to pass to the method. | |
* @param {Object?=} d Argument to pass to the method. | |
* @param {Object?=} e Argument to pass to the method. | |
* @param {Object?=} f Argument to pass to the method. | |
* | |
* @return {*} Return value from `method`. | |
*/ | |
perform: function perform(method, scope, a, b, c, d, e, f) { | |
/* eslint-enable space-before-function-paren */ | |
!!this.isInTransaction() ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Transaction.perform(...): Cannot initialize a transaction when there is already an outstanding transaction.') : _prodInvariant('27') : void 0; | |
var errorThrown; | |
var ret; | |
try { | |
this._isInTransaction = true; | |
// Catching errors makes debugging more difficult, so we start with | |
// errorThrown set to true before setting it to false after calling | |
// close -- if it's still set to true in the finally block, it means | |
// one of these calls threw. | |
errorThrown = true; | |
this.initializeAll(0); | |
ret = method.call(scope, a, b, c, d, e, f); | |
errorThrown = false; | |
} finally { | |
try { | |
if (errorThrown) { | |
// If `method` throws, prefer to show that stack trace over any thrown | |
// by invoking `closeAll`. | |
try { | |
this.closeAll(0); | |
} catch (err) {} | |
} else { | |
// Since `method` didn't throw, we don't want to silence the exception | |
// here. | |
this.closeAll(0); | |
} | |
} finally { | |
this._isInTransaction = false; | |
} | |
} | |
return ret; | |
}, | |
initializeAll: function initializeAll(startIndex) { | |
var transactionWrappers = this.transactionWrappers; | |
for (var i = startIndex; i < transactionWrappers.length; i++) { | |
var wrapper = transactionWrappers[i]; | |
try { | |
// Catching errors makes debugging more difficult, so we start with the | |
// OBSERVED_ERROR state before overwriting it with the real return value | |
// of initialize -- if it's still set to OBSERVED_ERROR in the finally | |
// block, it means wrapper.initialize threw. | |
this.wrapperInitData[i] = OBSERVED_ERROR; | |
this.wrapperInitData[i] = wrapper.initialize ? wrapper.initialize.call(this) : null; | |
} finally { | |
if (this.wrapperInitData[i] === OBSERVED_ERROR) { | |
// The initializer for wrapper i threw an error; initialize the | |
// remaining wrappers but silence any exceptions from them to ensure | |
// that the first error is the one to bubble up. | |
try { | |
this.initializeAll(i + 1); | |
} catch (err) {} | |
} | |
} | |
} | |
}, | |
/** | |
* Invokes each of `this.transactionWrappers.close[i]` functions, passing into | |
* them the respective return values of `this.transactionWrappers.init[i]` | |
* (`close`rs that correspond to initializers that failed will not be | |
* invoked). | |
*/ | |
closeAll: function closeAll(startIndex) { | |
!this.isInTransaction() ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Transaction.closeAll(): Cannot close transaction when none are open.') : _prodInvariant('28') : void 0; | |
var transactionWrappers = this.transactionWrappers; | |
for (var i = startIndex; i < transactionWrappers.length; i++) { | |
var wrapper = transactionWrappers[i]; | |
var initData = this.wrapperInitData[i]; | |
var errorThrown; | |
try { | |
// Catching errors makes debugging more difficult, so we start with | |
// errorThrown set to true before setting it to false after calling | |
// close -- if it's still set to true in the finally block, it means | |
// wrapper.close threw. | |
errorThrown = true; | |
if (initData !== OBSERVED_ERROR && wrapper.close) { | |
wrapper.close.call(this, initData); | |
} | |
errorThrown = false; | |
} finally { | |
if (errorThrown) { | |
// The closer for wrapper i threw an error; close the remaining | |
// wrappers but silence any exceptions from them to ensure that the | |
// first error is the one to bubble up. | |
try { | |
this.closeAll(i + 1); | |
} catch (e) {} | |
} | |
} | |
} | |
this.wrapperInitData.length = 0; | |
} | |
}; | |
module.exports = TransactionImpl; | |
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0))) | |
/***/ }), | |
/* 33 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
"use strict"; | |
/** | |
* Copyright 2016-present, Facebook, Inc. | |
* All rights reserved. | |
* | |
* This source code is licensed under the BSD-style license found in the | |
* LICENSE file in the root directory of this source tree. An additional grant | |
* of patent rights can be found in the PATENTS file in the same directory. | |
* | |
* Based on the escape-html library, which is used under the MIT License below: | |
* | |
* Copyright (c) 2012-2013 TJ Holowaychuk | |
* Copyright (c) 2015 Andreas Lubbe | |
* Copyright (c) 2015 Tiancheng "Timothy" Gu | |
* | |
* Permission is hereby granted, free of charge, to any person obtaining | |
* a copy of this software and associated documentation files (the | |
* 'Software'), to deal in the Software without restriction, including | |
* without limitation the rights to use, copy, modify, merge, publish, | |
* distribute, sublicense, and/or sell copies of the Software, and to | |
* permit persons to whom the Software is furnished to do so, subject to | |
* the following conditions: | |
* | |
* The above copyright notice and this permission notice shall be | |
* included in all copies or substantial portions of the Software. | |
* | |
* THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, | |
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF | |
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. | |
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY | |
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, | |
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE | |
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | |
* | |
*/ | |
// code copied and modified from escape-html | |
/** | |
* Module variables. | |
* @private | |
*/ | |
var matchHtmlRegExp = /["'&<>]/; | |
/** | |
* Escape special characters in the given string of html. | |
* | |
* @param {string} string The string to escape for inserting into HTML | |
* @return {string} | |
* @public | |
*/ | |
function escapeHtml(string) { | |
var str = '' + string; | |
var match = matchHtmlRegExp.exec(str); | |
if (!match) { | |
return str; | |
} | |
var escape; | |
var html = ''; | |
var index = 0; | |
var lastIndex = 0; | |
for (index = match.index; index < str.length; index++) { | |
switch (str.charCodeAt(index)) { | |
case 34: | |
// " | |
escape = '"'; | |
break; | |
case 38: | |
// & | |
escape = '&'; | |
break; | |
case 39: | |
// ' | |
escape = '''; // modified from escape-html; used to be ''' | |
break; | |
case 60: | |
// < | |
escape = '<'; | |
break; | |
case 62: | |
// > | |
escape = '>'; | |
break; | |
default: | |
continue; | |
} | |
if (lastIndex !== index) { | |
html += str.substring(lastIndex, index); | |
} | |
lastIndex = index + 1; | |
html += escape; | |
} | |
return lastIndex !== index ? html + str.substring(lastIndex, index) : html; | |
} | |
// end code copied and modified from escape-html | |
/** | |
* Escapes text to prevent scripting attacks. | |
* | |
* @param {*} text Text value to escape. | |
* @return {string} An escaped string. | |
*/ | |
function escapeTextContentForBrowser(text) { | |
if (typeof text === 'boolean' || typeof text === 'number') { | |
// this shortcircuit helps perf for types that we know will never have | |
// special characters, especially given that this function is used often | |
// for numeric dom ids. | |
return '' + text; | |
} | |
return escapeHtml(text); | |
} | |
module.exports = escapeTextContentForBrowser; | |
/***/ }), | |
/* 34 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
"use strict"; | |
/** | |
* Copyright 2013-present, Facebook, Inc. | |
* All rights reserved. | |
* | |
* This source code is licensed under the BSD-style license found in the | |
* LICENSE file in the root directory of this source tree. An additional grant | |
* of patent rights can be found in the PATENTS file in the same directory. | |
* | |
*/ | |
var ExecutionEnvironment = __webpack_require__(6); | |
var DOMNamespaces = __webpack_require__(40); | |
var WHITESPACE_TEST = /^[ \r\n\t\f]/; | |
var NONVISIBLE_TEST = /<(!--|link|noscript|meta|script|style)[ \r\n\t\f\/>]/; | |
var createMicrosoftUnsafeLocalFunction = __webpack_require__(47); | |
// SVG temp container for IE lacking innerHTML | |
var reusableSVGContainer; | |
/** | |
* Set the innerHTML property of a node, ensuring that whitespace is preserved | |
* even in IE8. | |
* | |
* @param {DOMElement} node | |
* @param {string} html | |
* @internal | |
*/ | |
var setInnerHTML = createMicrosoftUnsafeLocalFunction(function (node, html) { | |
// IE does not have innerHTML for SVG nodes, so instead we inject the | |
// new markup in a temp node and then move the child nodes across into | |
// the target node | |
if (node.namespaceURI === DOMNamespaces.svg && !('innerHTML' in node)) { | |
reusableSVGContainer = reusableSVGContainer || document.createElement('div'); | |
reusableSVGContainer.innerHTML = '<svg>' + html + '</svg>'; | |
var svgNode = reusableSVGContainer.firstChild; | |
while (svgNode.firstChild) { | |
node.appendChild(svgNode.firstChild); | |
} | |
} else { | |
node.innerHTML = html; | |
} | |
}); | |
if (ExecutionEnvironment.canUseDOM) { | |
// IE8: When updating a just created node with innerHTML only leading | |
// whitespace is removed. When updating an existing node with innerHTML | |
// whitespace in root TextNodes is also collapsed. | |
// @see quirksmode.org/bugreports/archives/2004/11/innerhtml_and_t.html | |
// Feature detection; only IE8 is known to behave improperly like this. | |
var testElement = document.createElement('div'); | |
testElement.innerHTML = ' '; | |
if (testElement.innerHTML === '') { | |
setInnerHTML = function setInnerHTML(node, html) { | |
// Magic theory: IE8 supposedly differentiates between added and updated | |
// nodes when processing innerHTML, innerHTML on updated nodes suffers | |
// from worse whitespace behavior. Re-adding a node like this triggers | |
// the initial and more favorable whitespace behavior. | |
// TODO: What to do on a detached node? | |
if (node.parentNode) { | |
node.parentNode.replaceChild(node, node); | |
} | |
// We also implement a workaround for non-visible tags disappearing into | |
// thin air on IE8, this only happens if there is no visible text | |
// in-front of the non-visible tags. Piggyback on the whitespace fix | |
// and simply check if any non-visible tags appear in the source. | |
if (WHITESPACE_TEST.test(html) || html[0] === '<' && NONVISIBLE_TEST.test(html)) { | |
// Recover leading whitespace by temporarily prepending any character. | |
// \uFEFF has the potential advantage of being zero-width/invisible. | |
// UglifyJS drops U+FEFF chars when parsing, so use String.fromCharCode | |
// in hopes that this is preserved even if "\uFEFF" is transformed to | |
// the actual Unicode character (by Babel, for example). | |
// https://github.com/mishoo/UglifyJS2/blob/v2.4.20/lib/parse.js#L216 | |
node.innerHTML = String.fromCharCode(0xfeff) + html; | |
// deleteData leaves an empty `TextNode` which offsets the index of all | |
// children. Definitely want to avoid this. | |
var textNode = node.firstChild; | |
if (textNode.data.length === 1) { | |
node.removeChild(textNode); | |
} else { | |
textNode.deleteData(0, 1); | |
} | |
} else { | |
node.innerHTML = html; | |
} | |
}; | |
} | |
testElement = null; | |
} | |
module.exports = setInnerHTML; | |
/***/ }), | |
/* 35 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
"use strict"; | |
/* WEBPACK VAR INJECTION */(function(process) {/** | |
* Copyright 2013-present, Facebook, Inc. | |
* All rights reserved. | |
* | |
* This source code is licensed under the BSD-style license found in the | |
* LICENSE file in the root directory of this source tree. An additional grant | |
* of patent rights can be found in the PATENTS file in the same directory. | |
* | |
* | |
*/ | |
var canDefineProperty = false; | |
if (process.env.NODE_ENV !== 'production') { | |
try { | |
// $FlowFixMe https://github.com/facebook/flow/issues/285 | |
Object.defineProperty({}, 'x', { get: function get() {} }); | |
canDefineProperty = true; | |
} catch (x) { | |
// IE will fail on defineProperty | |
} | |
} | |
module.exports = canDefineProperty; | |
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0))) | |
/***/ }), | |
/* 36 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
"use strict"; | |
function isContainer(node) { | |
switch (node._type) { | |
case 'Document': | |
case 'BlockQuote': | |
case 'List': | |
case 'Item': | |
case 'Paragraph': | |
case 'Heading': | |
case 'Emph': | |
case 'Strong': | |
case 'Link': | |
case 'Image': | |
case 'CustomInline': | |
case 'CustomBlock': | |
return true; | |
default: | |
return false; | |
} | |
} | |
var resumeAt = function resumeAt(node, entering) { | |
this.current = node; | |
this.entering = entering === true; | |
}; | |
var next = function next() { | |
var cur = this.current; | |
var entering = this.entering; | |
if (cur === null) { | |
return null; | |
} | |
var container = isContainer(cur); | |
if (entering && container) { | |
if (cur._firstChild) { | |
this.current = cur._firstChild; | |
this.entering = true; | |
} else { | |
// stay on node but exit | |
this.entering = false; | |
} | |
} else if (cur === this.root) { | |
this.current = null; | |
} else if (cur._next === null) { | |
this.current = cur._parent; | |
this.entering = false; | |
} else { | |
this.current = cur._next; | |
this.entering = true; | |
} | |
return { entering: entering, node: cur }; | |
}; | |
var NodeWalker = function NodeWalker(root) { | |
return { current: root, | |
root: root, | |
entering: true, | |
next: next, | |
resumeAt: resumeAt }; | |
}; | |
var Node = function Node(nodeType, sourcepos) { | |
this._type = nodeType; | |
this._parent = null; | |
this._firstChild = null; | |
this._lastChild = null; | |
this._prev = null; | |
this._next = null; | |
this._sourcepos = sourcepos; | |
this._lastLineBlank = false; | |
this._open = true; | |
this._string_content = null; | |
this._literal = null; | |
this._listData = {}; | |
this._info = null; | |
this._destination = null; | |
this._title = null; | |
this._isFenced = false; | |
this._fenceChar = null; | |
this._fenceLength = 0; | |
this._fenceOffset = null; | |
this._level = null; | |
this._onEnter = null; | |
this._onExit = null; | |
}; | |
var proto = Node.prototype; | |
Object.defineProperty(proto, 'isContainer', { | |
get: function get() { | |
return isContainer(this); | |
} | |
}); | |
Object.defineProperty(proto, 'type', { | |
get: function get() { | |
return this._type; | |
} | |
}); | |
Object.defineProperty(proto, 'firstChild', { | |
get: function get() { | |
return this._firstChild; | |
} | |
}); | |
Object.defineProperty(proto, 'lastChild', { | |
get: function get() { | |
return this._lastChild; | |
} | |
}); | |
Object.defineProperty(proto, 'next', { | |
get: function get() { | |
return this._next; | |
} | |
}); | |
Object.defineProperty(proto, 'prev', { | |
get: function get() { | |
return this._prev; | |
} | |
}); | |
Object.defineProperty(proto, 'parent', { | |
get: function get() { | |
return this._parent; | |
} | |
}); | |
Object.defineProperty(proto, 'sourcepos', { | |
get: function get() { | |
return this._sourcepos; | |
} | |
}); | |
Object.defineProperty(proto, 'literal', { | |
get: function get() { | |
return this._literal; | |
}, | |
set: function set(s) { | |
this._literal = s; | |
} | |
}); | |
Object.defineProperty(proto, 'destination', { | |
get: function get() { | |
return this._destination; | |
}, | |
set: function set(s) { | |
this._destination = s; | |
} | |
}); | |
Object.defineProperty(proto, 'title', { | |
get: function get() { | |
return this._title; | |
}, | |
set: function set(s) { | |
this._title = s; | |
} | |
}); | |
Object.defineProperty(proto, 'info', { | |
get: function get() { | |
return this._info; | |
}, | |
set: function set(s) { | |
this._info = s; | |
} | |
}); | |
Object.defineProperty(proto, 'level', { | |
get: function get() { | |
return this._level; | |
}, | |
set: function set(s) { | |
this._level = s; | |
} | |
}); | |
Object.defineProperty(proto, 'listType', { | |
get: function get() { | |
return this._listData.type; | |
}, | |
set: function set(t) { | |
this._listData.type = t; | |
} | |
}); | |
Object.defineProperty(proto, 'listTight', { | |
get: function get() { | |
return this._listData.tight; | |
}, | |
set: function set(t) { | |
this._listData.tight = t; | |
} | |
}); | |
Object.defineProperty(proto, 'listStart', { | |
get: function get() { | |
return this._listData.start; | |
}, | |
set: function set(n) { | |
this._listData.start = n; | |
} | |
}); | |
Object.defineProperty(proto, 'listDelimiter', { | |
get: function get() { | |
return this._listData.delimiter; | |
}, | |
set: function set(delim) { | |
this._listData.delimiter = delim; | |
} | |
}); | |
Object.defineProperty(proto, 'onEnter', { | |
get: function get() { | |
return this._onEnter; | |
}, | |
set: function set(s) { | |
this._onEnter = s; | |
} | |
}); | |
Object.defineProperty(proto, 'onExit', { | |
get: function get() { | |
return this._onExit; | |
}, | |
set: function set(s) { | |
this._onExit = s; | |
} | |
}); | |
Node.prototype.appendChild = function (child) { | |
child.unlink(); | |
child._parent = this; | |
if (this._lastChild) { | |
this._lastChild._next = child; | |
child._prev = this._lastChild; | |
this._lastChild = child; | |
} else { | |
this._firstChild = child; | |
this._lastChild = child; | |
} | |
}; | |
Node.prototype.prependChild = function (child) { | |
child.unlink(); | |
child._parent = this; | |
if (this._firstChild) { | |
this._firstChild._prev = child; | |
child._next = this._firstChild; | |
this._firstChild = child; | |
} else { | |
this._firstChild = child; | |
this._lastChild = child; | |
} | |
}; | |
Node.prototype.unlink = function () { | |
if (this._prev) { | |
this._prev._next = this._next; | |
} else if (this._parent) { | |
this._parent._firstChild = this._next; | |
} | |
if (this._next) { | |
this._next._prev = this._prev; | |
} else if (this._parent) { | |
this._parent._lastChild = this._prev; | |
} | |
this._parent = null; | |
this._next = null; | |
this._prev = null; | |
}; | |
Node.prototype.insertAfter = function (sibling) { | |
sibling.unlink(); | |
sibling._next = this._next; | |
if (sibling._next) { | |
sibling._next._prev = sibling; | |
} | |
sibling._prev = this; | |
this._next = sibling; | |
sibling._parent = this._parent; | |
if (!sibling._next) { | |
sibling._parent._lastChild = sibling; | |
} | |
}; | |
Node.prototype.insertBefore = function (sibling) { | |
sibling.unlink(); | |
sibling._prev = this._prev; | |
if (sibling._prev) { | |
sibling._prev._next = sibling; | |
} | |
sibling._next = this; | |
this._prev = sibling; | |
sibling._parent = this._parent; | |
if (!sibling._prev) { | |
sibling._parent._firstChild = sibling; | |
} | |
}; | |
Node.prototype.walker = function () { | |
var walker = new NodeWalker(this); | |
return walker; | |
}; | |
module.exports = Node; | |
/* Example of use of walker: | |
var walker = w.walker(); | |
var event; | |
while (event = walker.next()) { | |
console.log(event.entering, event.node.type); | |
} | |
*/ | |
/***/ }), | |
/* 37 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
"use strict"; | |
/** | |
* Copyright (c) 2013-present, Facebook, Inc. | |
* All rights reserved. | |
* | |
* This source code is licensed under the BSD-style license found in the | |
* LICENSE file in the root directory of this source tree. An additional grant | |
* of patent rights can be found in the PATENTS file in the same directory. | |
* | |
* @typechecks | |
* | |
*/ | |
/*eslint-disable no-self-compare */ | |
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; | |
var hasOwnProperty = Object.prototype.hasOwnProperty; | |
/** | |
* inlined Object.is polyfill to avoid requiring consumers ship their own | |
* https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is | |
*/ | |
function is(x, y) { | |
// SameValue algorithm | |
if (x === y) { | |
// Steps 1-5, 7-10 | |
// Steps 6.b-6.e: +0 != -0 | |
// Added the nonzero y check to make Flow happy, but it is redundant | |
return x !== 0 || y !== 0 || 1 / x === 1 / y; | |
} else { | |
// Step 6.a: NaN == NaN | |
return x !== x && y !== y; | |
} | |
} | |
/** | |
* Performs equality by iterating through keys on an object and returning false | |
* when any key has values which are not strictly equal between the arguments. | |
* Returns true when the values of all keys are strictly equal. | |
*/ | |
function shallowEqual(objA, objB) { | |
if (is(objA, objB)) { | |
return true; | |
} | |
if ((typeof objA === 'undefined' ? 'undefined' : _typeof(objA)) !== 'object' || objA === null || (typeof objB === 'undefined' ? 'undefined' : _typeof(objB)) !== 'object' || objB === null) { | |
return false; | |
} | |
var keysA = Object.keys(objA); | |
var keysB = Object.keys(objB); | |
if (keysA.length !== keysB.length) { | |
return false; | |
} | |
// Test for A's keys different from B. | |
for (var i = 0; i < keysA.length; i++) { | |
if (!hasOwnProperty.call(objB, keysA[i]) || !is(objA[keysA[i]], objB[keysA[i]])) { | |
return false; | |
} | |
} | |
return true; | |
} | |
module.exports = shallowEqual; | |
/***/ }), | |
/* 38 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
"use strict"; | |
/** | |
* Copyright 2013-present, Facebook, Inc. | |
* All rights reserved. | |
* | |
* This source code is licensed under the BSD-style license found in the | |
* LICENSE file in the root directory of this source tree. An additional grant | |
* of patent rights can be found in the PATENTS file in the same directory. | |
*/ | |
var ReactPropTypesSecret = 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED'; | |
module.exports = ReactPropTypesSecret; | |
/***/ }), | |
/* 39 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
"use strict"; | |
/* WEBPACK VAR INJECTION */(function(process) {/** | |
* Copyright 2013-present, Facebook, Inc. | |
* All rights reserved. | |
* | |
* This source code is licensed under the BSD-style license found in the | |
* LICENSE file in the root directory of this source tree. An additional grant | |
* of patent rights can be found in the PATENTS file in the same directory. | |
* | |
*/ | |
var DOMLazyTree = __webpack_require__(18); | |
var Danger = __webpack_require__(313); | |
var ReactDOMComponentTree = __webpack_require__(5); | |
var ReactInstrumentation = __webpack_require__(9); | |
var createMicrosoftUnsafeLocalFunction = __webpack_require__(47); | |
var setInnerHTML = __webpack_require__(34); | |
var setTextContent = __webpack_require__(82); | |
function getNodeAfter(parentNode, node) { | |
// Special case for text components, which return [open, close] comments | |
// from getHostNode. | |
if (Array.isArray(node)) { | |
node = node[1]; | |
} | |
return node ? node.nextSibling : parentNode.firstChild; | |
} | |
/** | |
* Inserts `childNode` as a child of `parentNode` at the `index`. | |
* | |
* @param {DOMElement} parentNode Parent node in which to insert. | |
* @param {DOMElement} childNode Child node to insert. | |
* @param {number} index Index at which to insert the child. | |
* @internal | |
*/ | |
var insertChildAt = createMicrosoftUnsafeLocalFunction(function (parentNode, childNode, referenceNode) { | |
// We rely exclusively on `insertBefore(node, null)` instead of also using | |
// `appendChild(node)`. (Using `undefined` is not allowed by all browsers so | |
// we are careful to use `null`.) | |
parentNode.insertBefore(childNode, referenceNode); | |
}); | |
function insertLazyTreeChildAt(parentNode, childTree, referenceNode) { | |
DOMLazyTree.insertTreeBefore(parentNode, childTree, referenceNode); | |
} | |
function moveChild(parentNode, childNode, referenceNode) { | |
if (Array.isArray(childNode)) { | |
moveDelimitedText(parentNode, childNode[0], childNode[1], referenceNode); | |
} else { | |
insertChildAt(parentNode, childNode, referenceNode); | |
} | |
} | |
function removeChild(parentNode, childNode) { | |
if (Array.isArray(childNode)) { | |
var closingComment = childNode[1]; | |
childNode = childNode[0]; | |
removeDelimitedText(parentNode, childNode, closingComment); | |
parentNode.removeChild(closingComment); | |
} | |
parentNode.removeChild(childNode); | |
} | |
function moveDelimitedText(parentNode, openingComment, closingComment, referenceNode) { | |
var node = openingComment; | |
while (true) { | |
var nextNode = node.nextSibling; | |
insertChildAt(parentNode, node, referenceNode); | |
if (node === closingComment) { | |
break; | |
} | |
node = nextNode; | |
} | |
} | |
function removeDelimitedText(parentNode, startNode, closingComment) { | |
while (true) { | |
var node = startNode.nextSibling; | |
if (node === closingComment) { | |
// The closing comment is removed by ReactMultiChild. | |
break; | |
} else { | |
parentNode.removeChild(node); | |
} | |
} | |
} | |
function replaceDelimitedText(openingComment, closingComment, stringText) { | |
var parentNode = openingComment.parentNode; | |
var nodeAfterComment = openingComment.nextSibling; | |
if (nodeAfterComment === closingComment) { | |
// There are no text nodes between the opening and closing comments; insert | |
// a new one if stringText isn't empty. | |
if (stringText) { | |
insertChildAt(parentNode, document.createTextNode(stringText), nodeAfterComment); | |
} | |
} else { | |
if (stringText) { | |
// Set the text content of the first node after the opening comment, and | |
// remove all following nodes up until the closing comment. | |
setTextContent(nodeAfterComment, stringText); | |
removeDelimitedText(parentNode, nodeAfterComment, closingComment); | |
} else { | |
removeDelimitedText(parentNode, openingComment, closingComment); | |
} | |
} | |
if (process.env.NODE_ENV !== 'production') { | |
ReactInstrumentation.debugTool.onHostOperation({ | |
instanceID: ReactDOMComponentTree.getInstanceFromNode(openingComment)._debugID, | |
type: 'replace text', | |
payload: stringText | |
}); | |
} | |
} | |
var dangerouslyReplaceNodeWithMarkup = Danger.dangerouslyReplaceNodeWithMarkup; | |
if (process.env.NODE_ENV !== 'production') { | |
dangerouslyReplaceNodeWithMarkup = function dangerouslyReplaceNodeWithMarkup(oldChild, markup, prevInstance) { | |
Danger.dangerouslyReplaceNodeWithMarkup(oldChild, markup); | |
if (prevInstance._debugID !== 0) { | |
ReactInstrumentation.debugTool.onHostOperation({ | |
instanceID: prevInstance._debugID, | |
type: 'replace with', | |
payload: markup.toString() | |
}); | |
} else { | |
var nextInstance = ReactDOMComponentTree.getInstanceFromNode(markup.node); | |
if (nextInstance._debugID !== 0) { | |
ReactInstrumentation.debugTool.onHostOperation({ | |
instanceID: nextInstance._debugID, | |
type: 'mount', | |
payload: markup.toString() | |
}); | |
} | |
} | |
}; | |
} | |
/** | |
* Operations for updating with DOM children. | |
*/ | |
var DOMChildrenOperations = { | |
dangerouslyReplaceNodeWithMarkup: dangerouslyReplaceNodeWithMarkup, | |
replaceDelimitedText: replaceDelimitedText, | |
/** | |
* Updates a component's children by processing a series of updates. The | |
* update configurations are each expected to have a `parentNode` property. | |
* | |
* @param {array<object>} updates List of update configurations. | |
* @internal | |
*/ | |
processUpdates: function processUpdates(parentNode, updates) { | |
if (process.env.NODE_ENV !== 'production') { | |
var parentNodeDebugID = ReactDOMComponentTree.getInstanceFromNode(parentNode)._debugID; | |
} | |
for (var k = 0; k < updates.length; k++) { | |
var update = updates[k]; | |
switch (update.type) { | |
case 'INSERT_MARKUP': | |
insertLazyTreeChildAt(parentNode, update.content, getNodeAfter(parentNode, update.afterNode)); | |
if (process.env.NODE_ENV !== 'production') { | |
ReactInstrumentation.debugTool.onHostOperation({ | |
instanceID: parentNodeDebugID, | |
type: 'insert child', | |
payload: { | |
toIndex: update.toIndex, | |
content: update.content.toString() | |
} | |
}); | |
} | |
break; | |
case 'MOVE_EXISTING': | |
moveChild(parentNode, update.fromNode, getNodeAfter(parentNode, update.afterNode)); | |
if (process.env.NODE_ENV !== 'production') { | |
ReactInstrumentation.debugTool.onHostOperation({ | |
instanceID: parentNodeDebugID, | |
type: 'move child', | |
payload: { fromIndex: update.fromIndex, toIndex: update.toIndex } | |
}); | |
} | |
break; | |
case 'SET_MARKUP': | |
setInnerHTML(parentNode, update.content); | |
if (process.env.NODE_ENV !== 'production') { | |
ReactInstrumentation.debugTool.onHostOperation({ | |
instanceID: parentNodeDebugID, | |
type: 'replace children', | |
payload: update.content.toString() | |
}); | |
} | |
break; | |
case 'TEXT_CONTENT': | |
setTextContent(parentNode, update.content); | |
if (process.env.NODE_ENV !== 'production') { | |
ReactInstrumentation.debugTool.onHostOperation({ | |
instanceID: parentNodeDebugID, | |
type: 'replace text', | |
payload: update.content.toString() | |
}); | |
} | |
break; | |
case 'REMOVE_NODE': | |
removeChild(parentNode, update.fromNode); | |
if (process.env.NODE_ENV !== 'production') { | |
ReactInstrumentation.debugTool.onHostOperation({ | |
instanceID: parentNodeDebugID, | |
type: 'remove child', | |
payload: { fromIndex: update.fromIndex } | |
}); | |
} | |
break; | |
} | |
} | |
} | |
}; | |
module.exports = DOMChildrenOperations; | |
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0))) | |
/***/ }), | |
/* 40 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
"use strict"; | |
/** | |
* Copyright 2013-present, Facebook, Inc. | |
* All rights reserved. | |
* | |
* This source code is licensed under the BSD-style license found in the | |
* LICENSE file in the root directory of this source tree. An additional grant | |
* of patent rights can be found in the PATENTS file in the same directory. | |
* | |
*/ | |
var DOMNamespaces = { | |
html: 'http://www.w3.org/1999/xhtml', | |
mathml: 'http://www.w3.org/1998/Math/MathML', | |
svg: 'http://www.w3.org/2000/svg' | |
}; | |
module.exports = DOMNamespaces; | |
/***/ }), | |
/* 41 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
"use strict"; | |
/* WEBPACK VAR INJECTION */(function(process) {/** | |
* Copyright 2013-present, Facebook, Inc. | |
* All rights reserved. | |
* | |
* This source code is licensed under the BSD-style license found in the | |
* LICENSE file in the root directory of this source tree. An additional grant | |
* of patent rights can be found in the PATENTS file in the same directory. | |
* | |
*/ | |
var _prodInvariant = __webpack_require__(3); | |
var ReactErrorUtils = __webpack_require__(45); | |
var invariant = __webpack_require__(1); | |
var warning = __webpack_require__(2); | |
/** | |
* Injected dependencies: | |
*/ | |
/** | |
* - `ComponentTree`: [required] Module that can convert between React instances | |
* and actual node references. | |
*/ | |
var ComponentTree; | |
var TreeTraversal; | |
var injection = { | |
injectComponentTree: function injectComponentTree(Injected) { | |
ComponentTree = Injected; | |
if (process.env.NODE_ENV !== 'production') { | |
process.env.NODE_ENV !== 'production' ? warning(Injected && Injected.getNodeFromInstance && Injected.getInstanceFromNode, 'EventPluginUtils.injection.injectComponentTree(...): Injected ' + 'module is missing getNodeFromInstance or getInstanceFromNode.') : void 0; | |
} | |
}, | |
injectTreeTraversal: function injectTreeTraversal(Injected) { | |
TreeTraversal = Injected; | |
if (process.env.NODE_ENV !== 'production') { | |
process.env.NODE_ENV !== 'production' ? warning(Injected && Injected.isAncestor && Injected.getLowestCommonAncestor, 'EventPluginUtils.injection.injectTreeTraversal(...): Injected ' + 'module is missing isAncestor or getLowestCommonAncestor.') : void 0; | |
} | |
} | |
}; | |
function isEndish(topLevelType) { | |
return topLevelType === 'topMouseUp' || topLevelType === 'topTouchEnd' || topLevelType === 'topTouchCancel'; | |
} | |
function isMoveish(topLevelType) { | |
return topLevelType === 'topMouseMove' || topLevelType === 'topTouchMove'; | |
} | |
function isStartish(topLevelType) { | |
return topLevelType === 'topMouseDown' || topLevelType === 'topTouchStart'; | |
} | |
var validateEventDispatches; | |
if (process.env.NODE_ENV !== 'production') { | |
validateEventDispatches = function validateEventDispatches(event) { | |
var dispatchListeners = event._dispatchListeners; | |
var dispatchInstances = event._dispatchInstances; | |
var listenersIsArr = Array.isArray(dispatchListeners); | |
var listenersLen = listenersIsArr ? dispatchListeners.length : dispatchListeners ? 1 : 0; | |
var instancesIsArr = Array.isArray(dispatchInstances); | |
var instancesLen = instancesIsArr ? dispatchInstances.length : dispatchInstances ? 1 : 0; | |
process.env.NODE_ENV !== 'production' ? warning(instancesIsArr === listenersIsArr && instancesLen === listenersLen, 'EventPluginUtils: Invalid `event`.') : void 0; | |
}; | |
} | |
/** | |
* Dispatch the event to the listener. | |
* @param {SyntheticEvent} event SyntheticEvent to handle | |
* @param {boolean} simulated If the event is simulated (changes exn behavior) | |
* @param {function} listener Application-level callback | |
* @param {*} inst Internal component instance | |
*/ | |
function executeDispatch(event, simulated, listener, inst) { | |
var type = event.type || 'unknown-event'; | |
event.currentTarget = EventPluginUtils.getNodeFromInstance(inst); | |
if (simulated) { | |
ReactErrorUtils.invokeGuardedCallbackWithCatch(type, listener, event); | |
} else { | |
ReactErrorUtils.invokeGuardedCallback(type, listener, event); | |
} | |
event.currentTarget = null; | |
} | |
/** | |
* Standard/simple iteration through an event's collected dispatches. | |
*/ | |
function executeDispatchesInOrder(event, simulated) { | |
var dispatchListeners = event._dispatchListeners; | |
var dispatchInstances = event._dispatchInstances; | |
if (process.env.NODE_ENV !== 'production') { | |
validateEventDispatches(event); | |
} | |
if (Array.isArray(dispatchListeners)) { | |
for (var i = 0; i < dispatchListeners.length; i++) { | |
if (event.isPropagationStopped()) { | |
break; | |
} | |
// Listeners and Instances are two parallel arrays that are always in sync. | |
executeDispatch(event, simulated, dispatchListeners[i], dispatchInstances[i]); | |
} | |
} else if (dispatchListeners) { | |
executeDispatch(event, simulated, dispatchListeners, dispatchInstances); | |
} | |
event._dispatchListeners = null; | |
event._dispatchInstances = null; | |
} | |
/** | |
* Standard/simple iteration through an event's collected dispatches, but stops | |
* at the first dispatch execution returning true, and returns that id. | |
* | |
* @return {?string} id of the first dispatch execution who's listener returns | |
* true, or null if no listener returned true. | |
*/ | |
function executeDispatchesInOrderStopAtTrueImpl(event) { | |
var dispatchListeners = event._dispatchListeners; | |
var dispatchInstances = event._dispatchInstances; | |
if (process.env.NODE_ENV !== 'production') { | |
validateEventDispatches(event); | |
} | |
if (Array.isArray(dispatchListeners)) { | |
for (var i = 0; i < dispatchListeners.length; i++) { | |
if (event.isPropagationStopped()) { | |
break; | |
} | |
// Listeners and Instances are two parallel arrays that are always in sync. | |
if (dispatchListeners[i](event, dispatchInstances[i])) { | |
return dispatchInstances[i]; | |
} | |
} | |
} else if (dispatchListeners) { | |
if (dispatchListeners(event, dispatchInstances)) { | |
return dispatchInstances; | |
} | |
} | |
return null; | |
} | |
/** | |
* @see executeDispatchesInOrderStopAtTrueImpl | |
*/ | |
function executeDispatchesInOrderStopAtTrue(event) { | |
var ret = executeDispatchesInOrderStopAtTrueImpl(event); | |
event._dispatchInstances = null; | |
event._dispatchListeners = null; | |
return ret; | |
} | |
/** | |
* Execution of a "direct" dispatch - there must be at most one dispatch | |
* accumulated on the event or it is considered an error. It doesn't really make | |
* sense for an event with multiple dispatches (bubbled) to keep track of the | |
* return values at each dispatch execution, but it does tend to make sense when | |
* dealing with "direct" dispatches. | |
* | |
* @return {*} The return value of executing the single dispatch. | |
*/ | |
function executeDirectDispatch(event) { | |
if (process.env.NODE_ENV !== 'production') { | |
validateEventDispatches(event); | |
} | |
var dispatchListener = event._dispatchListeners; | |
var dispatchInstance = event._dispatchInstances; | |
!!Array.isArray(dispatchListener) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'executeDirectDispatch(...): Invalid `event`.') : _prodInvariant('103') : void 0; | |
event.currentTarget = dispatchListener ? EventPluginUtils.getNodeFromInstance(dispatchInstance) : null; | |
var res = dispatchListener ? dispatchListener(event) : null; | |
event.currentTarget = null; | |
event._dispatchListeners = null; | |
event._dispatchInstances = null; | |
return res; | |
} | |
/** | |
* @param {SyntheticEvent} event | |
* @return {boolean} True iff number of dispatches accumulated is greater than 0. | |
*/ | |
function hasDispatches(event) { | |
return !!event._dispatchListeners; | |
} | |
/** | |
* General utilities that are useful in creating custom Event Plugins. | |
*/ | |
var EventPluginUtils = { | |
isEndish: isEndish, | |
isMoveish: isMoveish, | |
isStartish: isStartish, | |
executeDirectDispatch: executeDirectDispatch, | |
executeDispatchesInOrder: executeDispatchesInOrder, | |
executeDispatchesInOrderStopAtTrue: executeDispatchesInOrderStopAtTrue, | |
hasDispatches: hasDispatches, | |
getInstanceFromNode: function getInstanceFromNode(node) { | |
return ComponentTree.getInstanceFromNode(node); | |
}, | |
getNodeFromInstance: function getNodeFromInstance(node) { | |
return ComponentTree.getNodeFromInstance(node); | |
}, | |
isAncestor: function isAncestor(a, b) { | |
return TreeTraversal.isAncestor(a, b); | |
}, | |
getLowestCommonAncestor: function getLowestCommonAncestor(a, b) { | |
return TreeTraversal.getLowestCommonAncestor(a, b); | |
}, | |
getParentInstance: function getParentInstance(inst) { | |
return TreeTraversal.getParentInstance(inst); | |
}, | |
traverseTwoPhase: function traverseTwoPhase(target, fn, arg) { | |
return TreeTraversal.traverseTwoPhase(target, fn, arg); | |
}, | |
traverseEnterLeave: function traverseEnterLeave(from, to, fn, argFrom, argTo) { | |
return TreeTraversal.traverseEnterLeave(from, to, fn, argFrom, argTo); | |
}, | |
injection: injection | |
}; | |
module.exports = EventPluginUtils; | |
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0))) | |
/***/ }), | |
/* 42 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
"use strict"; | |
/** | |
* Copyright 2013-present, Facebook, Inc. | |
* All rights reserved. | |
* | |
* This source code is licensed under the BSD-style license found in the | |
* LICENSE file in the root directory of this source tree. An additional grant | |
* of patent rights can be found in the PATENTS file in the same directory. | |
* | |
* | |
*/ | |
/** | |
* Escape and wrap key so it is safe to use as a reactid | |
* | |
* @param {string} key to be escaped. | |
* @return {string} the escaped key. | |
*/ | |
function escape(key) { | |
var escapeRegex = /[=:]/g; | |
var escaperLookup = { | |
'=': '=0', | |
':': '=2' | |
}; | |
var escapedString = ('' + key).replace(escapeRegex, function (match) { | |
return escaperLookup[match]; | |
}); | |
return '$' + escapedString; | |
} | |
/** | |
* Unescape and unwrap key for human-readable display | |
* | |
* @param {string} key to unescape. | |
* @return {string} the unescaped key. | |
*/ | |
function unescape(key) { | |
var unescapeRegex = /(=0|=2)/g; | |
var unescaperLookup = { | |
'=0': '=', | |
'=2': ':' | |
}; | |
var keySubstring = key[0] === '.' && key[1] === '$' ? key.substring(2) : key.substring(1); | |
return ('' + keySubstring).replace(unescapeRegex, function (match) { | |
return unescaperLookup[match]; | |
}); | |
} | |
var KeyEscapeUtils = { | |
escape: escape, | |
unescape: unescape | |
}; | |
module.exports = KeyEscapeUtils; | |
/***/ }), | |
/* 43 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
"use strict"; | |
/* WEBPACK VAR INJECTION */(function(process) {/** | |
* Copyright 2013-present, Facebook, Inc. | |
* All rights reserved. | |
* | |
* This source code is licensed under the BSD-style license found in the | |
* LICENSE file in the root directory of this source tree. An additional grant | |
* of patent rights can be found in the PATENTS file in the same directory. | |
* | |
*/ | |
var _prodInvariant = __webpack_require__(3); | |
var ReactPropTypesSecret = __webpack_require__(73); | |
var propTypesFactory = __webpack_require__(60); | |
var React = __webpack_require__(20); | |
var PropTypes = propTypesFactory(React.isValidElement); | |
var invariant = __webpack_require__(1); | |
var warning = __webpack_require__(2); | |
var hasReadOnlyValue = { | |
button: true, | |
checkbox: true, | |
image: true, | |
hidden: true, | |
radio: true, | |
reset: true, | |
submit: true | |
}; | |
function _assertSingleLink(inputProps) { | |
!(inputProps.checkedLink == null || inputProps.valueLink == null) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Cannot provide a checkedLink and a valueLink. If you want to use checkedLink, you probably don\'t want to use valueLink and vice versa.') : _prodInvariant('87') : void 0; | |
} | |
function _assertValueLink(inputProps) { | |
_assertSingleLink(inputProps); | |
!(inputProps.value == null && inputProps.onChange == null) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Cannot provide a valueLink and a value or onChange event. If you want to use value or onChange, you probably don\'t want to use valueLink.') : _prodInvariant('88') : void 0; | |
} | |
function _assertCheckedLink(inputProps) { | |
_assertSingleLink(inputProps); | |
!(inputProps.checked == null && inputProps.onChange == null) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Cannot provide a checkedLink and a checked property or onChange event. If you want to use checked or onChange, you probably don\'t want to use checkedLink') : _prodInvariant('89') : void 0; | |
} | |
var propTypes = { | |
value: function value(props, propName, componentName) { | |
if (!props[propName] || hasReadOnlyValue[props.type] || props.onChange || props.readOnly || props.disabled) { | |
return null; | |
} | |
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`.'); | |
}, | |
checked: function checked(props, propName, componentName) { | |
if (!props[propName] || props.onChange || props.readOnly || props.disabled) { | |
return null; | |
} | |
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`.'); | |
}, | |
onChange: PropTypes.func | |
}; | |
var loggedTypeFailures = {}; | |
function getDeclarationErrorAddendum(owner) { | |
if (owner) { | |
var name = owner.getName(); | |
if (name) { | |
return ' Check the render method of `' + name + '`.'; | |
} | |
} | |
return ''; | |
} | |
/** | |
* Provide a linked `value` attribute for controlled forms. You should not use | |
* this outside of the ReactDOM controlled form components. | |
*/ | |
var LinkedValueUtils = { | |
checkPropTypes: function checkPropTypes(tagName, props, owner) { | |
for (var propName in propTypes) { | |
if (propTypes.hasOwnProperty(propName)) { | |
var error = propTypes[propName](props, propName, tagName, 'prop', null, ReactPropTypesSecret); | |
} | |
if (error instanceof Error && !(error.message in loggedTypeFailures)) { | |
// Only monitor this failure once because there tends to be a lot of the | |
// same error. | |
loggedTypeFailures[error.message] = true; | |
var addendum = getDeclarationErrorAddendum(owner); | |
process.env.NODE_ENV !== 'production' ? warning(false, 'Failed form propType: %s%s', error.message, addendum) : void 0; | |
} | |
} | |
}, | |
/** | |
* @param {object} inputProps Props for form component | |
* @return {*} current value of the input either from value prop or link. | |
*/ | |
getValue: function getValue(inputProps) { | |
if (inputProps.valueLink) { | |
_assertValueLink(inputProps); | |
return inputProps.valueLink.value; | |
} | |
return inputProps.value; | |
}, | |
/** | |
* @param {object} inputProps Props for form component | |
* @return {*} current checked status of the input either from checked prop | |
* or link. | |
*/ | |
getChecked: function getChecked(inputProps) { | |
if (inputProps.checkedLink) { | |
_assertCheckedLink(inputProps); | |
return inputProps.checkedLink.value; | |
} | |
return inputProps.checked; | |
}, | |
/** | |
* @param {object} inputProps Props for form component | |
* @param {SyntheticEvent} event change event to handle | |
*/ | |
executeOnChange: function executeOnChange(inputProps, event) { | |
if (inputProps.valueLink) { | |
_assertValueLink(inputProps); | |
return inputProps.valueLink.requestChange(event.target.value); | |
} else if (inputProps.checkedLink) { | |
_assertCheckedLink(inputProps); | |
return inputProps.checkedLink.requestChange(event.target.checked); | |
} else if (inputProps.onChange) { | |
return inputProps.onChange.call(undefined, event); | |
} | |
} | |
}; | |
module.exports = LinkedValueUtils; | |
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0))) | |
/***/ }), | |
/* 44 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
"use strict"; | |
/* WEBPACK VAR INJECTION */(function(process) {/** | |
* Copyright 2014-present, Facebook, Inc. | |
* All rights reserved. | |
* | |
* This source code is licensed under the BSD-style license found in the | |
* LICENSE file in the root directory of this source tree. An additional grant | |
* of patent rights can be found in the PATENTS file in the same directory. | |
* | |
* | |
*/ | |
var _prodInvariant = __webpack_require__(3); | |
var invariant = __webpack_require__(1); | |
var injected = false; | |
var ReactComponentEnvironment = { | |
/** | |
* Optionally injectable hook for swapping out mount images in the middle of | |
* the tree. | |
*/ | |
replaceNodeWithMarkup: null, | |
/** | |
* Optionally injectable hook for processing a queue of child updates. Will | |
* later move into MultiChildComponents. | |
*/ | |
processChildrenUpdates: null, | |
injection: { | |
injectEnvironment: function injectEnvironment(environment) { | |
!!injected ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactCompositeComponent: injectEnvironment() can only be called once.') : _prodInvariant('104') : void 0; | |
ReactComponentEnvironment.replaceNodeWithMarkup = environment.replaceNodeWithMarkup; | |
ReactComponentEnvironment.processChildrenUpdates = environment.processChildrenUpdates; | |
injected = true; | |
} | |
} | |
}; | |
module.exports = ReactComponentEnvironment; | |
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0))) | |
/***/ }), | |
/* 45 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
"use strict"; | |
/* WEBPACK VAR INJECTION */(function(process) {/** | |
* Copyright 2013-present, Facebook, Inc. | |
* All rights reserved. | |
* | |
* This source code is licensed under the BSD-style license found in the | |
* LICENSE file in the root directory of this source tree. An additional grant | |
* of patent rights can be found in the PATENTS file in the same directory. | |
* | |
* | |
*/ | |
var caughtError = null; | |
/** | |
* Call a function while guarding against errors that happens within it. | |
* | |
* @param {String} name of the guard to use for logging or debugging | |
* @param {Function} func The function to invoke | |
* @param {*} a First argument | |
* @param {*} b Second argument | |
*/ | |
function invokeGuardedCallback(name, func, a) { | |
try { | |
func(a); | |
} catch (x) { | |
if (caughtError === null) { | |
caughtError = x; | |
} | |
} | |
} | |
var ReactErrorUtils = { | |
invokeGuardedCallback: invokeGuardedCallback, | |
/** | |
* Invoked by ReactTestUtils.Simulate so that any errors thrown by the event | |
* handler are sure to be rethrown by rethrowCaughtError. | |
*/ | |
invokeGuardedCallbackWithCatch: invokeGuardedCallback, | |
/** | |
* During execution of guarded functions we will capture the first error which | |
* we will rethrow to be handled by the top level error handler. | |
*/ | |
rethrowCaughtError: function rethrowCaughtError() { | |
if (caughtError) { | |
var error = caughtError; | |
caughtError = null; | |
throw error; | |
} | |
} | |
}; | |
if (process.env.NODE_ENV !== 'production') { | |
/** | |
* To help development we can get better devtools integration by simulating a | |
* real browser event. | |
*/ | |
if (typeof window !== 'undefined' && typeof window.dispatchEvent === 'function' && typeof document !== 'undefined' && typeof document.createEvent === 'function') { | |
var fakeNode = document.createElement('react'); | |
ReactErrorUtils.invokeGuardedCallback = function (name, func, a) { | |
var boundFunc = func.bind(null, a); | |
var evtType = 'react-' + name; | |
fakeNode.addEventListener(evtType, boundFunc, false); | |
var evt = document.createEvent('Event'); | |
evt.initEvent(evtType, false, false); | |
fakeNode.dispatchEvent(evt); | |
fakeNode.removeEventListener(evtType, boundFunc, false); | |
}; | |
} | |
} | |
module.exports = ReactErrorUtils; | |
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0))) | |
/***/ }), | |
/* 46 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
"use strict"; | |
/* WEBPACK VAR INJECTION */(function(process) {/** | |
* Copyright 2015-present, Facebook, Inc. | |
* All rights reserved. | |
* | |
* This source code is licensed under the BSD-style license found in the | |
* LICENSE file in the root directory of this source tree. An additional grant | |
* of patent rights can be found in the PATENTS file in the same directory. | |
* | |
*/ | |
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; | |
var _prodInvariant = __webpack_require__(3); | |
var ReactCurrentOwner = __webpack_require__(11); | |
var ReactInstanceMap = __webpack_require__(25); | |
var ReactInstrumentation = __webpack_require__(9); | |
var ReactUpdates = __webpack_require__(10); | |
var invariant = __webpack_require__(1); | |
var warning = __webpack_require__(2); | |
function enqueueUpdate(internalInstance) { | |
ReactUpdates.enqueueUpdate(internalInstance); | |
} | |
function formatUnexpectedArgument(arg) { | |
var type = typeof arg === 'undefined' ? 'undefined' : _typeof(arg); | |
if (type !== 'object') { | |
return type; | |
} | |
var displayName = arg.constructor && arg.constructor.name || type; | |
var keys = Object.keys(arg); | |
if (keys.length > 0 && keys.length < 20) { | |
return displayName + ' (keys: ' + keys.join(', ') + ')'; | |
} | |
return displayName; | |
} | |
function getInternalInstanceReadyForUpdate(publicInstance, callerName) { | |
var internalInstance = ReactInstanceMap.get(publicInstance); | |
if (!internalInstance) { | |
if (process.env.NODE_ENV !== 'production') { | |
var ctor = publicInstance.constructor; | |
// Only warn when we have a callerName. Otherwise we should be silent. | |
// We're probably calling from enqueueCallback. We don't want to warn | |
// there because we already warned for the corresponding lifecycle method. | |
process.env.NODE_ENV !== 'production' ? warning(!callerName, '%s(...): Can only update a mounted or mounting component. ' + 'This usually means you called %s() on an unmounted component. ' + 'This is a no-op. Please check the code for the %s component.', callerName, callerName, ctor && (ctor.displayName || ctor.name) || 'ReactClass') : void 0; | |
} | |
return null; | |
} | |
if (process.env.NODE_ENV !== 'production') { | |
process.env.NODE_ENV !== 'production' ? warning(ReactCurrentOwner.current == null, '%s(...): Cannot update during an existing state transition (such as ' + "within `render` or another component's constructor). Render methods " + 'should be a pure function of props and state; constructor ' + 'side-effects are an anti-pattern, but can be moved to ' + '`componentWillMount`.', callerName) : void 0; | |
} | |
return internalInstance; | |
} | |
/** | |
* ReactUpdateQueue allows for state updates to be scheduled into a later | |
* reconciliation step. | |
*/ | |
var ReactUpdateQueue = { | |
/** | |
* Checks whether or not this composite component is mounted. | |
* @param {ReactClass} publicInstance The instance we want to test. | |
* @return {boolean} True if mounted, false otherwise. | |
* @protected | |
* @final | |
*/ | |
isMounted: function isMounted(publicInstance) { | |
if (process.env.NODE_ENV !== 'production') { | |
var owner = ReactCurrentOwner.current; | |
if (owner !== null) { | |
process.env.NODE_ENV !== 'production' ? warning(owner._warnedAboutRefsInRender, '%s is accessing isMounted inside its render() function. ' + 'render() should be a pure function of props and state. It should ' + 'never access something that requires stale data from the previous ' + 'render, such as refs. Move this logic to componentDidMount and ' + 'componentDidUpdate instead.', owner.getName() || 'A component') : void 0; | |
owner._warnedAboutRefsInRender = true; | |
} | |
} | |
var internalInstance = ReactInstanceMap.get(publicInstance); | |
if (internalInstance) { | |
// During componentWillMount and render this will still be null but after | |
// that will always render to something. At least for now. So we can use | |
// this hack. | |
return !!internalInstance._renderedComponent; | |
} else { | |
return false; | |
} | |
}, | |
/** | |
* Enqueue a callback that will be executed after all the pending updates | |
* have processed. | |
* | |
* @param {ReactClass} publicInstance The instance to use as `this` context. | |
* @param {?function} callback Called after state is updated. | |
* @param {string} callerName Name of the calling function in the public API. | |
* @internal | |
*/ | |
enqueueCallback: function enqueueCallback(publicInstance, callback, callerName) { | |
ReactUpdateQueue.validateCallback(callback, callerName); | |
var internalInstance = getInternalInstanceReadyForUpdate(publicInstance); | |
// Previously we would throw an error if we didn't have an internal | |
// instance. Since we want to make it a no-op instead, we mirror the same | |
// behavior we have in other enqueue* methods. | |
// We also need to ignore callbacks in componentWillMount. See | |
// enqueueUpdates. | |
if (!internalInstance) { | |
return null; | |
} | |
if (internalInstance._pendingCallbacks) { | |
internalInstance._pendingCallbacks.push(callback); | |
} else { | |
internalInstance._pendingCallbacks = [callback]; | |
} | |
// TODO: The callback here is ignored when setState is called from | |
// componentWillMount. Either fix it or disallow doing so completely in | |
// favor of getInitialState. Alternatively, we can disallow | |
// componentWillMount during server-side rendering. | |
enqueueUpdate(internalInstance); | |
}, | |
enqueueCallbackInternal: function enqueueCallbackInternal(internalInstance, callback) { | |
if (internalInstance._pendingCallbacks) { | |
internalInstance._pendingCallbacks.push(callback); | |
} else { | |
internalInstance._pendingCallbacks = [callback]; | |
} | |
enqueueUpdate(internalInstance); | |
}, | |
/** | |
* Forces an update. This should only be invoked when it is known with | |
* certainty that we are **not** in a DOM transaction. | |
* | |
* You may want to call this when you know that some deeper aspect of the | |
* component's state has changed but `setState` was not called. | |
* | |
* This will not invoke `shouldComponentUpdate`, but it will invoke | |
* `componentWillUpdate` and `componentDidUpdate`. | |
* | |
* @param {ReactClass} publicInstance The instance that should rerender. | |
* @internal | |
*/ | |
enqueueForceUpdate: function enqueueForceUpdate(publicInstance) { | |
var internalInstance = getInternalInstanceReadyForUpdate(publicInstance, 'forceUpdate'); | |
if (!internalInstance) { | |
return; | |
} | |
internalInstance._pendingForceUpdate = true; | |
enqueueUpdate(internalInstance); | |
}, | |
/** | |
* Replaces all of the state. Always use this or `setState` to mutate state. | |
* You should treat `this.state` as immutable. | |
* | |
* There is no guarantee that `this.state` will be immediately updated, so | |
* accessing `this.state` after calling this method may return the old value. | |
* | |
* @param {ReactClass} publicInstance The instance that should rerender. | |
* @param {object} completeState Next state. | |
* @internal | |
*/ | |
enqueueReplaceState: function enqueueReplaceState(publicInstance, completeState, callback) { | |
var internalInstance = getInternalInstanceReadyForUpdate(publicInstance, 'replaceState'); | |
if (!internalInstance) { | |
return; | |
} | |
internalInstance._pendingStateQueue = [completeState]; | |
internalInstance._pendingReplaceState = true; | |
// Future-proof 15.5 | |
if (callback !== undefined && callback !== null) { | |
ReactUpdateQueue.validateCallback(callback, 'replaceState'); | |
if (internalInstance._pendingCallbacks) { | |
internalInstance._pendingCallbacks.push(callback); | |
} else { | |
internalInstance._pendingCallbacks = [callback]; | |
} | |
} | |
enqueueUpdate(internalInstance); | |
}, | |
/** | |
* Sets a subset of the state. This only exists because _pendingState is | |
* internal. This provides a merging strategy that is not available to deep | |
* properties which is confusing. TODO: Expose pendingState or don't use it | |
* during the merge. | |
* | |
* @param {ReactClass} publicInstance The instance that should rerender. | |
* @param {object} partialState Next partial state to be merged with state. | |
* @internal | |
*/ | |
enqueueSetState: function enqueueSetState(publicInstance, partialState) { | |
if (process.env.NODE_ENV !== 'production') { | |
ReactInstrumentation.debugTool.onSetState(); | |
process.env.NODE_ENV !== 'production' ? warning(partialState != null, 'setState(...): You passed an undefined or null state object; ' + 'instead, use forceUpdate().') : void 0; | |
} | |
var internalInstance = getInternalInstanceReadyForUpdate(publicInstance, 'setState'); | |
if (!internalInstance) { | |
return; | |
} | |
var queue = internalInstance._pendingStateQueue || (internalInstance._pendingStateQueue = []); | |
queue.push(partialState); | |
enqueueUpdate(internalInstance); | |
}, | |
enqueueElementInternal: function enqueueElementInternal(internalInstance, nextElement, nextContext) { | |
internalInstance._pendingElement = nextElement; | |
// TODO: introduce _pendingContext instead of setting it directly. | |
internalInstance._context = nextContext; | |
enqueueUpdate(internalInstance); | |
}, | |
validateCallback: function validateCallback(callback, callerName) { | |
!(!callback || typeof callback === 'function') ? process.env.NODE_ENV !== 'production' ? invariant(false, '%s(...): Expected the last optional `callback` argument to be a function. Instead received: %s.', callerName, formatUnexpectedArgument(callback)) : _prodInvariant('122', callerName, formatUnexpectedArgument(callback)) : void 0; | |
} | |
}; | |
module.exports = ReactUpdateQueue; | |
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0))) | |
/***/ }), | |
/* 47 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
"use strict"; | |
/** | |
* Copyright 2013-present, Facebook, Inc. | |
* All rights reserved. | |
* | |
* This source code is licensed under the BSD-style license found in the | |
* LICENSE file in the root directory of this source tree. An additional grant | |
* of patent rights can be found in the PATENTS file in the same directory. | |
* | |
*/ | |
/* globals MSApp */ | |
/** | |
* Create a function which has 'unsafe' privileges (required by windows8 apps) | |
*/ | |
var createMicrosoftUnsafeLocalFunction = function createMicrosoftUnsafeLocalFunction(func) { | |
if (typeof MSApp !== 'undefined' && MSApp.execUnsafeLocalFunction) { | |
return function (arg0, arg1, arg2, arg3) { | |
MSApp.execUnsafeLocalFunction(function () { | |
return func(arg0, arg1, arg2, arg3); | |
}); | |
}; | |
} else { | |
return func; | |
} | |
}; | |
module.exports = createMicrosoftUnsafeLocalFunction; | |
/***/ }), | |
/* 48 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
"use strict"; | |
/** | |
* Copyright 2013-present, Facebook, Inc. | |
* All rights reserved. | |
* | |
* This source code is licensed under the BSD-style license found in the | |
* LICENSE file in the root directory of this source tree. An additional grant | |
* of patent rights can be found in the PATENTS file in the same directory. | |
* | |
*/ | |
/** | |
* `charCode` represents the actual "character code" and is safe to use with | |
* `String.fromCharCode`. As such, only keys that correspond to printable | |
* characters produce a valid `charCode`, the only exception to this is Enter. | |
* The Tab-key is considered non-printable and does not have a `charCode`, | |
* presumably because it does not produce a tab-character in browsers. | |
* | |
* @param {object} nativeEvent Native browser event. | |
* @return {number} Normalized `charCode` property. | |
*/ | |
function getEventCharCode(nativeEvent) { | |
var charCode; | |
var keyCode = nativeEvent.keyCode; | |
if ('charCode' in nativeEvent) { | |
charCode = nativeEvent.charCode; | |
// FF does not set `charCode` for the Enter-key, check against `keyCode`. | |
if (charCode === 0 && keyCode === 13) { | |
charCode = 13; | |
} | |
} else { | |
// IE8 does not implement `charCode`, but `keyCode` has the correct value. | |
charCode = keyCode; | |
} | |
// Some non-printable keys are reported in `charCode`/`keyCode`, discard them. | |
// Must not discard the (non-)printable Enter-key. | |
if (charCode >= 32 || charCode === 13) { | |
return charCode; | |
} | |
return 0; | |
} | |
module.exports = getEventCharCode; | |
/***/ }), | |
/* 49 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
"use strict"; | |
/** | |
* Copyright 2013-present, Facebook, Inc. | |
* All rights reserved. | |
* | |
* This source code is licensed under the BSD-style license found in the | |
* LICENSE file in the root directory of this source tree. An additional grant | |
* of patent rights can be found in the PATENTS file in the same directory. | |
* | |
*/ | |
/** | |
* Translation from modifier key to the associated property in the event. | |
* @see http://www.w3.org/TR/DOM-Level-3-Events/#keys-Modifiers | |
*/ | |
var modifierKeyToProp = { | |
Alt: 'altKey', | |
Control: 'ctrlKey', | |
Meta: 'metaKey', | |
Shift: 'shiftKey' | |
}; | |
// IE8 does not implement getModifierState so we simply map it to the only | |
// modifier keys exposed by the event itself, does not support Lock-keys. | |
// Currently, all major browsers except Chrome seems to support Lock-keys. | |
function modifierStateGetter(keyArg) { | |
var syntheticEvent = this; | |
var nativeEvent = syntheticEvent.nativeEvent; | |
if (nativeEvent.getModifierState) { | |
return nativeEvent.getModifierState(keyArg); | |
} | |
var keyProp = modifierKeyToProp[keyArg]; | |
return keyProp ? !!nativeEvent[keyProp] : false; | |
} | |
function getEventModifierState(nativeEvent) { | |
return modifierStateGetter; | |
} | |
module.exports = getEventModifierState; | |
/***/ }), | |
/* 50 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
"use strict"; | |
/** | |
* Copyright 2013-present, Facebook, Inc. | |
* All rights reserved. | |
* | |
* This source code is licensed under the BSD-style license found in the | |
* LICENSE file in the root directory of this source tree. An additional grant | |
* of patent rights can be found in the PATENTS file in the same directory. | |
* | |
*/ | |
/** | |
* Gets the target node from a native browser event by accounting for | |
* inconsistencies in browser DOM APIs. | |
* | |
* @param {object} nativeEvent Native browser event. | |
* @return {DOMEventTarget} Target node. | |
*/ | |
function getEventTarget(nativeEvent) { | |
var target = nativeEvent.target || nativeEvent.srcElement || window; | |
// Normalize SVG <use> element events #4963 | |
if (target.correspondingUseElement) { | |
target = target.correspondingUseElement; | |
} | |
// Safari may fire events on text nodes (Node.TEXT_NODE is 3). | |
// @see http://www.quirksmode.org/js/events_properties.html | |
return target.nodeType === 3 ? target.parentNode : target; | |
} | |
module.exports = getEventTarget; | |
/***/ }), | |
/* 51 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
"use strict"; | |
/** | |
* Copyright 2013-present, Facebook, Inc. | |
* All rights reserved. | |
* | |
* This source code is licensed under the BSD-style license found in the | |
* LICENSE file in the root directory of this source tree. An additional grant | |
* of patent rights can be found in the PATENTS file in the same directory. | |
* | |
*/ | |
var ExecutionEnvironment = __webpack_require__(6); | |
var useHasFeature; | |
if (ExecutionEnvironment.canUseDOM) { | |
useHasFeature = document.implementation && document.implementation.hasFeature && | |
// always returns true in newer browsers as per the standard. | |
// @see http://dom.spec.whatwg.org/#dom-domimplementation-hasfeature | |
document.implementation.hasFeature('', '') !== true; | |
} | |
/** | |
* Checks if an event is supported in the current execution environment. | |
* | |
* NOTE: This will not work correctly for non-generic events such as `change`, | |
* `reset`, `load`, `error`, and `select`. | |
* | |
* Borrows from Modernizr. | |
* | |
* @param {string} eventNameSuffix Event name, e.g. "click". | |
* @param {?boolean} capture Check if the capture phase is supported. | |
* @return {boolean} True if the event is supported. | |
* @internal | |
* @license Modernizr 3.0.0pre (Custom Build) | MIT | |
*/ | |
function isEventSupported(eventNameSuffix, capture) { | |
if (!ExecutionEnvironment.canUseDOM || capture && !('addEventListener' in document)) { | |
return false; | |
} | |
var eventName = 'on' + eventNameSuffix; | |
var isSupported = eventName in document; | |
if (!isSupported) { | |
var element = document.createElement('div'); | |
element.setAttribute(eventName, 'return;'); | |
isSupported = typeof element[eventName] === 'function'; | |
} | |
if (!isSupported && useHasFeature && eventNameSuffix === 'wheel') { | |
// This is the only way to test support for the `wheel` event in IE9+. | |
isSupported = document.implementation.hasFeature('Events.wheel', '3.0'); | |
} | |
return isSupported; | |
} | |
module.exports = isEventSupported; | |
/***/ }), | |
/* 52 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
"use strict"; | |
/** | |
* Copyright 2013-present, Facebook, Inc. | |
* All rights reserved. | |
* | |
* This source code is licensed under the BSD-style license found in the | |
* LICENSE file in the root directory of this source tree. An additional grant | |
* of patent rights can be found in the PATENTS file in the same directory. | |
* | |
*/ | |
/** | |
* Given a `prevElement` and `nextElement`, determines if the existing | |
* instance should be updated as opposed to being destroyed or replaced by a new | |
* instance. Both arguments are elements. This ensures that this logic can | |
* operate on stateless trees without any backing instance. | |
* | |
* @param {?object} prevElement | |
* @param {?object} nextElement | |
* @return {boolean} True if the existing instance should be updated. | |
* @protected | |
*/ | |
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; | |
function shouldUpdateReactComponent(prevElement, nextElement) { | |
var prevEmpty = prevElement === null || prevElement === false; | |
var nextEmpty = nextElement === null || nextElement === false; | |
if (prevEmpty || nextEmpty) { | |
return prevEmpty === nextEmpty; | |
} | |
var prevType = typeof prevElement === 'undefined' ? 'undefined' : _typeof(prevElement); | |
var nextType = typeof nextElement === 'undefined' ? 'undefined' : _typeof(nextElement); | |
if (prevType === 'string' || prevType === 'number') { | |
return nextType === 'string' || nextType === 'number'; | |
} else { | |
return nextType === 'object' && prevElement.type === nextElement.type && prevElement.key === nextElement.key; | |
} | |
} | |
module.exports = shouldUpdateReactComponent; | |
/***/ }), | |
/* 53 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
"use strict"; | |
/* WEBPACK VAR INJECTION */(function(process) {/** | |
* Copyright 2015-present, Facebook, Inc. | |
* All rights reserved. | |
* | |
* This source code is licensed under the BSD-style license found in the | |
* LICENSE file in the root directory of this source tree. An additional grant | |
* of patent rights can be found in the PATENTS file in the same directory. | |
* | |
*/ | |
var _assign = __webpack_require__(4); | |
var emptyFunction = __webpack_require__(8); | |
var warning = __webpack_require__(2); | |
var validateDOMNesting = emptyFunction; | |
if (process.env.NODE_ENV !== 'production') { | |
// This validation code was written based on the HTML5 parsing spec: | |
// https://html.spec.whatwg.org/multipage/syntax.html#has-an-element-in-scope | |
// | |
// Note: this does not catch all invalid nesting, nor does it try to (as it's | |
// not clear what practical benefit doing so provides); instead, we warn only | |
// for cases where the parser will give a parse tree differing from what React | |
// intended. For example, <b><div></div></b> is invalid but we don't warn | |
// because it still parses correctly; we do warn for other cases like nested | |
// <p> tags where the beginning of the second element implicitly closes the | |
// first, causing a confusing mess. | |
// https://html.spec.whatwg.org/multipage/syntax.html#special | |
var specialTags = ['address', 'applet', 'area', 'article', 'aside', 'base', 'basefont', 'bgsound', 'blockquote', 'body', 'br', 'button', 'caption', 'center', 'col', 'colgroup', 'dd', 'details', 'dir', 'div', 'dl', 'dt', 'embed', 'fieldset', 'figcaption', 'figure', 'footer', 'form', 'frame', 'frameset', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'head', 'header', 'hgroup', 'hr', 'html', 'iframe', 'img', 'input', 'isindex', 'li', 'link', 'listing', 'main', 'marquee', 'menu', 'menuitem', 'meta', 'nav', 'noembed', 'noframes', 'noscript', 'object', 'ol', 'p', 'param', 'plaintext', 'pre', 'script', 'section', 'select', 'source', 'style', 'summary', 'table', 'tbody', 'td', 'template', 'textarea', 'tfoot', 'th', 'thead', 'title', 'tr', 'track', 'ul', 'wbr', 'xmp']; | |
// https://html.spec.whatwg.org/multipage/syntax.html#has-an-element-in-scope | |
var inScopeTags = ['applet', 'caption', 'html', 'table', 'td', 'th', 'marquee', 'object', 'template', | |
// https://html.spec.whatwg.org/multipage/syntax.html#html-integration-point | |
// TODO: Distinguish by namespace here -- for <title>, including it here | |
// errs on the side of fewer warnings | |
'foreignObject', 'desc', 'title']; | |
// https://html.spec.whatwg.org/multipage/syntax.html#has-an-element-in-button-scope | |
var buttonScopeTags = inScopeTags.concat(['button']); | |
// https://html.spec.whatwg.org/multipage/syntax.html#generate-implied-end-tags | |
var impliedEndTags = ['dd', 'dt', 'li', 'option', 'optgroup', 'p', 'rp', 'rt']; | |
var emptyAncestorInfo = { | |
current: null, | |
formTag: null, | |
aTagInScope: null, | |
buttonTagInScope: null, | |
nobrTagInScope: null, | |
pTagInButtonScope: null, | |
listItemTagAutoclosing: null, | |
dlItemTagAutoclosing: null | |
}; | |
var updatedAncestorInfo = function updatedAncestorInfo(oldInfo, tag, instance) { | |
var ancestorInfo = _assign({}, oldInfo || emptyAncestorInfo); | |
var info = { tag: tag, instance: instance }; | |
if (inScopeTags.indexOf(tag) !== -1) { | |
ancestorInfo.aTagInScope = null; | |
ancestorInfo.buttonTagInScope = null; | |
ancestorInfo.nobrTagInScope = null; | |
} | |
if (buttonScopeTags.indexOf(tag) !== -1) { | |
ancestorInfo.pTagInButtonScope = null; | |
} | |
// See rules for 'li', 'dd', 'dt' start tags in | |
// https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-inbody | |
if (specialTags.indexOf(tag) !== -1 && tag !== 'address' && tag !== 'div' && tag !== 'p') { | |
ancestorInfo.listItemTagAutoclosing = null; | |
ancestorInfo.dlItemTagAutoclosing = null; | |
} | |
ancestorInfo.current = info; | |
if (tag === 'form') { | |
ancestorInfo.formTag = info; | |
} | |
if (tag === 'a') { | |
ancestorInfo.aTagInScope = info; | |
} | |
if (tag === 'button') { | |
ancestorInfo.buttonTagInScope = info; | |
} | |
if (tag === 'nobr') { | |
ancestorInfo.nobrTagInScope = info; | |
} | |
if (tag === 'p') { | |
ancestorInfo.pTagInButtonScope = info; | |
} | |
if (tag === 'li') { | |
ancestorInfo.listItemTagAutoclosing = info; | |
} | |
if (tag === 'dd' || tag === 'dt') { | |
ancestorInfo.dlItemTagAutoclosing = info; | |
} | |
return ancestorInfo; | |
}; | |
/** | |
* Returns whether | |
*/ | |
var isTagValidWithParent = function isTagValidWithParent(tag, parentTag) { | |
// First, let's check if we're in an unusual parsing mode... | |
switch (parentTag) { | |
// https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-inselect | |
case 'select': | |
return tag === 'option' || tag === 'optgroup' || tag === '#text'; | |
case 'optgroup': | |
return tag === 'option' || tag === '#text'; | |
// Strictly speaking, seeing an <option> doesn't mean we're in a <select> | |
// but | |
case 'option': | |
return tag === '#text'; | |
// https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-intd | |
// https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-incaption | |
// No special behavior since these rules fall back to "in body" mode for | |
// all except special table nodes which cause bad parsing behavior anyway. | |
// https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-intr | |
case 'tr': | |
return tag === 'th' || tag === 'td' || tag === 'style' || tag === 'script' || tag === 'template'; | |
// https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-intbody | |
case 'tbody': | |
case 'thead': | |
case 'tfoot': | |
return tag === 'tr' || tag === 'style' || tag === 'script' || tag === 'template'; | |
// https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-incolgroup | |
case 'colgroup': | |
return tag === 'col' || tag === 'template'; | |
// https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-intable | |
case 'table': | |
return tag === 'caption' || tag === 'colgroup' || tag === 'tbody' || tag === 'tfoot' || tag === 'thead' || tag === 'style' || tag === 'script' || tag === 'template'; | |
// https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-inhead | |
case 'head': | |
return tag === 'base' || tag === 'basefont' || tag === 'bgsound' || tag === 'link' || tag === 'meta' || tag === 'title' || tag === 'noscript' || tag === 'noframes' || tag === 'style' || tag === 'script' || tag === 'template'; | |
// https://html.spec.whatwg.org/multipage/semantics.html#the-html-element | |
case 'html': | |
return tag === 'head' || tag === 'body'; | |
case '#document': | |
return tag === 'html'; | |
} | |
// Probably in the "in body" parsing mode, so we outlaw only tag combos | |
// where the parsing rules cause implicit opens or closes to be added. | |
// https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-inbody | |
switch (tag) { | |
case 'h1': | |
case 'h2': | |
case 'h3': | |
case 'h4': | |
case 'h5': | |
case 'h6': | |
return parentTag !== 'h1' && parentTag !== 'h2' && parentTag !== 'h3' && parentTag !== 'h4' && parentTag !== 'h5' && parentTag !== 'h6'; | |
case 'rp': | |
case 'rt': | |
return impliedEndTags.indexOf(parentTag) === -1; | |
case 'body': | |
case 'caption': | |
case 'col': | |
case 'colgroup': | |
case 'frame': | |
case 'head': | |
case 'html': | |
case 'tbody': | |
case 'td': | |
case 'tfoot': | |
case 'th': | |
case 'thead': | |
case 'tr': | |
// These tags are only valid with a few parents that have special child | |
// parsing rules -- if we're down here, then none of those matched and | |
// so we allow it only if we don't know what the parent is, as all other | |
// cases are invalid. | |
return parentTag == null; | |
} | |
return true; | |
}; | |
/** | |
* Returns whether | |
*/ | |
var findInvalidAncestorForTag = function findInvalidAncestorForTag(tag, ancestorInfo) { | |
switch (tag) { | |
case 'address': | |
case 'article': | |
case 'aside': | |
case 'blockquote': | |
case 'center': | |
case 'details': | |
case 'dialog': | |
case 'dir': | |
case 'div': | |
case 'dl': | |
case 'fieldset': | |
case 'figcaption': | |
case 'figure': | |
case 'footer': | |
case 'header': | |
case 'hgroup': | |
case 'main': | |
case 'menu': | |
case 'nav': | |
case 'ol': | |
case 'p': | |
case 'section': | |
case 'summary': | |
case 'ul': | |
case 'pre': | |
case 'listing': | |
case 'table': | |
case 'hr': | |
case 'xmp': | |
case 'h1': | |
case 'h2': | |
case 'h3': | |
case 'h4': | |
case 'h5': | |
case 'h6': | |
return ancestorInfo.pTagInButtonScope; | |
case 'form': | |
return ancestorInfo.formTag || ancestorInfo.pTagInButtonScope; | |
case 'li': | |
return ancestorInfo.listItemTagAutoclosing; | |
case 'dd': | |
case 'dt': | |
return ancestorInfo.dlItemTagAutoclosing; | |
case 'button': | |
return ancestorInfo.buttonTagInScope; | |
case 'a': | |
// Spec says something about storing a list of markers, but it sounds | |
// equivalent to this check. | |
return ancestorInfo.aTagInScope; | |
case 'nobr': | |
return ancestorInfo.nobrTagInScope; | |
} | |
return null; | |
}; | |
/** | |
* Given a ReactCompositeComponent instance, return a list of its recursive | |
* owners, starting at the root and ending with the instance itself. | |
*/ | |
var findOwnerStack = function findOwnerStack(instance) { | |
if (!instance) { | |
return []; | |
} | |
var stack = []; | |
do { | |
stack.push(instance); | |
} while (instance = instance._currentElement._owner); | |
stack.reverse(); | |
return stack; | |
}; | |
var didWarn = {}; | |
validateDOMNesting = function validateDOMNesting(childTag, childText, childInstance, ancestorInfo) { | |
ancestorInfo = ancestorInfo || emptyAncestorInfo; | |
var parentInfo = ancestorInfo.current; | |
var parentTag = parentInfo && parentInfo.tag; | |
if (childText != null) { | |
process.env.NODE_ENV !== 'production' ? warning(childTag == null, 'validateDOMNesting: when childText is passed, childTag should be null') : void 0; | |
childTag = '#text'; | |
} | |
var invalidParent = isTagValidWithParent(childTag, parentTag) ? null : parentInfo; | |
var invalidAncestor = invalidParent ? null : findInvalidAncestorForTag(childTag, ancestorInfo); | |
var problematic = invalidParent || invalidAncestor; | |
if (problematic) { | |
var ancestorTag = problematic.tag; | |
var ancestorInstance = problematic.instance; | |
var childOwner = childInstance && childInstance._currentElement._owner; | |
var ancestorOwner = ancestorInstance && ancestorInstance._currentElement._owner; | |
var childOwners = findOwnerStack(childOwner); | |
var ancestorOwners = findOwnerStack(ancestorOwner); | |
var minStackLen = Math.min(childOwners.length, ancestorOwners.length); | |
var i; | |
var deepestCommon = -1; | |
for (i = 0; i < minStackLen; i++) { | |
if (childOwners[i] === ancestorOwners[i]) { | |
deepestCommon = i; | |
} else { | |
break; | |
} | |
} | |
var UNKNOWN = '(unknown)'; | |
var childOwnerNames = childOwners.slice(deepestCommon + 1).map(function (inst) { | |
return inst.getName() || UNKNOWN; | |
}); | |
var ancestorOwnerNames = ancestorOwners.slice(deepestCommon + 1).map(function (inst) { | |
return inst.getName() || UNKNOWN; | |
}); | |
var ownerInfo = [].concat( | |
// If the parent and child instances have a common owner ancestor, start | |
// with that -- otherwise we just start with the parent's owners. | |
deepestCommon !== -1 ? childOwners[deepestCommon].getName() || UNKNOWN : [], ancestorOwnerNames, ancestorTag, | |
// If we're warning about an invalid (non-parent) ancestry, add '...' | |
invalidAncestor ? ['...'] : [], childOwnerNames, childTag).join(' > '); | |
var warnKey = !!invalidParent + '|' + childTag + '|' + ancestorTag + '|' + ownerInfo; | |
if (didWarn[warnKey]) { | |
return; | |
} | |
didWarn[warnKey] = true; | |
var tagDisplayName = childTag; | |
var whitespaceInfo = ''; | |
if (childTag === '#text') { | |
if (/\S/.test(childText)) { | |
tagDisplayName = 'Text nodes'; | |
} else { | |
tagDisplayName = 'Whitespace text nodes'; | |
whitespaceInfo = " Make sure you don't have any extra whitespace between tags on " + 'each line of your source code.'; | |
} | |
} else { | |
tagDisplayName = '<' + childTag + '>'; | |
} | |
if (invalidParent) { | |
var info = ''; | |
if (ancestorTag === 'table' && childTag === 'tr') { | |
info += ' Add a <tbody> to your code to match the DOM tree generated by ' + 'the browser.'; | |
} | |
process.env.NODE_ENV !== 'production' ? warning(false, 'validateDOMNesting(...): %s cannot appear as a child of <%s>.%s ' + 'See %s.%s', tagDisplayName, ancestorTag, whitespaceInfo, ownerInfo, info) : void 0; | |
} else { | |
process.env.NODE_ENV !== 'production' ? warning(false, 'validateDOMNesting(...): %s cannot appear as a descendant of ' + '<%s>. See %s.', tagDisplayName, ancestorTag, ownerInfo) : void 0; | |
} | |
} | |
}; | |
validateDOMNesting.updatedAncestorInfo = updatedAncestorInfo; | |
// For testing | |
validateDOMNesting.isTagValidInContext = function (tag, ancestorInfo) { | |
ancestorInfo = ancestorInfo || emptyAncestorInfo; | |
var parentInfo = ancestorInfo.current; | |
var parentTag = parentInfo && parentInfo.tag; | |
return isTagValidWithParent(tag, parentTag) && !findInvalidAncestorForTag(tag, ancestorInfo); | |
}; | |
} | |
module.exports = validateDOMNesting; | |
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0))) | |
/***/ }), | |
/* 54 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
"use strict"; | |
/* WEBPACK VAR INJECTION */(function(process) {/** | |
* Copyright 2014-2015, Facebook, Inc. | |
* All rights reserved. | |
* | |
* This source code is licensed under the BSD-style license found in the | |
* LICENSE file in the root directory of this source tree. An additional grant | |
* of patent rights can be found in the PATENTS file in the same directory. | |
* | |
*/ | |
/** | |
* Forked from fbjs/warning: | |
* https://github.com/facebook/fbjs/blob/e66ba20ad5be433eb54423f2b097d829324d9de6/packages/fbjs/src/__forks__/warning.js | |
* | |
* Only change is we use console.warn instead of console.error, | |
* and do nothing when 'console' is not supported. | |
* This really simplifies the code. | |
* --- | |
* Similar to invariant but only logs a warning if the condition is not met. | |
* This can be used to log issues in development environments in critical | |
* paths. Removing the logging code for production environments will keep the | |
* same logic and follow the same code paths. | |
*/ | |
var lowPriorityWarning = function lowPriorityWarning() {}; | |
if (process.env.NODE_ENV !== 'production') { | |
var printWarning = function printWarning(format) { | |
for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { | |
args[_key - 1] = arguments[_key]; | |
} | |
var argIndex = 0; | |
var message = 'Warning: ' + format.replace(/%s/g, function () { | |
return args[argIndex++]; | |
}); | |
if (typeof console !== 'undefined') { | |
console.warn(message); | |
} | |
try { | |
// --- Welcome to debugging React --- | |
// This error was thrown as a convenience so that you can use this stack | |
// to find the callsite that caused this warning to fire. | |
throw new Error(message); | |
} catch (x) {} | |
}; | |
lowPriorityWarning = function lowPriorityWarning(condition, format) { | |
if (format === undefined) { | |
throw new Error('`warning(condition, format, ...args)` requires a warning ' + 'message argument'); | |
} | |
if (!condition) { | |
for (var _len2 = arguments.length, args = Array(_len2 > 2 ? _len2 - 2 : 0), _key2 = 2; _key2 < _len2; _key2++) { | |
args[_key2 - 2] = arguments[_key2]; | |
} | |
printWarning.apply(undefined, [format].concat(args)); | |
} | |
}; | |
} | |
module.exports = lowPriorityWarning; | |
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0))) | |
/***/ }), | |
/* 55 */ | |
/***/ (function(module, __webpack_exports__, __webpack_require__) { | |
"use strict"; | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return states; }); | |
/* harmony export (immutable) */ __webpack_exports__["d"] = loadPosts; | |
/* harmony export (immutable) */ __webpack_exports__["e"] = blogUrl; | |
/* harmony export (immutable) */ __webpack_exports__["b"] = loadPositions; | |
/* harmony export (immutable) */ __webpack_exports__["c"] = inviteToSlack; | |
var states = { | |
LOADING: 'loading', | |
LOADED: 'loaded', | |
ERROR: 'error' | |
}; | |
var LOCAL_URL = 'http://localhost:8080/api'; | |
var PROD_URL = '/api'; | |
var PROD_FORCED_URL = null; // 'http://sourced.tech/api' | |
var BLOG_URL = '//blog.sourced.tech'; | |
function checkStatus(response) { | |
if (response.status >= 200 && response.status < 300) { | |
return response; | |
} | |
var error = new Error(response.statusText); | |
error.response = response; | |
throw error; | |
} | |
function apiURL(url) { | |
var baseURL = window.location.href.indexOf('://localhost') >= 0 ? LOCAL_URL : PROD_URL; | |
return (PROD_FORCED_URL || baseURL) + url; | |
} | |
function request(url) { | |
return fetch(url).then(checkStatus).then(function (resp) { | |
return resp.json(); | |
}); | |
} | |
function loadPosts(category) { | |
return request(apiURL('/posts/' + category)).then(function (resp) { | |
var posts = resp.Posts.slice(0, 3); | |
return posts.length > 0 ? posts : Promise.reject(new Error('empty response')); | |
}); | |
} | |
function blogUrl(path) { | |
if (path.indexOf('//') === 0 || path.indexOf('http') === 0) { | |
return path; | |
} | |
return BLOG_URL + '/' + path.trim('/'); | |
} | |
var POSITIONS_URL = '/positions'; | |
function loadPositions() { | |
var url = apiURL(POSITIONS_URL); | |
return request(url).then(function (resp) { | |
return resp; | |
}); | |
} | |
function inviteToSlack(endpoint, email) { | |
return fetch(apiURL(endpoint), { | |
method: 'POST', | |
headers: { 'Content-Type': 'application/json' }, | |
body: JSON.stringify({ email: email }) | |
}); | |
} | |
/***/ }), | |
/* 56 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
var encode = __webpack_require__(104), | |
decode = __webpack_require__(102); | |
exports.decode = function (data, level) { | |
return (!level || level <= 0 ? decode.XML : decode.HTML)(data); | |
}; | |
exports.decodeStrict = function (data, level) { | |
return (!level || level <= 0 ? decode.XML : decode.HTMLStrict)(data); | |
}; | |
exports.encode = function (data, level) { | |
return (!level || level <= 0 ? encode.XML : encode.HTML)(data); | |
}; | |
exports.encodeXML = encode.XML; | |
exports.encodeHTML4 = exports.encodeHTML5 = exports.encodeHTML = encode.HTML; | |
exports.decodeXML = exports.decodeXMLStrict = decode.XML; | |
exports.decodeHTML4 = exports.decodeHTML5 = exports.decodeHTML = decode.HTML; | |
exports.decodeHTML4Strict = exports.decodeHTML5Strict = exports.decodeHTMLStrict = decode.HTMLStrict; | |
exports.escape = encode.escape; | |
/***/ }), | |
/* 57 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
"use strict"; | |
/* WEBPACK VAR INJECTION */(function(process) { | |
/** | |
* Copyright (c) 2013-present, Facebook, Inc. | |
* All rights reserved. | |
* | |
* This source code is licensed under the BSD-style license found in the | |
* LICENSE file in the root directory of this source tree. An additional grant | |
* of patent rights can be found in the PATENTS file in the same directory. | |
* | |
* @typechecks | |
*/ | |
var emptyFunction = __webpack_require__(8); | |
/** | |
* Upstream version of event listener. Does not take into account specific | |
* nature of platform. | |
*/ | |
var EventListener = { | |
/** | |
* Listen to DOM events during the bubble phase. | |
* | |
* @param {DOMEventTarget} target DOM element to register listener on. | |
* @param {string} eventType Event type, e.g. 'click' or 'mouseover'. | |
* @param {function} callback Callback function. | |
* @return {object} Object with a `remove` method. | |
*/ | |
listen: function listen(target, eventType, callback) { | |
if (target.addEventListener) { | |
target.addEventListener(eventType, callback, false); | |
return { | |
remove: function remove() { | |
target.removeEventListener(eventType, callback, false); | |
} | |
}; | |
} else if (target.attachEvent) { | |
target.attachEvent('on' + eventType, callback); | |
return { | |
remove: function remove() { | |
target.detachEvent('on' + eventType, callback); | |
} | |
}; | |
} | |
}, | |
/** | |
* Listen to DOM events during the capture phase. | |
* | |
* @param {DOMEventTarget} target DOM element to register listener on. | |
* @param {string} eventType Event type, e.g. 'click' or 'mouseover'. | |
* @param {function} callback Callback function. | |
* @return {object} Object with a `remove` method. | |
*/ | |
capture: function capture(target, eventType, callback) { | |
if (target.addEventListener) { | |
target.addEventListener(eventType, callback, true); | |
return { | |
remove: function remove() { | |
target.removeEventListener(eventType, callback, true); | |
} | |
}; | |
} else { | |
if (process.env.NODE_ENV !== 'production') { | |
console.error('Attempted to listen to events during the capture phase on a ' + 'browser that does not support the capture phase. Your application ' + 'will not receive some events.'); | |
} | |
return { | |
remove: emptyFunction | |
}; | |
} | |
}, | |
registerDefault: function registerDefault() {} | |
}; | |
module.exports = EventListener; | |
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0))) | |
/***/ }), | |
/* 58 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
"use strict"; | |
/** | |
* Copyright (c) 2013-present, Facebook, Inc. | |
* All rights reserved. | |
* | |
* This source code is licensed under the BSD-style license found in the | |
* LICENSE file in the root directory of this source tree. An additional grant | |
* of patent rights can be found in the PATENTS file in the same directory. | |
* | |
*/ | |
/** | |
* @param {DOMElement} node input/textarea to focus | |
*/ | |
function focusNode(node) { | |
// IE8 can throw "Can't move focus to the control because it is invisible, | |
// not enabled, or of a type that does not accept the focus." for all kinds of | |
// reasons that are too expensive and fragile to test. | |
try { | |
node.focus(); | |
} catch (e) {} | |
} | |
module.exports = focusNode; | |
/***/ }), | |
/* 59 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
"use strict"; | |
/** | |
* Copyright (c) 2013-present, Facebook, Inc. | |
* All rights reserved. | |
* | |
* This source code is licensed under the BSD-style license found in the | |
* LICENSE file in the root directory of this source tree. An additional grant | |
* of patent rights can be found in the PATENTS file in the same directory. | |
* | |
* @typechecks | |
*/ | |
/* eslint-disable fb-www/typeof-undefined */ | |
/** | |
* Same as document.activeElement but wraps in a try-catch block. In IE it is | |
* not safe to call document.activeElement if there is nothing focused. | |
* | |
* The activeElement will be null only if the document or document body is not | |
* yet defined. | |
* | |
* @param {?DOMDocument} doc Defaults to current document. | |
* @return {?DOMElement} | |
*/ | |
function getActiveElement(doc) /*?DOMElement*/{ | |
doc = doc || (typeof document !== 'undefined' ? document : undefined); | |
if (typeof doc === 'undefined') { | |
return null; | |
} | |
try { | |
return doc.activeElement || doc.body; | |
} catch (e) { | |
return doc.body; | |
} | |
} | |
module.exports = getActiveElement; | |
/***/ }), | |
/* 60 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
"use strict"; | |
/** | |
* Copyright 2013-present, Facebook, Inc. | |
* All rights reserved. | |
* | |
* This source code is licensed under the BSD-style license found in the | |
* LICENSE file in the root directory of this source tree. An additional grant | |
* of patent rights can be found in the PATENTS file in the same directory. | |
*/ | |
// React 15.5 references this module, and assumes PropTypes are still callable in production. | |
// Therefore we re-export development-only version with all the PropTypes checks here. | |
// However if one is migrating to the `prop-types` npm library, they will go through the | |
// `index.js` entry point, and it will branch depending on the environment. | |
var factory = __webpack_require__(61); | |
module.exports = function (isValidElement) { | |
// It is still allowed in 15.5. | |
var throwOnDirectAccess = false; | |
return factory(isValidElement, throwOnDirectAccess); | |
}; | |
/***/ }), | |
/* 61 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
"use strict"; | |
/* WEBPACK VAR INJECTION */(function(process) {/** | |
* Copyright 2013-present, Facebook, Inc. | |
* All rights reserved. | |
* | |
* This source code is licensed under the BSD-style license found in the | |
* LICENSE file in the root directory of this source tree. An additional grant | |
* of patent rights can be found in the PATENTS file in the same directory. | |
*/ | |
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; | |
var emptyFunction = __webpack_require__(8); | |
var invariant = __webpack_require__(1); | |
var warning = __webpack_require__(2); | |
var ReactPropTypesSecret = __webpack_require__(38); | |
var checkPropTypes = __webpack_require__(305); | |
module.exports = function (isValidElement, throwOnDirectAccess) { | |
/* global Symbol */ | |
var ITERATOR_SYMBOL = typeof Symbol === 'function' && Symbol.iterator; | |
var FAUX_ITERATOR_SYMBOL = '@@iterator'; // Before Symbol spec. | |
/** | |
* Returns the iterator method function contained on the iterable object. | |
* | |
* Be sure to invoke the function with the iterable as context: | |
* | |
* var iteratorFn = getIteratorFn(myIterable); | |
* if (iteratorFn) { | |
* var iterator = iteratorFn.call(myIterable); | |
* ... | |
* } | |
* | |
* @param {?object} maybeIterable | |
* @return {?function} | |
*/ | |
function getIteratorFn(maybeIterable) { | |
var iteratorFn = maybeIterable && (ITERATOR_SYMBOL && maybeIterable[ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL]); | |
if (typeof iteratorFn === 'function') { | |
return iteratorFn; | |
} | |
} | |
/** | |
* Collection of methods that allow declaration and validation of props that are | |
* supplied to React components. Example usage: | |
* | |
* var Props = require('ReactPropTypes'); | |
* var MyArticle = React.createClass({ | |
* propTypes: { | |
* // An optional string prop named "description". | |
* description: Props.string, | |
* | |
* // A required enum prop named "category". | |
* category: Props.oneOf(['News','Photos']).isRequired, | |
* | |
* // A prop named "dialog" that requires an instance of Dialog. | |
* dialog: Props.instanceOf(Dialog).isRequired | |
* }, | |
* render: function() { ... } | |
* }); | |
* | |
* A more formal specification of how these methods are used: | |
* | |
* type := array|bool|func|object|number|string|oneOf([...])|instanceOf(...) | |
* decl := ReactPropTypes.{type}(.isRequired)? | |
* | |
* Each and every declaration produces a function with the same signature. This | |
* allows the creation of custom validation functions. For example: | |
* | |
* var MyLink = React.createClass({ | |
* propTypes: { | |
* // An optional string or URI prop named "href". | |
* href: function(props, propName, componentName) { | |
* var propValue = props[propName]; | |
* if (propValue != null && typeof propValue !== 'string' && | |
* !(propValue instanceof URI)) { | |
* return new Error( | |
* 'Expected a string or an URI for ' + propName + ' in ' + | |
* componentName | |
* ); | |
* } | |
* } | |
* }, | |
* render: function() {...} | |
* }); | |
* | |
* @internal | |
*/ | |
var ANONYMOUS = '<<anonymous>>'; | |
// Important! | |
// Keep this list in sync with production version in `./factoryWithThrowingShims.js`. | |
var ReactPropTypes = { | |
array: createPrimitiveTypeChecker('array'), | |
bool: createPrimitiveTypeChecker('boolean'), | |
func: createPrimitiveTypeChecker('function'), | |
number: createPrimitiveTypeChecker('number'), | |
object: createPrimitiveTypeChecker('object'), | |
string: createPrimitiveTypeChecker('string'), | |
symbol: createPrimitiveTypeChecker('symbol'), | |
any: createAnyTypeChecker(), | |
arrayOf: createArrayOfTypeChecker, | |
element: createElementTypeChecker(), | |
instanceOf: createInstanceTypeChecker, | |
node: createNodeChecker(), | |
objectOf: createObjectOfTypeChecker, | |
oneOf: createEnumTypeChecker, | |
oneOfType: createUnionTypeChecker, | |
shape: createShapeTypeChecker | |
}; | |
/** | |
* inlined Object.is polyfill to avoid requiring consumers ship their own | |
* https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is | |
*/ | |
/*eslint-disable no-self-compare*/ | |
function is(x, y) { | |
// SameValue algorithm | |
if (x === y) { | |
// Steps 1-5, 7-10 | |
// Steps 6.b-6.e: +0 != -0 | |
return x !== 0 || 1 / x === 1 / y; | |
} else { | |
// Step 6.a: NaN == NaN | |
return x !== x && y !== y; | |
} | |
} | |
/*eslint-enable no-self-compare*/ | |
/** | |
* We use an Error-like object for backward compatibility as people may call | |
* PropTypes directly and inspect their output. However, we don't use real | |
* Errors anymore. We don't inspect their stack anyway, and creating them | |
* is prohibitively expensive if they are created too often, such as what | |
* happens in oneOfType() for any type before the one that matched. | |
*/ | |
function PropTypeError(message) { | |
this.message = message; | |
this.stack = ''; | |
} | |
// Make `instanceof Error` still work for returned errors. | |
PropTypeError.prototype = Error.prototype; | |
function createChainableTypeChecker(validate) { | |
if (process.env.NODE_ENV !== 'production') { | |
var manualPropTypeCallCache = {}; | |
var manualPropTypeWarningCount = 0; | |
} | |
function checkType(isRequired, props, propName, componentName, location, propFullName, secret) { | |
componentName = componentName || ANONYMOUS; | |
propFullName = propFullName || propName; | |
if (secret !== ReactPropTypesSecret) { | |
if (throwOnDirectAccess) { | |
// New behavior only for users of `prop-types` package | |
invariant(false, 'Calling PropTypes validators directly is not supported by the `prop-types` package. ' + 'Use `PropTypes.checkPropTypes()` to call them. ' + 'Read more at http://fb.me/use-check-prop-types'); | |
} else if (process.env.NODE_ENV !== 'production' && typeof console !== 'undefined') { | |
// Old behavior for people using React.PropTypes | |
var cacheKey = componentName + ':' + propName; | |
if (!manualPropTypeCallCache[cacheKey] && | |
// Avoid spamming the console because they are often not actionable except for lib authors | |
manualPropTypeWarningCount < 3) { | |
warning(false, 'You are manually calling a React.PropTypes validation ' + 'function for the `%s` prop on `%s`. This is deprecated ' + 'and will throw in the standalone `prop-types` package. ' + '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); | |
manualPropTypeCallCache[cacheKey] = true; | |
manualPropTypeWarningCount++; | |
} | |
} | |
} | |
if (props[propName] == null) { | |
if (isRequired) { | |
if (props[propName] === null) { | |
return new PropTypeError('The ' + location + ' `' + propFullName + '` is marked as required ' + ('in `' + componentName + '`, but its value is `null`.')); | |
} | |
return new PropTypeError('The ' + location + ' `' + propFullName + '` is marked as required in ' + ('`' + componentName + '`, but its value is `undefined`.')); | |
} | |
return null; | |
} else { | |
return validate(props, propName, componentName, location, propFullName); | |
} | |
} | |
var chainedCheckType = checkType.bind(null, false); | |
chainedCheckType.isRequired = checkType.bind(null, true); | |
return chainedCheckType; | |
} | |
function createPrimitiveTypeChecker(expectedType) { | |
function validate(props, propName, componentName, location, propFullName, secret) { | |
var propValue = props[propName]; | |
var propType = getPropType(propValue); | |
if (propType !== expectedType) { | |
// `propValue` being instance of, say, date/regexp, pass the 'object' | |
// check, but we can offer a more precise error message here rather than | |
// 'of type `object`'. | |
var preciseType = getPreciseType(propValue); | |
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + preciseType + '` supplied to `' + componentName + '`, expected ') + ('`' + expectedType + '`.')); | |
} | |
return null; | |
} | |
return createChainableTypeChecker(validate); | |
} | |
function createAnyTypeChecker() { | |
return createChainableTypeChecker(emptyFunction.thatReturnsNull); | |
} | |
function createArrayOfTypeChecker(typeChecker) { | |
function validate(props, propName, componentName, location, propFullName) { | |
if (typeof typeChecker !== 'function') { | |
return new PropTypeError('Property `' + propFullName + '` of component `' + componentName + '` has invalid PropType notation inside arrayOf.'); | |
} | |
var propValue = props[propName]; | |
if (!Array.isArray(propValue)) { | |
var propType = getPropType(propValue); | |
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected an array.')); | |
} | |
for (var i = 0; i < propValue.length; i++) { | |
var error = typeChecker(propValue, i, componentName, location, propFullName + '[' + i + ']', ReactPropTypesSecret); | |
if (error instanceof Error) { | |
return error; | |
} | |
} | |
return null; | |
} | |
return createChainableTypeChecker(validate); | |
} | |
function createElementTypeChecker() { | |
function validate(props, propName, componentName, location, propFullName) { | |
var propValue = props[propName]; | |
if (!isValidElement(propValue)) { | |
var propType = getPropType(propValue); | |
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected a single ReactElement.')); | |
} | |
return null; | |
} | |
return createChainableTypeChecker(validate); | |
} | |
function createInstanceTypeChecker(expectedClass) { | |
function validate(props, propName, componentName, location, propFullName) { | |
if (!(props[propName] instanceof expectedClass)) { | |
var expectedClassName = expectedClass.name || ANONYMOUS; | |
var actualClassName = getClassName(props[propName]); | |
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + actualClassName + '` supplied to `' + componentName + '`, expected ') + ('instance of `' + expectedClassName + '`.')); | |
} | |
return null; | |
} | |
return createChainableTypeChecker(validate); | |
} | |
function createEnumTypeChecker(expectedValues) { | |
if (!Array.isArray(expectedValues)) { | |
process.env.NODE_ENV !== 'production' ? warning(false, 'Invalid argument supplied to oneOf, expected an instance of array.') : void 0; | |
return emptyFunction.thatReturnsNull; | |
} | |
function validate(props, propName, componentName, location, propFullName) { | |
var propValue = props[propName]; | |
for (var i = 0; i < expectedValues.length; i++) { | |
if (is(propValue, expectedValues[i])) { | |
return null; | |
} | |
} | |
var valuesString = JSON.stringify(expectedValues); | |
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of value `' + propValue + '` ' + ('supplied to `' + componentName + '`, expected one of ' + valuesString + '.')); | |
} | |
return createChainableTypeChecker(validate); | |
} | |
function createObjectOfTypeChecker(typeChecker) { | |
function validate(props, propName, componentName, location, propFullName) { | |
if (typeof typeChecker !== 'function') { | |
return new PropTypeError('Property `' + propFullName + '` of component `' + componentName + '` has invalid PropType notation inside objectOf.'); | |
} | |
var propValue = props[propName]; | |
var propType = getPropType(propValue); | |
if (propType !== 'object') { | |
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected an object.')); | |
} | |
for (var key in propValue) { | |
if (propValue.hasOwnProperty(key)) { | |
var error = typeChecker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret); | |
if (error instanceof Error) { | |
return error; | |
} | |
} | |
} | |
return null; | |
} | |
return createChainableTypeChecker(validate); | |
} | |
function createUnionTypeChecker(arrayOfTypeCheckers) { | |
if (!Array.isArray(arrayOfTypeCheckers)) { | |
process.env.NODE_ENV !== 'production' ? warning(false, 'Invalid argument supplied to oneOfType, expected an instance of array.') : void 0; | |
return emptyFunction.thatReturnsNull; | |
} | |
for (var i = 0; i < arrayOfTypeCheckers.length; i++) { | |
var checker = arrayOfTypeCheckers[i]; | |
if (typeof checker !== 'function') { | |
warning(false, 'Invalid argument supplid to oneOfType. Expected an array of check functions, but ' + 'received %s at index %s.', getPostfixForTypeWarning(checker), i); | |
return emptyFunction.thatReturnsNull; | |
} | |
} | |
function validate(props, propName, componentName, location, propFullName) { | |
for (var i = 0; i < arrayOfTypeCheckers.length; i++) { | |
var checker = arrayOfTypeCheckers[i]; | |
if (checker(props, propName, componentName, location, propFullName, ReactPropTypesSecret) == null) { | |
return null; | |
} | |
} | |
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`.')); | |
} | |
return createChainableTypeChecker(validate); | |
} | |
function createNodeChecker() { | |
function validate(props, propName, componentName, location, propFullName) { | |
if (!isNode(props[propName])) { | |
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`, expected a ReactNode.')); | |
} | |
return null; | |
} | |
return createChainableTypeChecker(validate); | |
} | |
function createShapeTypeChecker(shapeTypes) { | |
function validate(props, propName, componentName, location, propFullName) { | |
var propValue = props[propName]; | |
var propType = getPropType(propValue); | |
if (propType !== 'object') { | |
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type `' + propType + '` ' + ('supplied to `' + componentName + '`, expected `object`.')); | |
} | |
for (var key in shapeTypes) { | |
var checker = shapeTypes[key]; | |
if (!checker) { | |
continue; | |
} | |
var error = checker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret); | |
if (error) { | |
return error; | |
} | |
} | |
return null; | |
} | |
return createChainableTypeChecker(validate); | |
} | |
function isNode(propValue) { | |
switch (typeof propValue === 'undefined' ? 'undefined' : _typeof(propValue)) { | |
case 'number': | |
case 'string': | |
case 'undefined': | |
return true; | |
case 'boolean': | |
return !propValue; | |
case 'object': | |
if (Array.isArray(propValue)) { | |
return propValue.every(isNode); | |
} | |
if (propValue === null || isValidElement(propValue)) { | |
return true; | |
} | |
var iteratorFn = getIteratorFn(propValue); | |
if (iteratorFn) { | |
var iterator = iteratorFn.call(propValue); | |
var step; | |
if (iteratorFn !== propValue.entries) { | |
while (!(step = iterator.next()).done) { | |
if (!isNode(step.value)) { | |
return false; | |
} | |
} | |
} else { | |
// Iterator will provide entry [k,v] tuples rather than values. | |
while (!(step = iterator.next()).done) { | |
var entry = step.value; | |
if (entry) { | |
if (!isNode(entry[1])) { | |
return false; | |
} | |
} | |
} | |
} | |
} else { | |
return false; | |
} | |
return true; | |
default: | |
return false; | |
} | |
} | |
function isSymbol(propType, propValue) { | |
// Native Symbol. | |
if (propType === 'symbol') { | |
return true; | |
} | |
// 19.4.3.5 Symbol.prototype[@@toStringTag] === 'Symbol' | |
if (propValue['@@toStringTag'] === 'Symbol') { | |
return true; | |
} | |
// Fallback for non-spec compliant Symbols which are polyfilled. | |
if (typeof Symbol === 'function' && propValue instanceof Symbol) { | |
return true; | |
} | |
return false; | |
} | |
// Equivalent of `typeof` but with special handling for array and regexp. | |
function getPropType(propValue) { | |
var propType = typeof propValue === 'undefined' ? 'undefined' : _typeof(propValue); | |
if (Array.isArray(propValue)) { | |
return 'array'; | |
} | |
if (propValue instanceof RegExp) { | |
// Old webkits (at least until Android 4.0) return 'function' rather than | |
// 'object' for typeof a RegExp. We'll normalize this here so that /bla/ | |
// passes PropTypes.object. | |
return 'object'; | |
} | |
if (isSymbol(propType, propValue)) { | |
return 'symbol'; | |
} | |
return propType; | |
} | |
// This handles more types than `getPropType`. Only used for error messages. | |
// See `createPrimitiveTypeChecker`. | |
function getPreciseType(propValue) { | |
if (typeof propValue === 'undefined' || propValue === null) { | |
return '' + propValue; | |
} | |
var propType = getPropType(propValue); | |
if (propType === 'object') { | |
if (propValue instanceof Date) { | |
return 'date'; | |
} else if (propValue instanceof RegExp) { | |
return 'regexp'; | |
} | |
} | |
return propType; | |
} | |
// Returns a string that is postfixed to a warning about an invalid type. | |
// For example, "undefined" or "of type array" | |
function getPostfixForTypeWarning(value) { | |
var type = getPreciseType(value); | |
switch (type) { | |
case 'array': | |
case 'object': | |
return 'an ' + type; | |
case 'boolean': | |
case 'date': | |
case 'regexp': | |
return 'a ' + type; | |
default: | |
return type; | |
} | |
} | |
// Returns class name of the object, if any. | |
function getClassName(propValue) { | |
if (!propValue.constructor || !propValue.constructor.name) { | |
return ANONYMOUS; | |
} | |
return propValue.constructor.name; | |
} | |
ReactPropTypes.checkPropTypes = checkPropTypes; | |
ReactPropTypes.PropTypes = ReactPropTypes; | |
return ReactPropTypes; | |
}; | |
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0))) | |
/***/ }), | |
/* 62 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
"use strict"; | |
/** | |
* Copyright 2013-present, Facebook, Inc. | |
* All rights reserved. | |
* | |
* This source code is licensed under the BSD-style license found in the | |
* LICENSE file in the root directory of this source tree. An additional grant | |
* of patent rights can be found in the PATENTS file in the same directory. | |
* | |
*/ | |
/** | |
* CSS properties which accept numbers but are not in units of "px". | |
*/ | |
var isUnitlessNumber = { | |
animationIterationCount: true, | |
borderImageOutset: true, | |
borderImageSlice: true, | |
borderImageWidth: true, | |
boxFlex: true, | |
boxFlexGroup: true, | |
boxOrdinalGroup: true, | |
columnCount: true, | |
flex: true, | |
flexGrow: true, | |
flexPositive: true, | |
flexShrink: true, | |
flexNegative: true, | |
flexOrder: true, | |
gridRow: true, | |
gridRowEnd: true, | |
gridRowSpan: true, | |
gridRowStart: true, | |
gridColumn: true, | |
gridColumnEnd: true, | |
gridColumnSpan: true, | |
gridColumnStart: true, | |
fontWeight: true, | |
lineClamp: true, | |
lineHeight: true, | |
opacity: true, | |
order: true, | |
orphans: true, | |
tabSize: true, | |
widows: true, | |
zIndex: true, | |
zoom: true, | |
// SVG-related properties | |
fillOpacity: true, | |
floodOpacity: true, | |
stopOpacity: true, | |
strokeDasharray: true, | |
strokeDashoffset: true, | |
strokeMiterlimit: true, | |
strokeOpacity: true, | |
strokeWidth: true | |
}; | |
/** | |
* @param {string} prefix vendor-specific prefix, eg: Webkit | |
* @param {string} key style name, eg: transitionDuration | |
* @return {string} style name prefixed with `prefix`, properly camelCased, eg: | |
* WebkitTransitionDuration | |
*/ | |
function prefixKey(prefix, key) { | |
return prefix + key.charAt(0).toUpperCase() + key.substring(1); | |
} | |
/** | |
* Support style names that may come passed in prefixed by adding permutations | |
* of vendor prefixes. | |
*/ | |
var prefixes = ['Webkit', 'ms', 'Moz', 'O']; | |
// Using Object.keys here, or else the vanilla for-in loop makes IE8 go into an | |
// infinite loop, because it iterates over the newly added props too. | |
Object.keys(isUnitlessNumber).forEach(function (prop) { | |
prefixes.forEach(function (prefix) { | |
isUnitlessNumber[prefixKey(prefix, prop)] = isUnitlessNumber[prop]; | |
}); | |
}); | |
/** | |
* Most style properties can be unset by doing .style[prop] = '' but IE8 | |
* doesn't like doing that with shorthand properties so for the properties that | |
* IE8 breaks on, which are listed here, we instead unset each of the | |
* individual properties. See http://bugs.jquery.com/ticket/12385. | |
* The 4-value 'clock' properties like margin, padding, border-width seem to | |
* behave without any problems. Curiously, list-style works too without any | |
* special prodding. | |
*/ | |
var shorthandPropertyExpansions = { | |
background: { | |
backgroundAttachment: true, | |
backgroundColor: true, | |
backgroundImage: true, | |
backgroundPositionX: true, | |
backgroundPositionY: true, | |
backgroundRepeat: true | |
}, | |
backgroundPosition: { | |
backgroundPositionX: true, | |
backgroundPositionY: true | |
}, | |
border: { | |
borderWidth: true, | |
borderStyle: true, | |
borderColor: true | |
}, | |
borderBottom: { | |
borderBottomWidth: true, | |
borderBottomStyle: true, | |
borderBottomColor: true | |
}, | |
borderLeft: { | |
borderLeftWidth: true, | |
borderLeftStyle: true, | |
borderLeftColor: true | |
}, | |
borderRight: { | |
borderRightWidth: true, | |
borderRightStyle: true, | |
borderRightColor: true | |
}, | |
borderTop: { | |
borderTopWidth: true, | |
borderTopStyle: true, | |
borderTopColor: true | |
}, | |
font: { | |
fontStyle: true, | |
fontVariant: true, | |
fontWeight: true, | |
fontSize: true, | |
lineHeight: true, | |
fontFamily: true | |
}, | |
outline: { | |
outlineWidth: true, | |
outlineStyle: true, | |
outlineColor: true | |
} | |
}; | |
var CSSProperty = { | |
isUnitlessNumber: isUnitlessNumber, | |
shorthandPropertyExpansions: shorthandPropertyExpansions | |
}; | |
module.exports = CSSProperty; | |
/***/ }), | |
/* 63 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
"use strict"; | |
/* WEBPACK VAR INJECTION */(function(process) {/** | |
* Copyright 2013-present, Facebook, Inc. | |
* All rights reserved. | |
* | |
* This source code is licensed under the BSD-style license found in the | |
* LICENSE file in the root directory of this source tree. An additional grant | |
* of patent rights can be found in the PATENTS file in the same directory. | |
* | |
* | |
*/ | |
var _prodInvariant = __webpack_require__(3); | |
function _classCallCheck(instance, Constructor) { | |
if (!(instance instanceof Constructor)) { | |
throw new TypeError("Cannot call a class as a function"); | |
} | |
} | |
var PooledClass = __webpack_require__(14); | |
var invariant = __webpack_require__(1); | |
/** | |
* A specialized pseudo-event module to help keep track of components waiting to | |
* be notified when their DOM representations are available for use. | |
* | |
* This implements `PooledClass`, so you should never need to instantiate this. | |
* Instead, use `CallbackQueue.getPooled()`. | |
* | |
* @class ReactMountReady | |
* @implements PooledClass | |
* @internal | |
*/ | |
var CallbackQueue = function () { | |
function CallbackQueue(arg) { | |
_classCallCheck(this, CallbackQueue); | |
this._callbacks = null; | |
this._contexts = null; | |
this._arg = arg; | |
} | |
/** | |
* Enqueues a callback to be invoked when `notifyAll` is invoked. | |
* | |
* @param {function} callback Invoked when `notifyAll` is invoked. | |
* @param {?object} context Context to call `callback` with. | |
* @internal | |
*/ | |
CallbackQueue.prototype.enqueue = function enqueue(callback, context) { | |
this._callbacks = this._callbacks || []; | |
this._callbacks.push(callback); | |
this._contexts = this._contexts || []; | |
this._contexts.push(context); | |
}; | |
/** | |
* Invokes all enqueued callbacks and clears the queue. This is invoked after | |
* the DOM representation of a component has been created or updated. | |
* | |
* @internal | |
*/ | |
CallbackQueue.prototype.notifyAll = function notifyAll() { | |
var callbacks = this._callbacks; | |
var contexts = this._contexts; | |
var arg = this._arg; | |
if (callbacks && contexts) { | |
!(callbacks.length === contexts.length) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Mismatched list of contexts in callback queue') : _prodInvariant('24') : void 0; | |
this._callbacks = null; | |
this._contexts = null; | |
for (var i = 0; i < callbacks.length; i++) { | |
callbacks[i].call(contexts[i], arg); | |
} | |
callbacks.length = 0; | |
contexts.length = 0; | |
} | |
}; | |
CallbackQueue.prototype.checkpoint = function checkpoint() { | |
return this._callbacks ? this._callbacks.length : 0; | |
}; | |
CallbackQueue.prototype.rollback = function rollback(len) { | |
if (this._callbacks && this._contexts) { | |
this._callbacks.length = len; | |
this._contexts.length = len; | |
} | |
}; | |
/** | |
* Resets the internal queue. | |
* | |
* @internal | |
*/ | |
CallbackQueue.prototype.reset = function reset() { | |
this._callbacks = null; | |
this._contexts = null; | |
}; | |
/** | |
* `PooledClass` looks for this. | |
*/ | |
CallbackQueue.prototype.destructor = function destructor() { | |
this.reset(); | |
}; | |
return CallbackQueue; | |
}(); | |
module.exports = PooledClass.addPoolingTo(CallbackQueue); | |
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0))) | |
/***/ }), | |
/* 64 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
"use strict"; | |
/* WEBPACK VAR INJECTION */(function(process) {/** | |
* Copyright 2013-present, Facebook, Inc. | |
* All rights reserved. | |
* | |
* This source code is licensed under the BSD-style license found in the | |
* LICENSE file in the root directory of this source tree. An additional grant | |
* of patent rights can be found in the PATENTS file in the same directory. | |
* | |
*/ | |
var DOMProperty = __webpack_require__(13); | |
var ReactDOMComponentTree = __webpack_require__(5); | |
var ReactInstrumentation = __webpack_require__(9); | |
var quoteAttributeValueForBrowser = __webpack_require__(376); | |
var warning = __webpack_require__(2); | |
var VALID_ATTRIBUTE_NAME_REGEX = new RegExp('^[' + DOMProperty.ATTRIBUTE_NAME_START_CHAR + '][' + DOMProperty.ATTRIBUTE_NAME_CHAR + ']*$'); | |
var illegalAttributeNameCache = {}; | |
var validatedAttributeNameCache = {}; | |
function isAttributeNameSafe(attributeName) { | |
if (validatedAttributeNameCache.hasOwnProperty(attributeName)) { | |
return true; | |
} | |
if (illegalAttributeNameCache.hasOwnProperty(attributeName)) { | |
return false; | |
} | |
if (VALID_ATTRIBUTE_NAME_REGEX.test(attributeName)) { | |
validatedAttributeNameCache[attributeName] = true; | |
return true; | |
} | |
illegalAttributeNameCache[attributeName] = true; | |
process.env.NODE_ENV !== 'production' ? warning(false, 'Invalid attribute name: `%s`', attributeName) : void 0; | |
return false; | |
} | |
function shouldIgnoreValue(propertyInfo, value) { | |
return value == null || propertyInfo.hasBooleanValue && !value || propertyInfo.hasNumericValue && isNaN(value) || propertyInfo.hasPositiveNumericValue && value < 1 || propertyInfo.hasOverloadedBooleanValue && value === false; | |
} | |
/** | |
* Operations for dealing with DOM properties. | |
*/ | |
var DOMPropertyOperations = { | |
/** | |
* Creates markup for the ID property. | |
* | |
* @param {string} id Unescaped ID. | |
* @return {string} Markup string. | |
*/ | |
createMarkupForID: function createMarkupForID(id) { | |
return DOMProperty.ID_ATTRIBUTE_NAME + '=' + quoteAttributeValueForBrowser(id); | |
}, | |
setAttributeForID: function setAttributeForID(node, id) { | |
node.setAttribute(DOMProperty.ID_ATTRIBUTE_NAME, id); | |
}, | |
createMarkupForRoot: function createMarkupForRoot() { | |
return DOMProperty.ROOT_ATTRIBUTE_NAME + '=""'; | |
}, | |
setAttributeForRoot: function setAttributeForRoot(node) { | |
node.setAttribute(DOMProperty.ROOT_ATTRIBUTE_NAME, ''); | |
}, | |
/** | |
* Creates markup for a property. | |
* | |
* @param {string} name | |
* @param {*} value | |
* @return {?string} Markup string, or null if the property was invalid. | |
*/ | |
createMarkupForProperty: function createMarkupForProperty(name, value) { | |
var propertyInfo = DOMProperty.properties.hasOwnProperty(name) ? DOMProperty.properties[name] : null; | |
if (propertyInfo) { | |
if (shouldIgnoreValue(propertyInfo, value)) { | |
return ''; | |
} | |
var attributeName = propertyInfo.attributeName; | |
if (propertyInfo.hasBooleanValue || propertyInfo.hasOverloadedBooleanValue && value === true) { | |
return attributeName + '=""'; | |
} | |
return attributeName + '=' + quoteAttributeValueForBrowser(value); | |
} else if (DOMProperty.isCustomAttribute(name)) { | |
if (value == null) { | |
return ''; | |
} | |
return name + '=' + quoteAttributeValueForBrowser(value); | |
} | |
return null; | |
}, | |
/** | |
* Creates markup for a custom property. | |
* | |
* @param {string} name | |
* @param {*} value | |
* @return {string} Markup string, or empty string if the property was invalid. | |
*/ | |
createMarkupForCustomAttribute: function createMarkupForCustomAttribute(name, value) { | |
if (!isAttributeNameSafe(name) || value == null) { | |
return ''; | |
} | |
return name + '=' + quoteAttributeValueForBrowser(value); | |
}, | |
/** | |
* Sets the value for a property on a node. | |
* | |
* @param {DOMElement} node | |
* @param {string} name | |
* @param {*} value | |
*/ | |
setValueForProperty: function setValueForProperty(node, name, value) { | |
var propertyInfo = DOMProperty.properties.hasOwnProperty(name) ? DOMProperty.properties[name] : null; | |
if (propertyInfo) { | |
var mutationMethod = propertyInfo.mutationMethod; | |
if (mutationMethod) { | |
mutationMethod(node, value); | |
} else if (shouldIgnoreValue(propertyInfo, value)) { | |
this.deleteValueForProperty(node, name); | |
return; | |
} else if (propertyInfo.mustUseProperty) { | |
// Contrary to `setAttribute`, object properties are properly | |
// `toString`ed by IE8/9. | |
node[propertyInfo.propertyName] = value; | |
} else { | |
var attributeName = propertyInfo.attributeName; | |
var namespace = propertyInfo.attributeNamespace; | |
// `setAttribute` with objects becomes only `[object]` in IE8/9, | |
// ('' + value) makes it output the correct toString()-value. | |
if (namespace) { | |
node.setAttributeNS(namespace, attributeName, '' + value); | |
} else if (propertyInfo.hasBooleanValue || propertyInfo.hasOverloadedBooleanValue && value === true) { | |
node.setAttribute(attributeName, ''); | |
} else { | |
node.setAttribute(attributeName, '' + value); | |
} | |
} | |
} else if (DOMProperty.isCustomAttribute(name)) { | |
DOMPropertyOperations.setValueForAttribute(node, name, value); | |
return; | |
} | |
if (process.env.NODE_ENV !== 'production') { | |
var payload = {}; | |
payload[name] = value; | |
ReactInstrumentation.debugTool.onHostOperation({ | |
instanceID: ReactDOMComponentTree.getInstanceFromNode(node)._debugID, | |
type: 'update attribute', | |
payload: payload | |
}); | |
} | |
}, | |
setValueForAttribute: function setValueForAttribute(node, name, value) { | |
if (!isAttributeNameSafe(name)) { | |
return; | |
} | |
if (value == null) { | |
node.removeAttribute(name); | |
} else { | |
node.setAttribute(name, '' + value); | |
} | |
if (process.env.NODE_ENV !== 'production') { | |
var payload = {}; | |
payload[name] = value; | |
ReactInstrumentation.debugTool.onHostOperation({ | |
instanceID: ReactDOMComponentTree.getInstanceFromNode(node)._debugID, | |
type: 'update attribute', | |
payload: payload | |
}); | |
} | |
}, | |
/** | |
* Deletes an attributes from a node. | |
* | |
* @param {DOMElement} node | |
* @param {string} name | |
*/ | |
deleteValueForAttribute: function deleteValueForAttribute(node, name) { | |
node.removeAttribute(name); | |
if (process.env.NODE_ENV !== 'production') { | |
ReactInstrumentation.debugTool.onHostOperation({ | |
instanceID: ReactDOMComponentTree.getInstanceFromNode(node)._debugID, | |
type: 'remove attribute', | |
payload: name | |
}); | |
} | |
}, | |
/** | |
* Deletes the value for a property on a node. | |
* | |
* @param {DOMElement} node | |
* @param {string} name | |
*/ | |
deleteValueForProperty: function deleteValueForProperty(node, name) { | |
var propertyInfo = DOMProperty.properties.hasOwnProperty(name) ? DOMProperty.properties[name] : null; | |
if (propertyInfo) { | |
var mutationMethod = propertyInfo.mutationMethod; | |
if (mutationMethod) { | |
mutationMethod(node, undefined); | |
} else if (propertyInfo.mustUseProperty) { | |
var propName = propertyInfo.propertyName; | |
if (propertyInfo.hasBooleanValue) { | |
node[propName] = false; | |
} else { | |
node[propName] = ''; | |
} | |
} else { | |
node.removeAttribute(propertyInfo.attributeName); | |
} | |
} else if (DOMProperty.isCustomAttribute(name)) { | |
node.removeAttribute(name); | |
} | |
if (process.env.NODE_ENV !== 'production') { | |
ReactInstrumentation.debugTool.onHostOperation({ | |
instanceID: ReactDOMComponentTree.getInstanceFromNode(node)._debugID, | |
type: 'remove attribute', | |
payload: name | |
}); | |
} | |
} | |
}; | |
module.exports = DOMPropertyOperations; | |
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0))) | |
/***/ }), | |
/* 65 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
"use strict"; | |
/** | |
* Copyright 2015-present, Facebook, Inc. | |
* All rights reserved. | |
* | |
* This source code is licensed under the BSD-style license found in the | |
* LICENSE file in the root directory of this source tree. An additional grant | |
* of patent rights can be found in the PATENTS file in the same directory. | |
* | |
*/ | |
var ReactDOMComponentFlags = { | |
hasCachedChildNodes: 1 << 0 | |
}; | |
module.exports = ReactDOMComponentFlags; | |
/***/ }), | |
/* 66 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
"use strict"; | |
/* WEBPACK VAR INJECTION */(function(process) {/** | |
* Copyright 2013-present, Facebook, Inc. | |
* All rights reserved. | |
* | |
* This source code is licensed under the BSD-style license found in the | |
* LICENSE file in the root directory of this source tree. An additional grant | |
* of patent rights can be found in the PATENTS file in the same directory. | |
* | |
*/ | |
var _assign = __webpack_require__(4); | |
var LinkedValueUtils = __webpack_require__(43); | |
var ReactDOMComponentTree = __webpack_require__(5); | |
var ReactUpdates = __webpack_require__(10); | |
var warning = __webpack_require__(2); | |
var didWarnValueLink = false; | |
var didWarnValueDefaultValue = false; | |
function updateOptionsIfPendingUpdateAndMounted() { | |
if (this._rootNodeID && this._wrapperState.pendingUpdate) { | |
this._wrapperState.pendingUpdate = false; | |
var props = this._currentElement.props; | |
var value = LinkedValueUtils.getValue(props); | |
if (value != null) { | |
updateOptions(this, Boolean(props.multiple), value); | |
} | |
} | |
} | |
function getDeclarationErrorAddendum(owner) { | |
if (owner) { | |
var name = owner.getName(); | |
if (name) { | |
return ' Check the render method of `' + name + '`.'; | |
} | |
} | |
return ''; | |
} | |
var valuePropNames = ['value', 'defaultValue']; | |
/** | |
* Validation function for `value` and `defaultValue`. | |
* @private | |
*/ | |
function checkSelectPropTypes(inst, props) { | |
var owner = inst._currentElement._owner; | |
LinkedValueUtils.checkPropTypes('select', props, owner); | |
if (props.valueLink !== undefined && !didWarnValueLink) { | |
process.env.NODE_ENV !== 'production' ? warning(false, '`valueLink` prop on `select` is deprecated; set `value` and `onChange` instead.') : void 0; | |
didWarnValueLink = true; | |
} | |
for (var i = 0; i < valuePropNames.length; i++) { | |
var propName = valuePropNames[i]; | |
if (props[propName] == null) { | |
continue; | |
} | |
var isArray = Array.isArray(props[propName]); | |
if (props.multiple && !isArray) { | |
process.env.NODE_ENV !== 'production' ? warning(false, 'The `%s` prop supplied to <select> must be an array if ' + '`multiple` is true.%s', propName, getDeclarationErrorAddendum(owner)) : void 0; | |
} else if (!props.multiple && isArray) { | |
process.env.NODE_ENV !== 'production' ? warning(false, 'The `%s` prop supplied to <select> must be a scalar ' + 'value if `multiple` is false.%s', propName, getDeclarationErrorAddendum(owner)) : void 0; | |
} | |
} | |
} | |
/** | |
* @param {ReactDOMComponent} inst | |
* @param {boolean} multiple | |
* @param {*} propValue A stringable (with `multiple`, a list of stringables). | |
* @private | |
*/ | |
function updateOptions(inst, multiple, propValue) { | |
var selectedValue, i; | |
var options = ReactDOMComponentTree.getNodeFromInstance(inst).options; | |
if (multiple) { | |
selectedValue = {}; | |
for (i = 0; i < propValue.length; i++) { | |
selectedValue['' + propValue[i]] = true; | |
} | |
for (i = 0; i < options.length; i++) { | |
var selected = selectedValue.hasOwnProperty(options[i].value); | |
if (options[i].selected !== selected) { | |
options[i].selected = selected; | |
} | |
} | |
} else { | |
// Do not set `select.value` as exact behavior isn't consistent across all | |
// browsers for all cases. | |
selectedValue = '' + propValue; | |
for (i = 0; i < options.length; i++) { | |
if (options[i].value === selectedValue) { | |
options[i].selected = true; | |
return; | |
} | |
} | |
if (options.length) { | |
options[0].selected = true; | |
} | |
} | |
} | |
/** | |
* Implements a <select> host component that allows optionally setting the | |
* props `value` and `defaultValue`. If `multiple` is false, the prop must be a | |
* stringable. If `multiple` is true, the prop must be an array of stringables. | |
* | |
* If `value` is not supplied (or null/undefined), user actions that change the | |
* selected option will trigger updates to the rendered options. | |
* | |
* If it is supplied (and not null/undefined), the rendered options will not | |
* update in response to user actions. Instead, the `value` prop must change in | |
* order for the rendered options to update. | |
* | |
* If `defaultValue` is provided, any options with the supplied values will be | |
* selected. | |
*/ | |
var ReactDOMSelect = { | |
getHostProps: function getHostProps(inst, props) { | |
return _assign({}, props, { | |
onChange: inst._wrapperState.onChange, | |
value: undefined | |
}); | |
}, | |
mountWrapper: function mountWrapper(inst, props) { | |
if (process.env.NODE_ENV !== 'production') { | |
checkSelectPropTypes(inst, props); | |
} | |
var value = LinkedValueUtils.getValue(props); | |
inst._wrapperState = { | |
pendingUpdate: false, | |
initialValue: value != null ? value : props.defaultValue, | |
listeners: null, | |
onChange: _handleChange.bind(inst), | |
wasMultiple: Boolean(props.multiple) | |
}; | |
if (props.value !== undefined && props.defaultValue !== undefined && !didWarnValueDefaultValue) { | |
process.env.NODE_ENV !== 'production' ? warning(false, 'Select elements must be either controlled or uncontrolled ' + '(specify either the value prop, or the defaultValue prop, but not ' + 'both). Decide between using a controlled or uncontrolled select ' + 'element and remove one of these props. More info: ' + 'https://fb.me/react-controlled-components') : void 0; | |
didWarnValueDefaultValue = true; | |
} | |
}, | |
getSelectValueContext: function getSelectValueContext(inst) { | |
// ReactDOMOption looks at this initial value so the initial generated | |
// markup has correct `selected` attributes | |
return inst._wrapperState.initialValue; | |
}, | |
postUpdateWrapper: function postUpdateWrapper(inst) { | |
var props = inst._currentElement.props; | |
// After the initial mount, we control selected-ness manually so don't pass | |
// this value down | |
inst._wrapperState.initialValue = undefined; | |
var wasMultiple = inst._wrapperState.wasMultiple; | |
inst._wrapperState.wasMultiple = Boolean(props.multiple); | |
var value = LinkedValueUtils.getValue(props); | |
if (value != null) { | |
inst._wrapperState.pendingUpdate = false; | |
updateOptions(inst, Boolean(props.multiple), value); | |
} else if (wasMultiple !== Boolean(props.multiple)) { | |
// For simplicity, reapply `defaultValue` if `multiple` is toggled. | |
if (props.defaultValue != null) { | |
updateOptions(inst, Boolean(props.multiple), props.defaultValue); | |
} else { | |
// Revert the select back to its default unselected state. | |
updateOptions(inst, Boolean(props.multiple), props.multiple ? [] : ''); | |
} | |
} | |
} | |
}; | |
function _handleChange(event) { | |
var props = this._currentElement.props; | |
var returnValue = LinkedValueUtils.executeOnChange(props, event); | |
if (this._rootNodeID) { | |
this._wrapperState.pendingUpdate = true; | |
} | |
ReactUpdates.asap(updateOptionsIfPendingUpdateAndMounted, this); | |
return returnValue; | |
} | |
module.exports = ReactDOMSelect; | |
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0))) | |
/***/ }), | |
/* 67 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
"use strict"; | |
/** | |
* Copyright 2014-present, Facebook, Inc. | |
* All rights reserved. | |
* | |
* This source code is licensed under the BSD-style license found in the | |
* LICENSE file in the root directory of this source tree. An additional grant | |
* of patent rights can be found in the PATENTS file in the same directory. | |
* | |
*/ | |
var emptyComponentFactory; | |
var ReactEmptyComponentInjection = { | |
injectEmptyComponentFactory: function injectEmptyComponentFactory(factory) { | |
emptyComponentFactory = factory; | |
} | |
}; | |
var ReactEmptyComponent = { | |
create: function create(instantiate) { | |
return emptyComponentFactory(instantiate); | |
} | |
}; | |
ReactEmptyComponent.injection = ReactEmptyComponentInjection; | |
module.exports = ReactEmptyComponent; | |
/***/ }), | |
/* 68 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
"use strict"; | |
/** | |
* Copyright 2013-present, Facebook, Inc. | |
* All rights reserved. | |
* | |
* This source code is licensed under the BSD-style license found in the | |
* LICENSE file in the root directory of this source tree. An additional grant | |
* of patent rights can be found in the PATENTS file in the same directory. | |
* | |
* | |
*/ | |
var ReactFeatureFlags = { | |
// When true, call console.time() before and .timeEnd() after each top-level | |
// render (both initial renders and updates). Useful when looking at prod-mode | |
// timeline profiles in Chrome, for example. | |
logTopLevelRenders: false | |
}; | |
module.exports = ReactFeatureFlags; | |
/***/ }), | |
/* 69 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
"use strict"; | |
/* WEBPACK VAR INJECTION */(function(process) {/** | |
* Copyright 2014-present, Facebook, Inc. | |
* All rights reserved. | |
* | |
* This source code is licensed under the BSD-style license found in the | |
* LICENSE file in the root directory of this source tree. An additional grant | |
* of patent rights can be found in the PATENTS file in the same directory. | |
* | |
*/ | |
var _prodInvariant = __webpack_require__(3); | |
var invariant = __webpack_require__(1); | |
var genericComponentClass = null; | |
var textComponentClass = null; | |
var ReactHostComponentInjection = { | |
// This accepts a class that receives the tag string. This is a catch all | |
// that can render any kind of tag. | |
injectGenericComponentClass: function injectGenericComponentClass(componentClass) { | |
genericComponentClass = componentClass; | |
}, | |
// This accepts a text component class that takes the text string to be | |
// rendered as props. | |
injectTextComponentClass: function injectTextComponentClass(componentClass) { | |
textComponentClass = componentClass; | |
} | |
}; | |
/** | |
* Get a host internal component class for a specific tag. | |
* | |
* @param {ReactElement} element The element to create. | |
* @return {function} The internal class constructor function. | |
*/ | |
function createInternalComponent(element) { | |
!genericComponentClass ? process.env.NODE_ENV !== 'production' ? invariant(false, 'There is no registered component for the tag %s', element.type) : _prodInvariant('111', element.type) : void 0; | |
return new genericComponentClass(element); | |
} | |
/** | |
* @param {ReactText} text | |
* @return {ReactComponent} | |
*/ | |
function createInstanceForText(text) { | |
return new textComponentClass(text); | |
} | |
/** | |
* @param {ReactComponent} component | |
* @return {boolean} | |
*/ | |
function isTextComponent(component) { | |
return component instanceof textComponentClass; | |
} | |
var ReactHostComponent = { | |
createInternalComponent: createInternalComponent, | |
createInstanceForText: createInstanceForText, | |
isTextComponent: isTextComponent, | |
injection: ReactHostComponentInjection | |
}; | |
module.exports = ReactHostComponent; | |
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0))) | |
/***/ }), | |
/* 70 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
"use strict"; | |
/** | |
* Copyright 2013-present, Facebook, Inc. | |
* All rights reserved. | |
* | |
* This source code is licensed under the BSD-style license found in the | |
* LICENSE file in the root directory of this source tree. An additional grant | |
* of patent rights can be found in the PATENTS file in the same directory. | |
* | |
*/ | |
var ReactDOMSelection = __webpack_require__(331); | |
var containsNode = __webpack_require__(108); | |
var focusNode = __webpack_require__(58); | |
var getActiveElement = __webpack_require__(59); | |
function isInDocument(node) { | |
return containsNode(document.documentElement, node); | |
} | |
/** | |
* @ReactInputSelection: React input selection module. Based on Selection.js, | |
* but modified to be suitable for react and has a couple of bug fixes (doesn't | |
* assume buttons have range selections allowed). | |
* Input selection module for React. | |
*/ | |
var ReactInputSelection = { | |
hasSelectionCapabilities: function hasSelectionCapabilities(elem) { | |
var nodeName = elem && elem.nodeName && elem.nodeName.toLowerCase(); | |
return nodeName && (nodeName === 'input' && elem.type === 'text' || nodeName === 'textarea' || elem.contentEditable === 'true'); | |
}, | |
getSelectionInformation: function getSelectionInformation() { | |
var focusedElem = getActiveElement(); | |
return { | |
focusedElem: focusedElem, | |
selectionRange: ReactInputSelection.hasSelectionCapabilities(focusedElem) ? ReactInputSelection.getSelection(focusedElem) : null | |
}; | |
}, | |
/** | |
* @restoreSelection: If any selection information was potentially lost, | |
* restore it. This is useful when performing operations that could remove dom | |
* nodes and place them back in, resulting in focus being lost. | |
*/ | |
restoreSelection: function restoreSelection(priorSelectionInformation) { | |
var curFocusedElem = getActiveElement(); | |
var priorFocusedElem = priorSelectionInformation.focusedElem; | |
var priorSelectionRange = priorSelectionInformation.selectionRange; | |
if (curFocusedElem !== priorFocusedElem && isInDocument(priorFocusedElem)) { | |
if (ReactInputSelection.hasSelectionCapabilities(priorFocusedElem)) { | |
ReactInputSelection.setSelection(priorFocusedElem, priorSelectionRange); | |
} | |
focusNode(priorFocusedElem); | |
} | |
}, | |
/** | |
* @getSelection: Gets the selection bounds of a focused textarea, input or | |
* contentEditable node. | |
* -@input: Look up selection bounds of this input | |
* -@return {start: selectionStart, end: selectionEnd} | |
*/ | |
getSelection: function getSelection(input) { | |
var selection; | |
if ('selectionStart' in input) { | |
// Modern browser with input or textarea. | |
selection = { | |
start: input.selectionStart, | |
end: input.selectionEnd | |
}; | |
} else if (document.selection && input.nodeName && input.nodeName.toLowerCase() === 'input') { | |
// IE8 input. | |
var range = document.selection.createRange(); | |
// There can only be one selection per document in IE, so it must | |
// be in our element. | |
if (range.parentElement() === input) { | |
selection = { | |
start: -range.moveStart('character', -input.value.length), | |
end: -range.moveEnd('character', -input.value.length) | |
}; | |
} | |
} else { | |
// Content editable or old IE textarea. | |
selection = ReactDOMSelection.getOffsets(input); | |
} | |
return selection || { start: 0, end: 0 }; | |
}, | |
/** | |
* @setSelection: Sets the selection bounds of a textarea or input and focuses | |
* the input. | |
* -@input Set selection bounds of this input or textarea | |
* -@offsets Object of same form that is returned from get* | |
*/ | |
setSelection: function setSelection(input, offsets) { | |
var start = offsets.start; | |
var end = offsets.end; | |
if (end === undefined) { | |
end = start; | |
} | |
if ('selectionStart' in input) { | |
input.selectionStart = start; | |
input.selectionEnd = Math.min(end, input.value.length); | |
} else if (document.selection && input.nodeName && input.nodeName.toLowerCase() === 'input') { | |
var range = input.createTextRange(); | |
range.collapse(true); | |
range.moveStart('character', start); | |
range.moveEnd('character', end - start); | |
range.select(); | |
} else { | |
ReactDOMSelection.setOffsets(input, offsets); | |
} | |
} | |
}; | |
module.exports = ReactInputSelection; | |
/***/ }), | |
/* 71 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
"use strict"; | |
/* WEBPACK VAR INJECTION */(function(process) {/** | |
* Copyright 2013-present, Facebook, Inc. | |
* All rights reserved. | |
* | |
* This source code is licensed under the BSD-style license found in the | |
* LICENSE file in the root directory of this source tree. An additional grant | |
* of patent rights can be found in the PATENTS file in the same directory. | |
* | |
*/ | |
var _prodInvariant = __webpack_require__(3); | |
var DOMLazyTree = __webpack_require__(18); | |
var DOMProperty = __webpack_require__(13); | |
var React = __webpack_require__(20); | |
var ReactBrowserEventEmitter = __webpack_require__(30); | |
var ReactCurrentOwner = __webpack_require__(11); | |
var ReactDOMComponentTree = __webpack_require__(5); | |
var ReactDOMContainerInfo = __webpack_require__(323); | |
var ReactDOMFeatureFlags = __webpack_require__(325); | |
var ReactFeatureFlags = __webpack_require__(68); | |
var ReactInstanceMap = __webpack_require__(25); | |
var ReactInstrumentation = __webpack_require__(9); | |
var ReactMarkupChecksum = __webpack_require__(345); | |
var ReactReconciler = __webpack_require__(19); | |
var ReactUpdateQueue = __webpack_require__(46); | |
var ReactUpdates = __webpack_require__(10); | |
var emptyObject = __webpack_require__(27); | |
var instantiateReactComponent = __webpack_require__(80); | |
var invariant = __webpack_require__(1); | |
var setInnerHTML = __webpack_require__(34); | |
var shouldUpdateReactComponent = __webpack_require__(52); | |
var warning = __webpack_require__(2); | |
var ATTR_NAME = DOMProperty.ID_ATTRIBUTE_NAME; | |
var ROOT_ATTR_NAME = DOMProperty.ROOT_ATTRIBUTE_NAME; | |
var ELEMENT_NODE_TYPE = 1; | |
var DOC_NODE_TYPE = 9; | |
var DOCUMENT_FRAGMENT_NODE_TYPE = 11; | |
var instancesByReactRootID = {}; | |
/** | |
* Finds the index of the first character | |
* that's not common between the two given strings. | |
* | |
* @return {number} the index of the character where the strings diverge | |
*/ | |
function firstDifferenceIndex(string1, string2) { | |
var minLen = Math.min(string1.length, string2.length); | |
for (var i = 0; i < minLen; i++) { | |
if (string1.charAt(i) !== string2.charAt(i)) { | |
return i; | |
} | |
} | |
return string1.length === string2.length ? -1 : minLen; | |
} | |
/** | |
* @param {DOMElement|DOMDocument} container DOM element that may contain | |
* a React component | |
* @return {?*} DOM element that may have the reactRoot ID, or null. | |
*/ | |
function getReactRootElementInContainer(container) { | |
if (!container) { | |
return null; | |
} | |
if (container.nodeType === DOC_NODE_TYPE) { | |
return container.documentElement; | |
} else { | |
return container.firstChild; | |
} | |
} | |
function internalGetID(node) { | |
// If node is something like a window, document, or text node, none of | |
// which support attributes or a .getAttribute method, gracefully return | |
// the empty string, as if the attribute were missing. | |
return node.getAttribute && node.getAttribute(ATTR_NAME) || ''; | |
} | |
/** | |
* Mounts this component and inserts it into the DOM. | |
* | |
* @param {ReactComponent} componentInstance The instance to mount. | |
* @param {DOMElement} container DOM element to mount into. | |
* @param {ReactReconcileTransaction} transaction | |
* @param {boolean} shouldReuseMarkup If true, do not insert markup | |
*/ | |
function mountComponentIntoNode(wrapperInstance, container, transaction, shouldReuseMarkup, context) { | |
var markerName; | |
if (ReactFeatureFlags.logTopLevelRenders) { | |
var wrappedElement = wrapperInstance._currentElement.props.child; | |
var type = wrappedElement.type; | |
markerName = 'React mount: ' + (typeof type === 'string' ? type : type.displayName || type.name); | |
console.time(markerName); | |
} | |
var markup = ReactReconciler.mountComponent(wrapperInstance, transaction, null, ReactDOMContainerInfo(wrapperInstance, container), context, 0 /* parentDebugID */ | |
); | |
if (markerName) { | |
console.timeEnd(markerName); | |
} | |
wrapperInstance._renderedComponent._topLevelWrapper = wrapperInstance; | |
ReactMount._mountImageIntoNode(markup, container, wrapperInstance, shouldReuseMarkup, transaction); | |
} | |
/** | |
* Batched mount. | |
* | |
* @param {ReactComponent} componentInstance The instance to mount. | |
* @param {DOMElement} container DOM element to mount into. | |
* @param {boolean} shouldReuseMarkup If true, do not insert markup | |
*/ | |
function batchedMountComponentIntoNode(componentInstance, container, shouldReuseMarkup, context) { | |
var transaction = ReactUpdates.ReactReconcileTransaction.getPooled( | |
/* useCreateElement */ | |
!shouldReuseMarkup && ReactDOMFeatureFlags.useCreateElement); | |
transaction.perform(mountComponentIntoNode, null, componentInstance, container, transaction, shouldReuseMarkup, context); | |
ReactUpdates.ReactReconcileTransaction.release(transaction); | |
} | |
/** | |
* Unmounts a component and removes it from the DOM. | |
* | |
* @param {ReactComponent} instance React component instance. | |
* @param {DOMElement} container DOM element to unmount from. | |
* @final | |
* @internal | |
* @see {ReactMount.unmountComponentAtNode} | |
*/ | |
function unmountComponentFromNode(instance, container, safely) { | |
if (process.env.NODE_ENV !== 'production') { | |
ReactInstrumentation.debugTool.onBeginFlush(); | |
} | |
ReactReconciler.unmountComponent(instance, safely); | |
if (process.env.NODE_ENV !== 'production') { | |
ReactInstrumentation.debugTool.onEndFlush(); | |
} | |
if (container.nodeType === DOC_NODE_TYPE) { | |
container = container.documentElement; | |
} | |
// http://jsperf.com/emptying-a-node | |
while (container.lastChild) { | |
container.removeChild(container.lastChild); | |
} | |
} | |
/** | |
* True if the supplied DOM node has a direct React-rendered child that is | |
* not a React root element. Useful for warning in `render`, | |
* `unmountComponentAtNode`, etc. | |
* | |
* @param {?DOMElement} node The candidate DOM node. | |
* @return {boolean} True if the DOM element contains a direct child that was | |
* rendered by React but is not a root element. | |
* @internal | |
*/ | |
function hasNonRootReactChild(container) { | |
var rootEl = getReactRootElementInContainer(container); | |
if (rootEl) { | |
var inst = ReactDOMComponentTree.getInstanceFromNode(rootEl); | |
return !!(inst && inst._hostParent); | |
} | |
} | |
/** | |
* True if the supplied DOM node is a React DOM element and | |
* it has been rendered by another copy of React. | |
* | |
* @param {?DOMElement} node The candidate DOM node. | |
* @return {boolean} True if the DOM has been rendered by another copy of React | |
* @internal | |
*/ | |
function nodeIsRenderedByOtherInstance(container) { | |
var rootEl = getReactRootElementInContainer(container); | |
return !!(rootEl && isReactNode(rootEl) && !ReactDOMComponentTree.getInstanceFromNode(rootEl)); | |
} | |
/** | |
* True if the supplied DOM node is a valid node element. | |
* | |
* @param {?DOMElement} node The candidate DOM node. | |
* @return {boolean} True if the DOM is a valid DOM node. | |
* @internal | |
*/ | |
function isValidContainer(node) { | |
return !!(node && (node.nodeType === ELEMENT_NODE_TYPE || node.nodeType === DOC_NODE_TYPE || node.nodeType === DOCUMENT_FRAGMENT_NODE_TYPE)); | |
} | |
/** | |
* True if the supplied DOM node is a valid React node element. | |
* | |
* @param {?DOMElement} node The candidate DOM node. | |
* @return {boolean} True if the DOM is a valid React DOM node. | |
* @internal | |
*/ | |
function isReactNode(node) { | |
return isValidContainer(node) && (node.hasAttribute(ROOT_ATTR_NAME) || node.hasAttribute(ATTR_NAME)); | |
} | |
function getHostRootInstanceInContainer(container) { | |
var rootEl = getReactRootElementInContainer(container); | |
var prevHostInstance = rootEl && ReactDOMComponentTree.getInstanceFromNode(rootEl); | |
return prevHostInstance && !prevHostInstance._hostParent ? prevHostInstance : null; | |
} | |
function getTopLevelWrapperInContainer(container) { | |
var root = getHostRootInstanceInContainer(container); | |
return root ? root._hostContainerInfo._topLevelWrapper : null; | |
} | |
/** | |
* Temporary (?) hack so that we can store all top-level pending updates on | |
* composites instead of having to worry about different types of components | |
* here. | |
*/ | |
var topLevelRootCounter = 1; | |
var TopLevelWrapper = function TopLevelWrapper() { | |
this.rootID = topLevelRootCounter++; | |
}; | |
TopLevelWrapper.prototype.isReactComponent = {}; | |
if (process.env.NODE_ENV !== 'production') { | |
TopLevelWrapper.displayName = 'TopLevelWrapper'; | |
} | |
TopLevelWrapper.prototype.render = function () { | |
return this.props.child; | |
}; | |
TopLevelWrapper.isReactTopLevelWrapper = true; | |
/** | |
* Mounting is the process of initializing a React component by creating its | |
* representative DOM elements and inserting them into a supplied `container`. | |
* Any prior content inside `container` is destroyed in the process. | |
* | |
* ReactMount.render( | |
* component, | |
* document.getElementById('container') | |
* ); | |
* | |
* <div id="container"> <-- Supplied `container`. | |
* <div data-reactid=".3"> <-- Rendered reactRoot of React | |
* // ... component. | |
* </div> | |
* </div> | |
* | |
* Inside of `container`, the first element rendered is the "reactRoot". | |
*/ | |
var ReactMount = { | |
TopLevelWrapper: TopLevelWrapper, | |
/** | |
* Used by devtools. The keys are not important. | |
*/ | |
_instancesByReactRootID: instancesByReactRootID, | |
/** | |
* This is a hook provided to support rendering React components while | |
* ensuring that the apparent scroll position of its `container` does not | |
* change. | |
* | |
* @param {DOMElement} container The `container` being rendered into. | |
* @param {function} renderCallback This must be called once to do the render. | |
*/ | |
scrollMonitor: function scrollMonitor(container, renderCallback) { | |
renderCallback(); | |
}, | |
/** | |
* Take a component that's already mounted into the DOM and replace its props | |
* @param {ReactComponent} prevComponent component instance already in the DOM | |
* @param {ReactElement} nextElement component instance to render | |
* @param {DOMElement} container container to render into | |
* @param {?function} callback function triggered on completion | |
*/ | |
_updateRootComponent: function _updateRootComponent(prevComponent, nextElement, nextContext, container, callback) { | |
ReactMount.scrollMonitor(container, function () { | |
ReactUpdateQueue.enqueueElementInternal(prevComponent, nextElement, nextContext); | |
if (callback) { | |
ReactUpdateQueue.enqueueCallbackInternal(prevComponent, callback); | |
} | |
}); | |
return prevComponent; | |
}, | |
/** | |
* Render a new component into the DOM. Hooked by hooks! | |
* | |
* @param {ReactElement} nextElement element to render | |
* @param {DOMElement} container container to render into | |
* @param {boolean} shouldReuseMarkup if we should skip the markup insertion | |
* @return {ReactComponent} nextComponent | |
*/ | |
_renderNewRootComponent: function _renderNewRootComponent(nextElement, container, shouldReuseMarkup, context) { | |
// Various parts of our code (such as ReactCompositeComponent's | |
// _renderValidatedComponent) assume that calls to render aren't nested; | |
// verify that that's the case. | |
process.env.NODE_ENV !== 'production' ? warning(ReactCurrentOwner.current == null, '_renderNewRootComponent(): Render methods should be a pure function ' + 'of props and state; triggering nested component updates from ' + 'render is not allowed. If necessary, trigger nested updates in ' + 'componentDidUpdate. Check the render method of %s.', ReactCurrentOwner.current && ReactCurrentOwner.current.getName() || 'ReactCompositeComponent') : void 0; | |
!isValidContainer(container) ? process.env.NODE_ENV !== 'production' ? invariant(false, '_registerComponent(...): Target container is not a DOM element.') : _prodInvariant('37') : void 0; | |
ReactBrowserEventEmitter.ensureScrollValueMonitoring(); | |
var componentInstance = instantiateReactComponent(nextElement, false); | |
// The initial render is synchronous but any updates that happen during | |
// rendering, in componentWillMount or componentDidMount, will be batched | |
// according to the current batching strategy. | |
ReactUpdates.batchedUpdates(batchedMountComponentIntoNode, componentInstance, container, shouldReuseMarkup, context); | |
var wrapperID = componentInstance._instance.rootID; | |
instancesByReactRootID[wrapperID] = componentInstance; | |
return componentInstance; | |
}, | |
/** | |
* Renders a React component into the DOM in the supplied `container`. | |
* | |
* If the React component was previously rendered into `container`, this will | |
* perform an update on it and only mutate the DOM as necessary to reflect the | |
* latest React component. | |
* | |
* @param {ReactComponent} parentComponent The conceptual parent of this render tree. | |
* @param {ReactElement} nextElement Component element to render. | |
* @param {DOMElement} container DOM element to render into. | |
* @param {?function} callback function triggered on completion | |
* @return {ReactComponent} Component instance rendered in `container`. | |
*/ | |
renderSubtreeIntoContainer: function renderSubtreeIntoContainer(parentComponent, nextElement, container, callback) { | |
!(parentComponent != null && ReactInstanceMap.has(parentComponent)) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'parentComponent must be a valid React Component') : _prodInvariant('38') : void 0; | |
return ReactMount._renderSubtreeIntoContainer(parentComponent, nextElement, container, callback); | |
}, | |
_renderSubtreeIntoContainer: function _renderSubtreeIntoContainer(parentComponent, nextElement, container, callback) { | |
ReactUpdateQueue.validateCallback(callback, 'ReactDOM.render'); | |
!React.isValidElement(nextElement) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactDOM.render(): Invalid component element.%s', typeof nextElement === 'string' ? " Instead of passing a string like 'div', pass " + "React.createElement('div') or <div />." : typeof nextElement === 'function' ? ' Instead of passing a class like Foo, pass ' + 'React.createElement(Foo) or <Foo />.' : // Check if it quacks like an element | |
nextElement != null && nextElement.props !== undefined ? ' This may be caused by unintentionally loading two independent ' + 'copies of React.' : '') : _prodInvariant('39', typeof nextElement === 'string' ? " Instead of passing a string like 'div', pass " + "React.createElement('div') or <div />." : typeof nextElement === 'function' ? ' Instead of passing a class like Foo, pass ' + 'React.createElement(Foo) or <Foo />.' : nextElement != null && nextElement.props !== undefined ? ' This may be caused by unintentionally loading two independent ' + 'copies of React.' : '') : void 0; | |
process.env.NODE_ENV !== 'production' ? warning(!container || !container.tagName || container.tagName.toUpperCase() !== 'BODY', 'render(): Rendering components directly into document.body is ' + 'discouraged, since its children are often manipulated by third-party ' + 'scripts and browser extensions. This may lead to subtle ' + 'reconciliation issues. Try rendering into a container element created ' + 'for your app.') : void 0; | |
var nextWrappedElement = React.createElement(TopLevelWrapper, { | |
child: nextElement | |
}); | |
var nextContext; | |
if (parentComponent) { | |
var parentInst = ReactInstanceMap.get(parentComponent); | |
nextContext = parentInst._processChildContext(parentInst._context); | |
} else { | |
nextContext = emptyObject; | |
} | |
var prevComponent = getTopLevelWrapperInContainer(container); | |
if (prevComponent) { | |
var prevWrappedElement = prevComponent._currentElement; | |
var prevElement = prevWrappedElement.props.child; | |
if (shouldUpdateReactComponent(prevElement, nextElement)) { | |
var publicInst = prevComponent._renderedComponent.getPublicInstance(); | |
var updatedCallback = callback && function () { | |
callback.call(publicInst); | |
}; | |
ReactMount._updateRootComponent(prevComponent, nextWrappedElement, nextContext, container, updatedCallback); | |
return publicInst; | |
} else { | |
ReactMount.unmountComponentAtNode(container); | |
} | |
} | |
var reactRootElement = getReactRootElementInContainer(container); | |
var containerHasReactMarkup = reactRootElement && !!internalGetID(reactRootElement); | |
var containerHasNonRootReactChild = hasNonRootReactChild(container); | |
if (process.env.NODE_ENV !== 'production') { | |
process.env.NODE_ENV !== 'production' ? warning(!containerHasNonRootReactChild, 'render(...): Replacing React-rendered children with a new root ' + 'component. If you intended to update the children of this node, ' + 'you should instead have the existing children update their state ' + 'and render the new components instead of calling ReactDOM.render.') : void 0; | |
if (!containerHasReactMarkup || reactRootElement.nextSibling) { | |
var rootElementSibling = reactRootElement; | |
while (rootElementSibling) { | |
if (internalGetID(rootElementSibling)) { | |
process.env.NODE_ENV !== 'production' ? warning(false, 'render(): Target node has markup rendered by React, but there ' + 'are unrelated nodes as well. This is most commonly caused by ' + 'white-space inserted around server-rendered markup.') : void 0; | |
break; | |
} | |
rootElementSibling = rootElementSibling.nextSibling; | |
} | |
} | |
} | |
var shouldReuseMarkup = containerHasReactMarkup && !prevComponent && !containerHasNonRootReactChild; | |
var component = ReactMount._renderNewRootComponent(nextWrappedElement, container, shouldReuseMarkup, nextContext)._renderedComponent.getPublicInstance(); | |
if (callback) { | |
callback.call(component); | |
} | |
return component; | |
}, | |
/** | |
* Renders a React component into the DOM in the supplied `container`. | |
* See https://facebook.github.io/react/docs/top-level-api.html#reactdom.render | |
* | |
* If the React component was previously rendered into `container`, this will | |
* perform an update on it and only mutate the DOM as necessary to reflect the | |
* latest React component. | |
* | |
* @param {ReactElement} nextElement Component element to render. | |
* @param {DOMElement} container DOM element to render into. | |
* @param {?function} callback function triggered on completion | |
* @return {ReactComponent} Component instance rendered in `container`. | |
*/ | |
render: function render(nextElement, container, callback) { | |
return ReactMount._renderSubtreeIntoContainer(null, nextElement, container, callback); | |
}, | |
/** | |
* Unmounts and destroys the React component rendered in the `container`. | |
* See https://facebook.github.io/react/docs/top-level-api.html#reactdom.unmountcomponentatnode | |
* | |
* @param {DOMElement} container DOM element containing a React component. | |
* @return {boolean} True if a component was found in and unmounted from | |
* `container` | |
*/ | |
unmountComponentAtNode: function unmountComponentAtNode(container) { | |
// Various parts of our code (such as ReactCompositeComponent's | |
// _renderValidatedComponent) assume that calls to render aren't nested; | |
// verify that that's the case. (Strictly speaking, unmounting won't cause a | |
// render but we still don't expect to be in a render call here.) | |
process.env.NODE_ENV !== 'production' ? warning(ReactCurrentOwner.current == null, 'unmountComponentAtNode(): Render methods should be a pure function ' + 'of props and state; triggering nested component updates from render ' + 'is not allowed. If necessary, trigger nested updates in ' + 'componentDidUpdate. Check the render method of %s.', ReactCurrentOwner.current && ReactCurrentOwner.current.getName() || 'ReactCompositeComponent') : void 0; | |
!isValidContainer(container) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'unmountComponentAtNode(...): Target container is not a DOM element.') : _prodInvariant('40') : void 0; | |
if (process.env.NODE_ENV !== 'production') { | |
process.env.NODE_ENV !== 'production' ? warning(!nodeIsRenderedByOtherInstance(container), "unmountComponentAtNode(): The node you're attempting to unmount " + 'was rendered by another copy of React.') : void 0; | |
} | |
var prevComponent = getTopLevelWrapperInContainer(container); | |
if (!prevComponent) { | |
// Check if the node being unmounted was rendered by React, but isn't a | |
// root node. | |
var containerHasNonRootReactChild = hasNonRootReactChild(container); | |
// Check if the container itself is a React root node. | |
var isContainerReactRoot = container.nodeType === 1 && container.hasAttribute(ROOT_ATTR_NAME); | |
if (process.env.NODE_ENV !== 'production') { | |
process.env.NODE_ENV !== 'production' ? warning(!containerHasNonRootReactChild, "unmountComponentAtNode(): The node you're attempting to unmount " + 'was rendered by React and is not a top-level container. %s', isContainerReactRoot ? 'You may have accidentally passed in a React root node instead ' + 'of its container.' : 'Instead, have the parent component update its state and ' + 'rerender in order to remove this component.') : void 0; | |
} | |
return false; | |
} | |
delete instancesByReactRootID[prevComponent._instance.rootID]; | |
ReactUpdates.batchedUpdates(unmountComponentFromNode, prevComponent, container, false); | |
return true; | |
}, | |
_mountImageIntoNode: function _mountImageIntoNode(markup, container, instance, shouldReuseMarkup, transaction) { | |
!isValidContainer(container) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'mountComponentIntoNode(...): Target container is not valid.') : _prodInvariant('41') : void 0; | |
if (shouldReuseMarkup) { | |
var rootElement = getReactRootElementInContainer(container); | |
if (ReactMarkupChecksum.canReuseMarkup(markup, rootElement)) { | |
ReactDOMComponentTree.precacheNode(instance, rootElement); | |
return; | |
} else { | |
var checksum = rootElement.getAttribute(ReactMarkupChecksum.CHECKSUM_ATTR_NAME); | |
rootElement.removeAttribute(ReactMarkupChecksum.CHECKSUM_ATTR_NAME); | |
var rootMarkup = rootElement.outerHTML; | |
rootElement.setAttribute(ReactMarkupChecksum.CHECKSUM_ATTR_NAME, checksum); | |
var normalizedMarkup = markup; | |
if (process.env.NODE_ENV !== 'production') { | |
// because rootMarkup is retrieved from the DOM, various normalizations | |
// will have occurred which will not be present in `markup`. Here, | |
// insert markup into a <div> or <iframe> depending on the container | |
// type to perform the same normalizations before comparing. | |
var normalizer; | |
if (container.nodeType === ELEMENT_NODE_TYPE) { | |
normalizer = document.createElement('div'); | |
normalizer.innerHTML = markup; | |
normalizedMarkup = normalizer.innerHTML; | |
} else { | |
normalizer = document.createElement('iframe'); | |
document.body.appendChild(normalizer); | |
normalizer.contentDocument.write(markup); | |
normalizedMarkup = normalizer.contentDocument.documentElement.outerHTML; | |
document.body.removeChild(normalizer); | |
} | |
} | |
var diffIndex = firstDifferenceIndex(normalizedMarkup, rootMarkup); | |
var difference = ' (client) ' + normalizedMarkup.substring(diffIndex - 20, diffIndex + 20) + '\n (server) ' + rootMarkup.substring(diffIndex - 20, diffIndex + 20); | |
!(container.nodeType !== DOC_NODE_TYPE) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'You\'re trying to render a component to the document using server rendering but the checksum was invalid. This usually means you rendered a different component type or props on the client from the one on the server, or your render() methods are impure. React cannot handle this case due to cross-browser quirks by rendering at the document root. You should look for environment dependent code in your components and ensure the props are the same client and server side:\n%s', difference) : _prodInvariant('42', difference) : void 0; | |
if (process.env.NODE_ENV !== 'production') { | |
process.env.NODE_ENV !== 'production' ? warning(false, 'React attempted to reuse markup in a container but the ' + 'checksum was invalid. This generally means that you are ' + 'using server rendering and the markup generated on the ' + 'server was not what the client was expecting. React injected ' + 'new markup to compensate which works but you have lost many ' + 'of the benefits of server rendering. Instead, figure out ' + 'why the markup being generated is different on the client ' + 'or server:\n%s', difference) : void 0; | |
} | |
} | |
} | |
!(container.nodeType !== DOC_NODE_TYPE) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'You\'re trying to render a component to the document but you didn\'t use server rendering. We can\'t do this without using server rendering due to cross-browser quirks. See ReactDOMServer.renderToString() for server rendering.') : _prodInvariant('43') : void 0; | |
if (transaction.useCreateElement) { | |
while (container.lastChild) { | |
container.removeChild(container.lastChild); | |
} | |
DOMLazyTree.insertTreeBefore(container, markup, null); | |
} else { | |
setInnerHTML(container, markup); | |
ReactDOMComponentTree.precacheNode(instance, container.firstChild); | |
} | |
if (process.env.NODE_ENV !== 'production') { | |
var hostNode = ReactDOMComponentTree.getInstanceFromNode(container.firstChild); | |
if (hostNode._debugID !== 0) { | |
ReactInstrumentation.debugTool.onHostOperation({ | |
instanceID: hostNode._debugID, | |
type: 'mount', | |
payload: markup.toString() | |
}); | |
} | |
} | |
} | |
}; | |
module.exports = ReactMount; | |
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0))) | |
/***/ }), | |
/* 72 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
"use strict"; | |
/* WEBPACK VAR INJECTION */(function(process) {/** | |
* Copyright 2013-present, Facebook, Inc. | |
* All rights reserved. | |
* | |
* This source code is licensed under the BSD-style license found in the | |
* LICENSE file in the root directory of this source tree. An additional grant | |
* of patent rights can be found in the PATENTS file in the same directory. | |
* | |
* | |
*/ | |
var _prodInvariant = __webpack_require__(3); | |
var React = __webpack_require__(20); | |
var invariant = __webpack_require__(1); | |
var ReactNodeTypes = { | |
HOST: 0, | |
COMPOSITE: 1, | |
EMPTY: 2, | |
getType: function getType(node) { | |
if (node === null || node === false) { | |
return ReactNodeTypes.EMPTY; | |
} else if (React.isValidElement(node)) { | |
if (typeof node.type === 'function') { | |
return ReactNodeTypes.COMPOSITE; | |
} else { | |
return ReactNodeTypes.HOST; | |
} | |
} | |
true ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Unexpected node: %s', node) : _prodInvariant('26', node) : void 0; | |
} | |
}; | |
module.exports = ReactNodeTypes; | |
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0))) | |
/***/ }), | |
/* 73 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
"use strict"; | |
/** | |
* Copyright 2013-present, Facebook, Inc. | |
* All rights reserved. | |
* | |
* This source code is licensed under the BSD-style license found in the | |
* LICENSE file in the root directory of this source tree. An additional grant | |
* of patent rights can be found in the PATENTS file in the same directory. | |
* | |
* | |
*/ | |
var ReactPropTypesSecret = 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED'; | |
module.exports = ReactPropTypesSecret; | |
/***/ }), | |
/* 74 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
"use strict"; | |
/** | |
* Copyright 2013-present, Facebook, Inc. | |
* All rights reserved. | |
* | |
* This source code is licensed under the BSD-style license found in the | |
* LICENSE file in the root directory of this source tree. An additional grant | |
* of patent rights can be found in the PATENTS file in the same directory. | |
* | |
*/ | |
var ViewportMetrics = { | |
currentScrollLeft: 0, | |
currentScrollTop: 0, | |
refreshScrollValues: function refreshScrollValues(scrollPosition) { | |
ViewportMetrics.currentScrollLeft = scrollPosition.x; | |
ViewportMetrics.currentScrollTop = scrollPosition.y; | |
} | |
}; | |
module.exports = ViewportMetrics; | |
/***/ }), | |
/* 75 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
"use strict"; | |
/* WEBPACK VAR INJECTION */(function(process) {/** | |
* Copyright 2014-present, Facebook, Inc. | |
* All rights reserved. | |
* | |
* This source code is licensed under the BSD-style license found in the | |
* LICENSE file in the root directory of this source tree. An additional grant | |
* of patent rights can be found in the PATENTS file in the same directory. | |
* | |
* | |
*/ | |
var _prodInvariant = __webpack_require__(3); | |
var invariant = __webpack_require__(1); | |
/** | |
* Accumulates items that must not be null or undefined into the first one. This | |
* is used to conserve memory by avoiding array allocations, and thus sacrifices | |
* API cleanness. Since `current` can be null before being passed in and not | |
* null after this function, make sure to assign it back to `current`: | |
* | |
* `a = accumulateInto(a, b);` | |
* | |
* This API should be sparingly used. Try `accumulate` for something cleaner. | |
* | |
* @return {*|array<*>} An accumulation of items. | |
*/ | |
function accumulateInto(current, next) { | |
!(next != null) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'accumulateInto(...): Accumulated items must not be null or undefined.') : _prodInvariant('30') : void 0; | |
if (current == null) { | |
return next; | |
} | |
// Both are not empty. Warning: Never call x.concat(y) when you are not | |
// certain that x is an Array (x could be a string with concat method). | |
if (Array.isArray(current)) { | |
if (Array.isArray(next)) { | |
current.push.apply(current, next); | |
return current; | |
} | |
current.push(next); | |
return current; | |
} | |
if (Array.isArray(next)) { | |
// A bit too dangerous to mutate `next`. | |
return [current].concat(next); | |
} | |
return [current, next]; | |
} | |
module.exports = accumulateInto; | |
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0))) | |
/***/ }), | |
/* 76 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
"use strict"; | |
/** | |
* Copyright 2013-present, Facebook, Inc. | |
* All rights reserved. | |
* | |
* This source code is licensed under the BSD-style license found in the | |
* LICENSE file in the root directory of this source tree. An additional grant | |
* of patent rights can be found in the PATENTS file in the same directory. | |
* | |
* | |
*/ | |
/** | |
* @param {array} arr an "accumulation" of items which is either an Array or | |
* a single item. Useful when paired with the `accumulate` module. This is a | |
* simple utility that allows us to reason about a collection of items, but | |
* handling the case when there is exactly one item (and we do not need to | |
* allocate an array). | |
*/ | |
function forEachAccumulated(arr, cb, scope) { | |
if (Array.isArray(arr)) { | |
arr.forEach(cb, scope); | |
} else if (arr) { | |
cb.call(scope, arr); | |
} | |
} | |
module.exports = forEachAccumulated; | |
/***/ }), | |
/* 77 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
"use strict"; | |
/** | |
* Copyright 2013-present, Facebook, Inc. | |
* All rights reserved. | |
* | |
* This source code is licensed under the BSD-style license found in the | |
* LICENSE file in the root directory of this source tree. An additional grant | |
* of patent rights can be found in the PATENTS file in the same directory. | |
* | |
*/ | |
var ReactNodeTypes = __webpack_require__(72); | |
function getHostComponentFromComposite(inst) { | |
var type; | |
while ((type = inst._renderedNodeType) === ReactNodeTypes.COMPOSITE) { | |
inst = inst._renderedComponent; | |
} | |
if (type === ReactNodeTypes.HOST) { | |
return inst._renderedComponent; | |
} else if (type === ReactNodeTypes.EMPTY) { | |
return null; | |
} | |
} | |
module.exports = getHostComponentFromComposite; | |
/***/ }), | |
/* 78 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
"use strict"; | |
/** | |
* Copyright 2013-present, Facebook, Inc. | |
* All rights reserved. | |
* | |
* This source code is licensed under the BSD-style license found in the | |
* LICENSE file in the root directory of this source tree. An additional grant | |
* of patent rights can be found in the PATENTS file in the same directory. | |
* | |
*/ | |
var ExecutionEnvironment = __webpack_require__(6); | |
var contentKey = null; | |
/** | |
* Gets the key used to access text content on a DOM node. | |
* | |
* @return {?string} Key used to access text content. | |
* @internal | |
*/ | |
function getTextContentAccessor() { | |
if (!contentKey && ExecutionEnvironment.canUseDOM) { | |
// Prefer textContent to innerText because many browsers support both but | |
// SVG <text> elements don't support innerText even when <div> does. | |
contentKey = 'textContent' in document.documentElement ? 'textContent' : 'innerText'; | |
} | |
return contentKey; | |
} | |
module.exports = getTextContentAccessor; | |
/***/ }), | |
/* 79 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
"use strict"; | |
/** | |
* Copyright 2013-present, Facebook, Inc. | |
* All rights reserved. | |
* | |
* This source code is licensed under the BSD-style license found in the | |
* LICENSE file in the root directory of this source tree. An additional grant | |
* of patent rights can be found in the PATENTS file in the same directory. | |
* | |
*/ | |
var ReactDOMComponentTree = __webpack_require__(5); | |
function isCheckable(elem) { | |
var type = elem.type; | |
var nodeName = elem.nodeName; | |
return nodeName && nodeName.toLowerCase() === 'input' && (type === 'checkbox' || type === 'radio'); | |
} | |
function getTracker(inst) { | |
return inst._wrapperState.valueTracker; | |
} | |
function attachTracker(inst, tracker) { | |
inst._wrapperState.valueTracker = tracker; | |
} | |
function detachTracker(inst) { | |
delete inst._wrapperState.valueTracker; | |
} | |
function getValueFromNode(node) { | |
var value; | |
if (node) { | |
value = isCheckable(node) ? '' + node.checked : node.value; | |
} | |
return value; | |
} | |
var inputValueTracking = { | |
// exposed for testing | |
_getTrackerFromNode: function _getTrackerFromNode(node) { | |
return getTracker(ReactDOMComponentTree.getInstanceFromNode(node)); | |
}, | |
track: function track(inst) { | |
if (getTracker(inst)) { | |
return; | |
} | |
var node = ReactDOMComponentTree.getNodeFromInstance(inst); | |
var valueField = isCheckable(node) ? 'checked' : 'value'; | |
var descriptor = Object.getOwnPropertyDescriptor(node.constructor.prototype, valueField); | |
var currentValue = '' + node[valueField]; | |
// if someone has already defined a value or Safari, then bail | |
// and don't track value will cause over reporting of changes, | |
// but it's better then a hard failure | |
// (needed for certain tests that spyOn input values and Safari) | |
if (node.hasOwnProperty(valueField) || typeof descriptor.get !== 'function' || typeof descriptor.set !== 'function') { | |
return; | |
} | |
Object.defineProperty(node, valueField, { | |
enumerable: descriptor.enumerable, | |
configurable: true, | |
get: function get() { | |
return descriptor.get.call(this); | |
}, | |
set: function set(value) { | |
currentValue = '' + value; | |
descriptor.set.call(this, value); | |
} | |
}); | |
attachTracker(inst, { | |
getValue: function getValue() { | |
return currentValue; | |
}, | |
setValue: function setValue(value) { | |
currentValue = '' + value; | |
}, | |
stopTracking: function stopTracking() { | |
detachTracker(inst); | |
delete node[valueField]; | |
} | |
}); | |
}, | |
updateValueIfChanged: function updateValueIfChanged(inst) { | |
if (!inst) { | |
return false; | |
} | |
var tracker = getTracker(inst); | |
if (!tracker) { | |
inputValueTracking.track(inst); | |
return true; | |
} | |
var lastValue = tracker.getValue(); | |
var nextValue = getValueFromNode(ReactDOMComponentTree.getNodeFromInstance(inst)); | |
if (nextValue !== lastValue) { | |
tracker.setValue(nextValue); | |
return true; | |
} | |
return false; | |
}, | |
stopTracking: function stopTracking(inst) { | |
var tracker = getTracker(inst); | |
if (tracker) { | |
tracker.stopTracking(); | |
} | |
} | |
}; | |
module.exports = inputValueTracking; | |
/***/ }), | |
/* 80 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
"use strict"; | |
/* WEBPACK VAR INJECTION */(function(process) {/** | |
* Copyright 2013-present, Facebook, Inc. | |
* All rights reserved. | |
* | |
* This source code is licensed under the BSD-style license found in the | |
* LICENSE file in the root directory of this source tree. An additional grant | |
* of patent rights can be found in the PATENTS file in the same directory. | |
* | |
*/ | |
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; | |
var _prodInvariant = __webpack_require__(3), | |
_assign = __webpack_require__(4); | |
var ReactCompositeComponent = __webpack_require__(320); | |
var ReactEmptyComponent = __webpack_require__(67); | |
var ReactHostComponent = __webpack_require__(69); | |
var getNextDebugID = __webpack_require__(389); | |
var invariant = __webpack_require__(1); | |
var warning = __webpack_require__(2); | |
// To avoid a cyclic dependency, we create the final class in this module | |
var ReactCompositeComponentWrapper = function ReactCompositeComponentWrapper(element) { | |
this.construct(element); | |
}; | |
function getDeclarationErrorAddendum(owner) { | |
if (owner) { | |
var name = owner.getName(); | |
if (name) { | |
return ' Check the render method of `' + name + '`.'; | |
} | |
} | |
return ''; | |
} | |
/** | |
* Check if the type reference is a known internal type. I.e. not a user | |
* provided composite type. | |
* | |
* @param {function} type | |
* @return {boolean} Returns true if this is a valid internal type. | |
*/ | |
function isInternalComponentType(type) { | |
return typeof type === 'function' && typeof type.prototype !== 'undefined' && typeof type.prototype.mountComponent === 'function' && typeof type.prototype.receiveComponent === 'function'; | |
} | |
/** | |
* Given a ReactNode, create an instance that will actually be mounted. | |
* | |
* @param {ReactNode} node | |
* @param {boolean} shouldHaveDebugID | |
* @return {object} A new instance of the element's constructor. | |
* @protected | |
*/ | |
function instantiateReactComponent(node, shouldHaveDebugID) { | |
var instance; | |
if (node === null || node === false) { | |
instance = ReactEmptyComponent.create(instantiateReactComponent); | |
} else if ((typeof node === 'undefined' ? 'undefined' : _typeof(node)) === 'object') { | |
var element = node; | |
var type = element.type; | |
if (typeof type !== 'function' && typeof type !== 'string') { | |
var info = ''; | |
if (process.env.NODE_ENV !== 'production') { | |
if (type === undefined || (typeof type === 'undefined' ? 'undefined' : _typeof(type)) === 'object' && type !== null && Object.keys(type).length === 0) { | |
info += ' You likely forgot to export your component from the file ' + "it's defined in."; | |
} | |
} | |
info += getDeclarationErrorAddendum(element._owner); | |
true ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s', type == null ? type : typeof type === 'undefined' ? 'undefined' : _typeof(type), info) : _prodInvariant('130', type == null ? type : typeof type === 'undefined' ? 'undefined' : _typeof(type), info) : void 0; | |
} | |
// Special case string values | |
if (typeof element.type === 'string') { | |
instance = ReactHostComponent.createInternalComponent(element); | |
} else if (isInternalComponentType(element.type)) { | |
// This is temporarily available for custom components that are not string | |
// representations. I.e. ART. Once those are updated to use the string | |
// representation, we can drop this code path. | |
instance = new element.type(element); | |
// We renamed this. Allow the old name for compat. :( | |
if (!instance.getHostNode) { | |
instance.getHostNode = instance.getNativeNode; | |
} | |
} else { | |
instance = new ReactCompositeComponentWrapper(element); | |
} | |
} else if (typeof node === 'string' || typeof node === 'number') { | |
instance = ReactHostComponent.createInstanceForText(node); | |
} else { | |
true ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Encountered invalid React node of type %s', typeof node === 'undefined' ? 'undefined' : _typeof(node)) : _prodInvariant('131', typeof node === 'undefined' ? 'undefined' : _typeof(node)) : void 0; | |
} | |
if (process.env.NODE_ENV !== 'production') { | |
process.env.NODE_ENV !== 'production' ? warning(typeof instance.mountComponent === 'function' && typeof instance.receiveComponent === 'function' && typeof instance.getHostNode === 'function' && typeof instance.unmountComponent === 'function', 'Only React Components can be mounted.') : void 0; | |
} | |
// These two fields are used by the DOM and ART diffing algorithms | |
// respectively. Instead of using expandos on components, we should be | |
// storing the state needed by the diffing algorithms elsewhere. | |
instance._mountIndex = 0; | |
instance._mountImage = null; | |
if (process.env.NODE_ENV !== 'production') { | |
instance._debugID = shouldHaveDebugID ? getNextDebugID() : 0; | |
} | |
// Internal instances should fully constructed at this point, so they should | |
// not get any new fields added to them at this point. | |
if (process.env.NODE_ENV !== 'production') { | |
if (Object.preventExtensions) { | |
Object.preventExtensions(instance); | |
} | |
} | |
return instance; | |
} | |
_assign(ReactCompositeComponentWrapper.prototype, ReactCompositeComponent, { | |
_instantiateReactComponent: instantiateReactComponent | |
}); | |
module.exports = instantiateReactComponent; | |
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0))) | |
/***/ }), | |
/* 81 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
"use strict"; | |
/** | |
* Copyright 2013-present, Facebook, Inc. | |
* All rights reserved. | |
* | |
* This source code is licensed under the BSD-style license found in the | |
* LICENSE file in the root directory of this source tree. An additional grant | |
* of patent rights can be found in the PATENTS file in the same directory. | |
* | |
* | |
*/ | |
/** | |
* @see http://www.whatwg.org/specs/web-apps/current-work/multipage/the-input-element.html#input-type-attr-summary | |
*/ | |
var supportedInputTypes = { | |
color: true, | |
date: true, | |
datetime: true, | |
'datetime-local': true, | |
email: true, | |
month: true, | |
number: true, | |
password: true, | |
range: true, | |
search: true, | |
tel: true, | |
text: true, | |
time: true, | |
url: true, | |
week: true | |
}; | |
function isTextInputElement(elem) { | |
var nodeName = elem && elem.nodeName && elem.nodeName.toLowerCase(); | |
if (nodeName === 'input') { | |
return !!supportedInputTypes[elem.type]; | |
} | |
if (nodeName === 'textarea') { | |
return true; | |
} | |
return false; | |
} | |
module.exports = isTextInputElement; | |
/***/ }), | |
/* 82 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
"use strict"; | |
/** | |
* Copyright 2013-present, Facebook, Inc. | |
* All rights reserved. | |
* | |
* This source code is licensed under the BSD-style license found in the | |
* LICENSE file in the root directory of this source tree. An additional grant | |
* of patent rights can be found in the PATENTS file in the same directory. | |
* | |
*/ | |
var ExecutionEnvironment = __webpack_require__(6); | |
var escapeTextContentForBrowser = __webpack_require__(33); | |
var setInnerHTML = __webpack_require__(34); | |
/** | |
* Set the textContent property of a node, ensuring that whitespace is preserved | |
* even in IE8. innerText is a poor substitute for textContent and, among many | |
* issues, inserts <br> instead of the literal newline chars. innerHTML behaves | |
* as it should. | |
* | |
* @param {DOMElement} node | |
* @param {string} text | |
* @internal | |
*/ | |
var setTextContent = function setTextContent(node, text) { | |
if (text) { | |
var firstChild = node.firstChild; | |
if (firstChild && firstChild === node.lastChild && firstChild.nodeType === 3) { | |
firstChild.nodeValue = text; | |
return; | |
} | |
} | |
node.textContent = text; | |
}; | |
if (ExecutionEnvironment.canUseDOM) { | |
if (!('textContent' in document.documentElement)) { | |
setTextContent = function setTextContent(node, text) { | |
if (node.nodeType === 3) { | |
node.nodeValue = text; | |
return; | |
} | |
setInnerHTML(node, escapeTextContentForBrowser(text)); | |
}; | |
} | |
} | |
module.exports = setTextContent; | |
/***/ }), | |
/* 83 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
"use strict"; | |
/* WEBPACK VAR INJECTION */(function(process) {/** | |
* Copyright 2013-present, Facebook, Inc. | |
* All rights reserved. | |
* | |
* This source code is licensed under the BSD-style license found in the | |
* LICENSE file in the root directory of this source tree. An additional grant | |
* of patent rights can be found in the PATENTS file in the same directory. | |
* | |
*/ | |
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; | |
var _prodInvariant = __webpack_require__(3); | |
var ReactCurrentOwner = __webpack_require__(11); | |
var REACT_ELEMENT_TYPE = __webpack_require__(339); | |
var getIteratorFn = __webpack_require__(373); | |
var invariant = __webpack_require__(1); | |
var KeyEscapeUtils = __webpack_require__(42); | |
var warning = __webpack_require__(2); | |
var SEPARATOR = '.'; | |
var SUBSEPARATOR = ':'; | |
/** | |
* This is inlined from ReactElement since this file is shared between | |
* isomorphic and renderers. We could extract this to a | |
* | |
*/ | |
/** | |
* TODO: Test that a single child and an array with one item have the same key | |
* pattern. | |
*/ | |
var didWarnAboutMaps = false; | |
/** | |
* Generate a key string that identifies a component within a set. | |
* | |
* @param {*} component A component that could contain a manual key. | |
* @param {number} index Index that is used if a manual key is not provided. | |
* @return {string} | |
*/ | |
function getComponentKey(component, index) { | |
// Do some typechecking here since we call this blindly. We want to ensure | |
// that we don't block potential future ES APIs. | |
if (component && (typeof component === 'undefined' ? 'undefined' : _typeof(component)) === 'object' && component.key != null) { | |
// Explicit key | |
return KeyEscapeUtils.escape(component.key); | |
} | |
// Implicit key determined by the index in the set | |
return index.toString(36); | |
} | |
/** | |
* @param {?*} children Children tree container. | |
* @param {!string} nameSoFar Name of the key path so far. | |
* @param {!function} callback Callback to invoke with each child found. | |
* @param {?*} traverseContext Used to pass information throughout the traversal | |
* process. | |
* @return {!number} The number of children in this subtree. | |
*/ | |
function traverseAllChildrenImpl(children, nameSoFar, callback, traverseContext) { | |
var type = typeof children === 'undefined' ? 'undefined' : _typeof(children); | |
if (type === 'undefined' || type === 'boolean') { | |
// All of the above are perceived as null. | |
children = null; | |
} | |
if (children === null || type === 'string' || type === 'number' || | |
// The following is inlined from ReactElement. This means we can optimize | |
// some checks. React Fiber also inlines this logic for similar purposes. | |
type === 'object' && children.$$typeof === REACT_ELEMENT_TYPE) { | |
callback(traverseContext, children, | |
// If it's the only child, treat the name as if it was wrapped in an array | |
// so that it's consistent if the number of children grows. | |
nameSoFar === '' ? SEPARATOR + getComponentKey(children, 0) : nameSoFar); | |
return 1; | |
} | |
var child; | |
var nextName; | |
var subtreeCount = 0; // Count of children found in the current subtree. | |
var nextNamePrefix = nameSoFar === '' ? SEPARATOR : nameSoFar + SUBSEPARATOR; | |
if (Array.isArray(children)) { | |
for (var i = 0; i < children.length; i++) { | |
child = children[i]; | |
nextName = nextNamePrefix + getComponentKey(child, i); | |
subtreeCount += traverseAllChildrenImpl(child, nextName, callback, traverseContext); | |
} | |
} else { | |
var iteratorFn = getIteratorFn(children); | |
if (iteratorFn) { | |
var iterator = iteratorFn.call(children); | |
var step; | |
if (iteratorFn !== children.entries) { | |
var ii = 0; | |
while (!(step = iterator.next()).done) { | |
child = step.value; | |
nextName = nextNamePrefix + getComponentKey(child, ii++); | |
subtreeCount += traverseAllChildrenImpl(child, nextName, callback, traverseContext); | |
} | |
} else { | |
if (process.env.NODE_ENV !== 'production') { | |
var mapsAsChildrenAddendum = ''; | |
if (ReactCurrentOwner.current) { | |
var mapsAsChildrenOwnerName = ReactCurrentOwner.current.getName(); | |
if (mapsAsChildrenOwnerName) { | |
mapsAsChildrenAddendum = ' Check the render method of `' + mapsAsChildrenOwnerName + '`.'; | |
} | |
} | |
process.env.NODE_ENV !== 'production' ? warning(didWarnAboutMaps, 'Using Maps as children is not yet fully supported. It is an ' + 'experimental feature that might be removed. Convert it to a ' + 'sequence / iterable of keyed ReactElements instead.%s', mapsAsChildrenAddendum) : void 0; | |
didWarnAboutMaps = true; | |
} | |
// Iterator will provide entry [k,v] tuples rather than values. | |
while (!(step = iterator.next()).done) { | |
var entry = step.value; | |
if (entry) { | |
child = entry[1]; | |
nextName = nextNamePrefix + KeyEscapeUtils.escape(entry[0]) + SUBSEPARATOR + getComponentKey(child, 0); | |
subtreeCount += traverseAllChildrenImpl(child, nextName, callback, traverseContext); | |
} | |
} | |
} | |
} else if (type === 'object') { | |
var addendum = ''; | |
if (process.env.NODE_ENV !== 'production') { | |
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.'; | |
if (children._isReactElement) { | |
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.'; | |
} | |
if (ReactCurrentOwner.current) { | |
var name = ReactCurrentOwner.current.getName(); | |
if (name) { | |
addendum += ' Check the render method of `' + name + '`.'; | |
} | |
} | |
} | |
var childrenString = String(children); | |
true ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Objects are not valid as a React child (found: %s).%s', childrenString === '[object Object]' ? 'object with keys {' + Object.keys(children).join(', ') + '}' : childrenString, addendum) : _prodInvariant('31', childrenString === '[object Object]' ? 'object with keys {' + Object.keys(children).join(', ') + '}' : childrenString, addendum) : void 0; | |
} | |
} | |
return subtreeCount; | |
} | |
/** | |
* Traverses children that are typically specified as `props.children`, but | |
* might also be specified through attributes: | |
* | |
* - `traverseAllChildren(this.props.children, ...)` | |
* - `traverseAllChildren(this.props.leftPanelChildren, ...)` | |
* | |
* The `traverseContext` is an optional argument that is passed through the | |
* entire traversal. It can be used to store accumulations or anything else that | |
* the callback might find relevant. | |
* | |
* @param {?*} children Children tree object. | |
* @param {!function} callback To invoke upon traversing each child. | |
* @param {?*} traverseContext Context for traversal. | |
* @return {!number} The number of children in this subtree. | |
*/ | |
function traverseAllChildren(children, callback, traverseContext) { | |
if (children == null) { | |
return 0; | |
} | |
return traverseAllChildrenImpl(children, '', callback, traverseContext); | |
} | |
module.exports = traverseAllChildren; | |
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0))) | |
/***/ }), | |
/* 84 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
"use strict"; | |
/* WEBPACK VAR INJECTION */(function(process) {/** | |
* Copyright 2013-present, Facebook, Inc. | |
* All rights reserved. | |
* | |
* This source code is licensed under the BSD-style license found in the | |
* LICENSE file in the root directory of this source tree. An additional grant | |
* of patent rights can be found in the PATENTS file in the same directory. | |
* | |
*/ | |
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; | |
var _prodInvariant = __webpack_require__(21), | |
_assign = __webpack_require__(4); | |
var ReactNoopUpdateQueue = __webpack_require__(87); | |
var canDefineProperty = __webpack_require__(35); | |
var emptyObject = __webpack_require__(27); | |
var invariant = __webpack_require__(1); | |
var lowPriorityWarning = __webpack_require__(54); | |
/** | |
* Base class helpers for the updating state of a component. | |
*/ | |
function ReactComponent(props, context, updater) { | |
this.props = props; | |
this.context = context; | |
this.refs = emptyObject; | |
// We initialize the default updater but the real one gets injected by the | |
// renderer. | |
this.updater = updater || ReactNoopUpdateQueue; | |
} | |
ReactComponent.prototype.isReactComponent = {}; | |
/** | |
* Sets a subset of the state. Always use this to mutate | |
* state. You should treat `this.state` as immutable. | |
* | |
* There is no guarantee that `this.state` will be immediately updated, so | |
* accessing `this.state` after calling this method may return the old value. | |
* | |
* There is no guarantee that calls to `setState` will run synchronously, | |
* as they may eventually be batched together. You can provide an optional | |
* callback that will be executed when the call to setState is actually | |
* completed. | |
* | |
* When a function is provided to setState, it will be called at some point in | |
* the future (not synchronously). It will be called with the up to date | |
* component arguments (state, props, context). These values can be different | |
* from this.* because your function may be called after receiveProps but before | |
* shouldComponentUpdate, and this new state, props, and context will not yet be | |
* assigned to this. | |
* | |
* @param {object|function} partialState Next partial state or function to | |
* produce next partial state to be merged with current state. | |
* @param {?function} callback Called after state is updated. | |
* @final | |
* @protected | |
*/ | |
ReactComponent.prototype.setState = function (partialState, callback) { | |
!((typeof partialState === 'undefined' ? 'undefined' : _typeof(partialState)) === 'object' || typeof partialState === 'function' || partialState == null) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'setState(...): takes an object of state variables to update or a function which returns an object of state variables.') : _prodInvariant('85') : void 0; | |
this.updater.enqueueSetState(this, partialState); | |
if (callback) { | |
this.updater.enqueueCallback(this, callback, 'setState'); | |
} | |
}; | |
/** | |
* Forces an update. This should only be invoked when it is known with | |
* certainty that we are **not** in a DOM transaction. | |
* | |
* You may want to call this when you know that some deeper aspect of the | |
* component's state has changed but `setState` was not called. | |
* | |
* This will not invoke `shouldComponentUpdate`, but it will invoke | |
* `componentWillUpdate` and `componentDidUpdate`. | |
* | |
* @param {?function} callback Called after update is complete. | |
* @final | |
* @protected | |
*/ | |
ReactComponent.prototype.forceUpdate = function (callback) { | |
this.updater.enqueueForceUpdate(this); | |
if (callback) { | |
this.updater.enqueueCallback(this, callback, 'forceUpdate'); | |
} | |
}; | |
/** | |
* Deprecated APIs. These APIs used to exist on classic React classes but since | |
* we would like to deprecate them, we're not going to move them over to this | |
* modern base class. Instead, we define a getter that warns if it's accessed. | |
*/ | |
if (process.env.NODE_ENV !== 'production') { | |
var deprecatedAPIs = { | |
isMounted: ['isMounted', 'Instead, make sure to clean up subscriptions and pending requests in ' + 'componentWillUnmount to prevent memory leaks.'], | |
replaceState: ['replaceState', 'Refactor your code to use setState instead (see ' + 'https://github.com/facebook/react/issues/3236).'] | |
}; | |
var defineDeprecationWarning = function defineDeprecationWarning(methodName, info) { | |
if (canDefineProperty) { | |
Object.defineProperty(ReactComponent.prototype, methodName, { | |
get: function get() { | |
lowPriorityWarning(false, '%s(...) is deprecated in plain JavaScript React classes. %s', info[0], info[1]); | |
return undefined; | |
} | |
}); | |
} | |
}; | |
for (var fnName in deprecatedAPIs) { | |
if (deprecatedAPIs.hasOwnProperty(fnName)) { | |
defineDeprecationWarning(fnName, deprecatedAPIs[fnName]); | |
} | |
} | |
} | |
/** | |
* Base class helpers for the updating state of a component. | |
*/ | |
function ReactPureComponent(props, context, updater) { | |
// Duplicated from ReactComponent. | |
this.props = props; | |
this.context = context; | |
this.refs = emptyObject; | |
// We initialize the default updater but the real one gets injected by the | |
// renderer. | |
this.updater = updater || ReactNoopUpdateQueue; | |
} | |
function ComponentDummy() {} | |
ComponentDummy.prototype = ReactComponent.prototype; | |
ReactPureComponent.prototype = new ComponentDummy(); | |
ReactPureComponent.prototype.constructor = ReactPureComponent; | |
// Avoid an extra prototype jump for these methods. | |
_assign(ReactPureComponent.prototype, ReactComponent.prototype); | |
ReactPureComponent.prototype.isPureReactComponent = true; | |
module.exports = { | |
Component: ReactComponent, | |
PureComponent: ReactPureComponent | |
}; | |
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0))) | |
/***/ }), | |
/* 85 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
"use strict"; | |
/** | |
* Copyright 2014-present, Facebook, Inc. | |
* All rights reserved. | |
* | |
* This source code is licensed under the BSD-style license found in the | |
* LICENSE file in the root directory of this source tree. An additional grant | |
* of patent rights can be found in the PATENTS file in the same directory. | |
* | |
* | |
*/ | |
// The Symbol used to tag the ReactElement type. If there is no native Symbol | |
// nor polyfill, then a plain number is used for performance. | |
var REACT_ELEMENT_TYPE = typeof Symbol === 'function' && Symbol['for'] && Symbol['for']('react.element') || 0xeac7; | |
module.exports = REACT_ELEMENT_TYPE; | |
/***/ }), | |
/* 86 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
"use strict"; | |
/* WEBPACK VAR INJECTION */(function(process) {/** | |
* Copyright 2014-present, Facebook, Inc. | |
* All rights reserved. | |
* | |
* This source code is licensed under the BSD-style license found in the | |
* LICENSE file in the root directory of this source tree. An additional grant | |
* of patent rights can be found in the PATENTS file in the same directory. | |
* | |
*/ | |
/** | |
* ReactElementValidator provides a wrapper around a element factory | |
* which validates the props passed to the element. This is intended to be | |
* used only in DEV and could be replaced by a static type checker for languages | |
* that support it. | |
*/ | |
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; | |
var ReactCurrentOwner = __webpack_require__(11); | |
var ReactComponentTreeHook = __webpack_require__(7); | |
var ReactElement = __webpack_require__(15); | |
var checkReactTypeSpec = __webpack_require__(387); | |
var canDefineProperty = __webpack_require__(35); | |
var getIteratorFn = __webpack_require__(88); | |
var warning = __webpack_require__(2); | |
var lowPriorityWarning = __webpack_require__(54); | |
function getDeclarationErrorAddendum() { | |
if (ReactCurrentOwner.current) { | |
var name = ReactCurrentOwner.current.getName(); | |
if (name) { | |
return ' Check the render method of `' + name + '`.'; | |
} | |
} | |
return ''; | |
} | |
function getSourceInfoErrorAddendum(elementProps) { | |
if (elementProps !== null && elementProps !== undefined && elementProps.__source !== undefined) { | |
var source = elementProps.__source; | |
var fileName = source.fileName.replace(/^.*[\\\/]/, ''); | |
var lineNumber = source.lineNumber; | |
return ' Check your code at ' + fileName + ':' + lineNumber + '.'; | |
} | |
return ''; | |
} | |
/** | |
* Warn if there's no key explicitly set on dynamic arrays of children or | |
* object keys are not valid. This allows us to keep track of children between | |
* updates. | |
*/ | |
var ownerHasKeyUseWarning = {}; | |
function getCurrentComponentErrorInfo(parentType) { | |
var info = getDeclarationErrorAddendum(); | |
if (!info) { | |
var parentName = typeof parentType === 'string' ? parentType : parentType.displayName || parentType.name; | |
if (parentName) { | |
info = ' Check the top-level render call using <' + parentName + '>.'; | |
} | |
} | |
return info; | |
} | |
/** | |
* Warn if the element doesn't have an explicit key assigned to it. | |
* This element is in an array. The array could grow and shrink or be | |
* reordered. All children that haven't already been validated are required to | |
* have a "key" property assigned to it. Error statuses are cached so a warning | |
* will only be shown once. | |
* | |
* @internal | |
* @param {ReactElement} element Element that requires a key. | |
* @param {*} parentType element's parent's type. | |
*/ | |
function validateExplicitKey(element, parentType) { | |
if (!element._store || element._store.validated || element.key != null) { | |
return; | |
} | |
element._store.validated = true; | |
var memoizer = ownerHasKeyUseWarning.uniqueKey || (ownerHasKeyUseWarning.uniqueKey = {}); | |
var currentComponentErrorInfo = getCurrentComponentErrorInfo(parentType); | |
if (memoizer[currentComponentErrorInfo]) { | |
return; | |
} | |
memoizer[currentComponentErrorInfo] = true; | |
// Usually the current owner is the offender, but if it accepts children as a | |
// property, it may be the creator of the child that's responsible for | |
// assigning it a key. | |
var childOwner = ''; | |
if (element && element._owner && element._owner !== ReactCurrentOwner.current) { | |
// Give the component that originally created this child. | |
childOwner = ' It was passed a child from ' + element._owner.getName() + '.'; | |
} | |
process.env.NODE_ENV !== '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; | |
} | |
/** | |
* Ensure that every element either is passed in a static location, in an | |
* array with an explicit keys property defined, or in an object literal | |
* with valid key property. | |
* | |
* @internal | |
* @param {ReactNode} node Statically passed child of any type. | |
* @param {*} parentType node's parent's type. | |
*/ | |
function validateChildKeys(node, parentType) { | |
if ((typeof node === 'undefined' ? 'undefined' : _typeof(node)) !== 'object') { | |
return; | |
} | |
if (Array.isArray(node)) { | |
for (var i = 0; i < node.length; i++) { | |
var child = node[i]; | |
if (ReactElement.isValidElement(child)) { | |
validateExplicitKey(child, parentType); | |
} | |
} | |
} else if (ReactElement.isValidElement(node)) { | |
// This element was passed in a valid location. | |
if (node._store) { | |
node._store.validated = true; | |
} | |
} else if (node) { | |
var iteratorFn = getIteratorFn(node); | |
// Entry iterators provide implicit keys. | |
if (iteratorFn) { | |
if (iteratorFn !== node.entries) { | |
var iterator = iteratorFn.call(node); | |
var step; | |
while (!(step = iterator.next()).done) { | |
if (ReactElement.isValidElement(step.value)) { | |
validateExplicitKey(step.value, parentType); | |
} | |
} | |
} | |
} | |
} | |
} | |
/** | |
* Given an element, validate that its props follow the propTypes definition, | |
* provided by the type. | |
* | |
* @param {ReactElement} element | |
*/ | |
function validatePropTypes(element) { | |
var componentClass = element.type; | |
if (typeof componentClass !== 'function') { | |
return; | |
} | |
var name = componentClass.displayName || componentClass.name; | |
if (componentClass.propTypes) { | |
checkReactTypeSpec(componentClass.propTypes, element.props, 'prop', name, element, null); | |
} | |
if (typeof componentClass.getDefaultProps === 'function') { | |
process.env.NODE_ENV !== 'production' ? warning(componentClass.getDefaultProps.isReactClassApproved, 'getDefaultProps is only used on classic React.createClass ' + 'definitions. Use a static property named `defaultProps` instead.') : void 0; | |
} | |
} | |
var ReactElementValidator = { | |
createElement: function createElement(type, props, children) { | |
var validType = typeof type === 'string' || typeof type === 'function'; | |
// We warn in this case but don't throw. We expect the element creation to | |
// succeed and there will likely be errors in render. | |
if (!validType) { | |
if (typeof type !== 'function' && typeof type !== 'string') { | |
var info = ''; | |
if (type === undefined || (typeof type === 'undefined' ? 'undefined' : _typeof(type)) === 'object' && type !== null && Object.keys(type).length === 0) { | |
info += ' You likely forgot to export your component from the file ' + "it's defined in."; | |
} | |
var sourceInfo = getSourceInfoErrorAddendum(props); | |
if (sourceInfo) { | |
info += sourceInfo; | |
} else { | |
info += getDeclarationErrorAddendum(); | |
} | |
info += ReactComponentTreeHook.getCurrentStackAddendum(); | |
var currentSource = props !== null && props !== undefined && props.__source !== undefined ? props.__source : null; | |
ReactComponentTreeHook.pushNonStandardWarningStack(true, currentSource); | |
process.env.NODE_ENV !== 'production' ? warning(false, 'React.createElement: type is invalid -- expected a string (for ' + 'built-in components) or a class/function (for composite ' + 'components) but got: %s.%s', type == null ? type : typeof type === 'undefined' ? 'undefined' : _typeof(type), info) : void 0; | |
ReactComponentTreeHook.popNonStandardWarningStack(); | |
} | |
} | |
var element = ReactElement.createElement.apply(this, arguments); | |
// The result can be nullish if a mock or a custom function is used. | |
// TODO: Drop this when these are no longer allowed as the type argument. | |
if (element == null) { | |
return element; | |
} | |
// Skip key warning if the type isn't valid since our key validation logic | |
// doesn't expect a non-string/function type and can throw confusing errors. | |
// We don't want exception behavior to differ between dev and prod. | |
// (Rendering will throw with a helpful message and as soon as the type is | |
// fixed, the key warnings will appear.) | |
if (validType) { | |
for (var i = 2; i < arguments.length; i++) { | |
validateChildKeys(arguments[i], type); | |
} | |
} | |
validatePropTypes(element); | |
return element; | |
}, | |
createFactory: function createFactory(type) { | |
var validatedFactory = ReactElementValidator.createElement.bind(null, type); | |
// Legacy hook TODO: Warn if this is accessed | |
validatedFactory.type = type; | |
if (process.env.NODE_ENV !== 'production') { | |
if (canDefineProperty) { | |
Object.defineProperty(validatedFactory, 'type', { | |
enumerable: false, | |
get: function get() { | |
lowPriorityWarning(false, 'Factory.type is deprecated. Access the class directly ' + 'before passing it to createFactory.'); | |
Object.defineProperty(this, 'type', { | |
value: type | |
}); | |
return type; | |
} | |
}); | |
} | |
} | |
return validatedFactory; | |
}, | |
cloneElement: function cloneElement(element, props, children) { | |
var newElement = ReactElement.cloneElement.apply(this, arguments); | |
for (var i = 2; i < arguments.length; i++) { | |
validateChildKeys(arguments[i], newElement.type); | |
} | |
validatePropTypes(newElement); | |
return newElement; | |
} | |
}; | |
module.exports = ReactElementValidator; | |
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0))) | |
/***/ }), | |
/* 87 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
"use strict"; | |
/* WEBPACK VAR INJECTION */(function(process) {/** | |
* Copyright 2015-present, Facebook, Inc. | |
* All rights reserved. | |
* | |
* This source code is licensed under the BSD-style license found in the | |
* LICENSE file in the root directory of this source tree. An additional grant | |
* of patent rights can be found in the PATENTS file in the same directory. | |
* | |
*/ | |
var warning = __webpack_require__(2); | |
function warnNoop(publicInstance, callerName) { | |
if (process.env.NODE_ENV !== 'production') { | |
var constructor = publicInstance.constructor; | |
process.env.NODE_ENV !== 'production' ? warning(false, '%s(...): Can only update a mounted or mounting component. ' + 'This usually means you called %s() on an unmounted component. ' + 'This is a no-op. Please check the code for the %s component.', callerName, callerName, constructor && (constructor.displayName || constructor.name) || 'ReactClass') : void 0; | |
} | |
} | |
/** | |
* This is the abstract API for an update queue. | |
*/ | |
var ReactNoopUpdateQueue = { | |
/** | |
* Checks whether or not this composite component is mounted. | |
* @param {ReactClass} publicInstance The instance we want to test. | |
* @return {boolean} True if mounted, false otherwise. | |
* @protected | |
* @final | |
*/ | |
isMounted: function isMounted(publicInstance) { | |
return false; | |
}, | |
/** | |
* Enqueue a callback that will be executed after all the pending updates | |
* have processed. | |
* | |
* @param {ReactClass} publicInstance The instance to use as `this` context. | |
* @param {?function} callback Called after state is updated. | |
* @internal | |
*/ | |
enqueueCallback: function enqueueCallback(publicInstance, callback) {}, | |
/** | |
* Forces an update. This should only be invoked when it is known with | |
* certainty that we are **not** in a DOM transaction. | |
* | |
* You may want to call this when you know that some deeper aspect of the | |
* component's state has changed but `setState` was not called. | |
* | |
* This will not invoke `shouldComponentUpdate`, but it will invoke | |
* `componentWillUpdate` and `componentDidUpdate`. | |
* | |
* @param {ReactClass} publicInstance The instance that should rerender. | |
* @internal | |
*/ | |
enqueueForceUpdate: function enqueueForceUpdate(publicInstance) { | |
warnNoop(publicInstance, 'forceUpdate'); | |
}, | |
/** | |
* Replaces all of the state. Always use this or `setState` to mutate state. | |
* You should treat `this.state` as immutable. | |
* | |
* There is no guarantee that `this.state` will be immediately updated, so | |
* accessing `this.state` after calling this method may return the old value. | |
* | |
* @param {ReactClass} publicInstance The instance that should rerender. | |
* @param {object} completeState Next state. | |
* @internal | |
*/ | |
enqueueReplaceState: function enqueueReplaceState(publicInstance, completeState) { | |
warnNoop(publicInstance, 'replaceState'); | |
}, | |
/** | |
* Sets a subset of the state. This only exists because _pendingState is | |
* internal. This provides a merging strategy that is not available to deep | |
* properties which is confusing. TODO: Expose pendingState or don't use it | |
* during the merge. | |
* | |
* @param {ReactClass} publicInstance The instance that should rerender. | |
* @param {object} partialState Next partial state to be merged with state. | |
* @internal | |
*/ | |
enqueueSetState: function enqueueSetState(publicInstance, partialState) { | |
warnNoop(publicInstance, 'setState'); | |
} | |
}; | |
module.exports = ReactNoopUpdateQueue; | |
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0))) | |
/***/ }), | |
/* 88 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
"use strict"; | |
/** | |
* Copyright 2013-present, Facebook, Inc. | |
* All rights reserved. | |
* | |
* This source code is licensed under the BSD-style license found in the | |
* LICENSE file in the root directory of this source tree. An additional grant | |
* of patent rights can be found in the PATENTS file in the same directory. | |
* | |
* | |
*/ | |
/* global Symbol */ | |
var ITERATOR_SYMBOL = typeof Symbol === 'function' && Symbol.iterator; | |
var FAUX_ITERATOR_SYMBOL = '@@iterator'; // Before Symbol spec. | |
/** | |
* Returns the iterator method function contained on the iterable object. | |
* | |
* Be sure to invoke the function with the iterable as context: | |
* | |
* var iteratorFn = getIteratorFn(myIterable); | |
* if (iteratorFn) { | |
* var iterator = iteratorFn.call(myIterable); | |
* ... | |
* } | |
* | |
* @param {?object} maybeIterable | |
* @return {?function} | |
*/ | |
function getIteratorFn(maybeIterable) { | |
var iteratorFn = maybeIterable && (ITERATOR_SYMBOL && maybeIterable[ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL]); | |
if (typeof iteratorFn === 'function') { | |
return iteratorFn; | |
} | |
} | |
module.exports = getIteratorFn; | |
/***/ }), | |
/* 89 */ | |
/***/ (function(module, __webpack_exports__, __webpack_require__) { | |
"use strict"; | |
/* harmony export (immutable) */ __webpack_exports__["d"] = gaPromise; | |
/* harmony export (immutable) */ __webpack_exports__["a"] = isScrollableLink; | |
/* harmony export (immutable) */ __webpack_exports__["b"] = scrollTo; | |
/* unused harmony export sendLinkDetails */ | |
/* unused harmony export goToLink */ | |
/* harmony export (immutable) */ __webpack_exports__["c"] = setupLinkTracking; | |
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_jquery__ = __webpack_require__(28); | |
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_jquery___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_jquery__); | |
var _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"]) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } }; }(); | |
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; | |
function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } } | |
/* eslint-env browser */ | |
var SEND_COMMAND = 'send'; | |
var EVENT_HIT_TYPE = 'event'; | |
var EVENT_FIELDS = ['eventCategory', 'eventAction', 'eventLabel', 'eventValue', 'transport', 'hitCallback']; | |
/** | |
* Compulsory fields for send event on clicking a link. | |
*/ | |
function compulsoryFields() /* link */{ | |
return { | |
transport: 'beacon' | |
}; | |
} | |
/** | |
* Returns the URL origin given a string representation of it. If the browser | |
* does not support URL, it returns href itself. | |
* | |
* @param {String} href the string containing the URL. | |
* @return {String} the origin of the URL. | |
*/ | |
function getOrigin(href) { | |
if (URL !== undefined) { | |
return new URL(href).origin; | |
} | |
return href; | |
} | |
/** | |
* Computes the default values for some keys to the send event command. | |
* | |
* @param {HTMLAnchorElement} link anchor clicked. | |
* @return {Object} object with the default values. | |
*/ | |
function defaultsForLink(link) { | |
var sameOrigin = getOrigin(link) === window.location.origin; | |
return { | |
eventCategory: sameOrigin ? 'inbound' : 'outbound', | |
eventAction: 'click', | |
eventLabel: link.href | |
}; | |
} | |
/** | |
* Computes the data for a given anchor element | |
* | |
* @param {HTMLAnchorElement} link | |
* @return {Object} object with the values to call ga send event command. | |
*/ | |
function getData(link) { | |
var data = Object.assign(defaultsForLink(link), link.dataset, compulsoryFields(link)); | |
return EVENT_FIELDS.reduce(function (memo, key) { | |
/* eslint no-param-reassign: ["error", { "props": false }] */ | |
if (key in data) { | |
memo[key] = data[key]; | |
} | |
return memo; | |
}, {}); | |
} | |
/** | |
* Returns the arguments to call ga command when the link has been clicked. | |
* | |
* @param {HTMLAnchorElement} link element to get the data from. | |
* @return {Array<String, String, Object>} arguments for ga method. | |
*/ | |
function commandArguments(link) { | |
return [SEND_COMMAND, EVENT_HIT_TYPE, getData(link)]; | |
} | |
// If ga is not installed, we have a fallback that both stores and logs the | |
// call. | |
var gaInternal = []; | |
var ga = window.ga || function () { | |
var _console; | |
for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) { | |
args[_key] = arguments[_key]; | |
} | |
gaInternal.push(args); | |
// eslint-disable-next-line no-console | |
(_console = console).log.apply(_console, args); | |
var last = args.pop(); | |
if (typeof last.hitCallback === 'function') { | |
setTimeout(last.hitCallback.bind(last), 0); | |
} | |
}; | |
/** | |
* Promisify ga | |
* | |
* @param {...any} args | |
* @return {Promise} a promise that resolves whenever the hitCallback is called. | |
*/ | |
function gaPromise() { | |
for (var _len2 = arguments.length, args = Array(_len2), _key2 = 0; _key2 < _len2; _key2++) { | |
args[_key2] = arguments[_key2]; | |
} | |
var obj = {}; | |
var oldCallback = function oldCallback() {}; | |
if (_typeof(args[args.length - 1]) === 'object') { | |
obj = args.pop(); | |
} | |
if (typeof obj.hitCallback === 'function') { | |
oldCallback = obj.hitCallback; | |
} | |
return new Promise(function (resolve) { | |
obj.hitCallback = function () { | |
oldCallback.apply(undefined, arguments); | |
resolve.apply(undefined, arguments); | |
}; | |
ga.apply(undefined, args.concat([obj])); | |
}); | |
} | |
function isScrollableLink(link) { | |
var _link$href$split = link.href.split('#'), | |
_link$href$split2 = _slicedToArray(_link$href$split, 2), | |
url = _link$href$split2[0], | |
id = _link$href$split2[1]; | |
return window.location.href.indexOf(url) >= 0 && id; | |
} | |
/** | |
* Scrolls to element anchored by the given link. | |
* | |
* @param {HTMLAnchorElement} link | |
*/ | |
function scrollTo(link) { | |
var _link$href$split3 = link.href.split('#'), | |
_link$href$split4 = _slicedToArray(_link$href$split3, 2), | |
id = _link$href$split4[1]; | |
__WEBPACK_IMPORTED_MODULE_0_jquery___default()('body, html').animate({ | |
scrollTop: __WEBPACK_IMPORTED_MODULE_0_jquery___default()('#' + id).offset().top | |
}, 1000); | |
} | |
/** | |
* Same as window.setTimeout, but as a promise. | |
* | |
* @param {Number} ms | |
*/ | |
function setTimeoutPromise(ms) { | |
return new Promise(function (resolve) { | |
return window.setTimeout(resolve, ms); | |
}); | |
} | |
/** | |
* Sends to Google Analytics the details from the link | |
* | |
* @param {HTMLAnchorElement} link anchor clicked | |
* @return {Promise} a promise resolved whenever hitCallback is called. | |
*/ | |
function sendLinkDetails(link) { | |
var ms = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 500; | |
return Promise.race([setTimeoutPromise(ms), gaPromise.apply(undefined, _toConsumableArray(commandArguments(link)))]); | |
} | |
/** | |
* Emulates the click on the link. | |
* | |
* @param {HTMLAnchorElement} link anchor to emulate | |
*/ | |
function goToLink(link) { | |
if (link.target === '_blank') { | |
window.open(link.href); | |
} else { | |
window.location.href = link.href; | |
} | |
} | |
function trackableLink(_ref) { | |
var dataset = _ref.dataset, | |
href = _ref.href; | |
return 'tracked' in dataset && href; | |
} | |
/** | |
* Sets up the tracking of links, inbound and outbound. | |
* | |
* For a link to be tracked it needs to: | |
* | |
* 1. Have a `data-tracked` attribute. | |
* 2. Have a non-empty `href` attribute. | |
* | |
* Or satisfy the acceptableCondition predicate. | |
*/ | |
function setupLinkTracking() { | |
var acceptableCondition = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : function () { | |
return false; | |
}; | |
document.addEventListener('click', function (evt) { | |
var target = evt.target; | |
if (!(trackableLink(target) || acceptableCondition(target))) { | |
return; | |
} | |
evt.preventDefault(); | |
if (isScrollableLink(target)) { | |
sendLinkDetails(target); | |
scrollTo(target); | |
return; | |
} | |
sendLinkDetails(target).then(function () { | |
return goToLink(target); | |
}); | |
}); | |
} | |
/***/ }), | |
/* 90 */ | |
/***/ (function(module, exports) { | |
module.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":"&","andand":"⩕","And":"⩓","and":"∧","andd":"⩜","andslope":"⩘","andv":"⩚","ang":"∠","ange":"⦤","angle":"∠","angmsdaa":"⦨","angmsdab":"⦩","angmsdac":"⦪","angmsdad":"⦫","angmsdae":"⦬","angmsdaf":"⦭","angmsdag":"⦮","angmsdah":"⦯","angmsd":"∡","angrt":"∟","angrtvb":"⊾","angrtvbd":"⦝","angsph":"∢","angst":"Å","angzarr":"⍼","Aogon":"Ą","aogon":"ą","Aopf":"𝔸","aopf":"𝕒","apacir":"⩯","ap":"≈","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":"⋍","bsolb":"⧅","bsol":"\\","bsolhsub":"⟈","bull":"•","bullet":"•","bump":"≎","bumpE":"⪮","bumpe":"≏","Bumpeq":"≎","bumpeq":"≏","Cacute":"Ć","cacute":"ć","capand":"⩄","capbrcup":"⩉","capcap":"⩋","cap":"∩","Cap":"⋒","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":"χ","circ":"ˆ","circeq":"≗","circlearrowleft":"↺","circlearrowright":"↻","circledast":"⊛","circledcirc":"⊚","circleddash":"⊝","CircleDot":"⊙","circledR":"®","circledS":"Ⓢ","CircleMinus":"⊖","CirclePlus":"⊕","CircleTimes":"⊗","cir":"○","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":"⤽","cupbrcap":"⩈","cupcap":"⩆","CupCap":"≍","cup":"∪","Cup":"⋓","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":"д","ddagger":"‡","ddarr":"⇊","DD":"ⅅ","dd":"ⅆ","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":"∥","DownArrowBar":"⤓","downarrow":"↓","DownArrow":"↓","Downarrow":"⇓","DownArrowUpArrow":"⇵","DownBreve":"̑","downdownarrows":"⇊","downharpoonleft":"⇃","downharpoonright":"⇂","DownLeftRightVector":"⥐","DownLeftTeeVector":"⥞","DownLeftVectorBar":"⥖","DownLeftVector":"↽","DownRightTeeVector":"⥟","DownRightVectorBar":"⥗","DownRightVector":"⇁","DownTeeArrow":"↧","DownTee":"⊤","drbkarow":"⤐","drcorn":"⌟","drcrop":"⌌","Dscr":"𝒟","dscr":"𝒹","DScy":"Ѕ","dscy":"ѕ","dsol":"⧶","Dstrok":"Đ","dstrok":"đ","dtdot":"⋱","dtri":"▿","dtrif":"▾","duarr":"⇵","duhar":"⥯","dwangle":"⦦","DZcy":"Џ","dzcy":"џ","dzigrarr":"⟿","Eacute":"É","eacute":"é","easter":"⩮","Ecaron":"Ě","ecaron":"ě","Ecirc":"Ê","ecirc":"ê","ecir":"≖","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":"▫","emsp13":" ","emsp14":" ","emsp":" ","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":"⩾","gescc":"⪩","ges":"⩾","gesdot":"⪀","gesdoto":"⪂","gesdotol":"⪄","gesl":"⋛︀","gesles":"⪔","Gfr":"𝔊","gfr":"𝔤","gg":"≫","Gg":"⋙","ggg":"⋙","gimel":"ℷ","GJcy":"Ѓ","gjcy":"ѓ","gla":"⪥","gl":"≷","glE":"⪒","glj":"⪤","gnap":"⪊","gnapprox":"⪊","gne":"⪈","gnE":"≩","gneq":"⪈","gneqq":"≩","gnsim":"⋧","Gopf":"𝔾","gopf":"𝕘","grave":"`","GreaterEqual":"≥","GreaterEqualLess":"⋛","GreaterFullEqual":"≧","GreaterGreater":"⪢","GreaterLess":"≷","GreaterSlantEqual":"⩾","GreaterTilde":"≳","Gscr":"𝒢","gscr":"ℊ","gsim":"≳","gsime":"⪎","gsiml":"⪐","gtcc":"⪧","gtcir":"⩺","gt":">","GT":">","Gt":"≫","gtdot":"⋗","gtlPar":"⦕","gtquest":"⩼","gtrapprox":"⪆","gtrarr":"⥸","gtrdot":"⋗","gtreqless":"⋛","gtreqqless":"⪌","gtrless":"≷","gtrsim":"≳","gvertneqq":"≩︀","gvnE":"≩︀","Hacek":"ˇ","hairsp":" ","half":"½","hamilt":"ℋ","HARDcy":"Ъ","hardcy":"ъ","harrcir":"⥈","harr":"↔","hArr":"⇔","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","Imacr":"Ī","imacr":"ī","image":"ℑ","ImaginaryI":"ⅈ","imagline":"ℐ","imagpart":"ℑ","imath":"ı","Im":"ℑ","imof":"⊷","imped":"Ƶ","Implies":"⇒","incare":"℅","in":"∈","infin":"∞","infintie":"⧝","inodot":"ı","intcal":"⊺","int":"∫","Int":"∬","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":"«","larrb":"⇤","larrbfs":"⤟","larr":"←","Larr":"↞","lArr":"⇐","larrfs":"⤝","larrhk":"↩","larrlp":"↫","larrpl":"⤹","larrsim":"⥳","larrtl":"↢","latail":"⤙","lAtail":"⤛","lat":"⪫","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":"⟨","LeftArrowBar":"⇤","leftarrow":"←","LeftArrow":"←","Leftarrow":"⇐","LeftArrowRightArrow":"⇆","leftarrowtail":"↢","LeftCeiling":"⌈","LeftDoubleBracket":"⟦","LeftDownTeeVector":"⥡","LeftDownVectorBar":"⥙","LeftDownVector":"⇃","LeftFloor":"⌊","leftharpoondown":"↽","leftharpoonup":"↼","leftleftarrows":"⇇","leftrightarrow":"↔","LeftRightArrow":"↔","Leftrightarrow":"⇔","leftrightarrows":"⇆","leftrightharpoons":"⇋","leftrightsquigarrow":"↭","LeftRightVector":"⥎","LeftTeeArrow":"↤","LeftTee":"⊣","LeftTeeVector":"⥚","leftthreetimes":"⋋","LeftTriangleBar":"⧏","LeftTriangle":"⊲","LeftTriangleEqual":"⊴","LeftUpDownVector":"⥑","LeftUpTeeVector":"⥠","LeftUpVectorBar":"⥘","LeftUpVector":"↿","LeftVectorBar":"⥒","LeftVector":"↼","lEg":"⪋","leg":"⋚","leq":"≤","leqq":"≦","leqslant":"⩽","lescc":"⪨","les":"⩽","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":"љ","llarr":"⇇","ll":"≪","Ll":"⋘","llcorner":"⌞","Lleftarrow":"⇚","llhard":"⥫","lltri":"◺","Lmidot":"Ŀ","lmidot":"ŀ","lmoustache":"⎰","lmoust":"⎰","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":"ł","ltcc":"⪦","ltcir":"⩹","lt":"<","LT":"<","Lt":"≪","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":"µ","midast":"*","midcir":"⫰","mid":"∣","middot":"·","minusb":"⊟","minus":"−","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":"≉","natural":"♮","naturals":"ℕ","natur":"♮","nbsp":" ","nbump":"≎̸","nbumpe":"≏̸","ncap":"⩃","Ncaron":"Ň","ncaron":"ň","Ncedil":"Ņ","ncedil":"ņ","ncong":"≇","ncongdot":"⩭̸","ncup":"⩂","Ncy":"Н","ncy":"н","ndash":"–","nearhk":"⤤","nearr":"↗","neArr":"⇗","nearrow":"↗","ne":"≠","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":"⋶","NotLeftTriangleBar":"⧏̸","NotLeftTriangle":"⋪","NotLeftTriangleEqual":"⋬","NotLess":"≮","NotLessEqual":"≰","NotLessGreater":"≸","NotLessLess":"≪̸","NotLessSlantEqual":"⩽̸","NotLessTilde":"≴","NotNestedGreaterGreater":"⪢̸","NotNestedLessLess":"⪡̸","notni":"∌","notniva":"∌","notnivb":"⋾","notnivc":"⋽","NotPrecedes":"⊀","NotPrecedesEqual":"⪯̸","NotPrecedesSlantEqual":"⋠","NotReverseElement":"∌","NotRightTriangleBar":"⧐̸","NotRightTriangle":"⋫","NotRightTriangleEqual":"⋭","NotSquareSubset":"⊏̸","NotSquareSubsetEqual":"⋢","NotSquareSuperset":"⊐̸","NotSquareSupersetEqual":"⋣","NotSubset":"⊂⃒","NotSubsetEqual":"⊈","NotSucceeds":"⊁","NotSucceedsEqual":"⪰̸","NotSucceedsSlantEqual":"⋡","NotSucceedsTilde":"≿̸","NotSuperset":"⊃⃒","NotSupersetEqual":"⊉","NotTilde":"≁","NotTildeEqual":"≄","NotTildeFullEqual":"≇","NotTildeTilde":"≉","NotVerticalBar":"∤","nparallel":"∦","npar":"∦","nparsl":"⫽⃥","npart":"∂̸","npolint":"⨔","npr":"⊀","nprcue":"⋠","nprec":"⊀","npreceq":"⪯̸","npre":"⪯̸","nrarrc":"⤳̸","nrarr":"↛","nrArr":"⇏","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":"⊛","Ocirc":"Ô","ocirc":"ô","ocir":"⊚","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":"⊕","orarr":"↻","Or":"⩔","or":"∨","ord":"⩝","order":"ℴ","orderof":"ℴ","ordf":"ª","ordm":"º","origof":"⊶","oror":"⩖","orslope":"⩗","orv":"⩛","oS":"Ⓢ","Oscr":"𝒪","oscr":"ℴ","Oslash":"Ø","oslash":"ø","osol":"⊘","Otilde":"Õ","otilde":"õ","otimesas":"⨶","Otimes":"⨷","otimes":"⊗","Ouml":"Ö","ouml":"ö","ovbar":"⌽","OverBar":"‾","OverBrace":"⏞","OverBracket":"⎴","OverParenthesis":"⏜","para":"¶","parallel":"∥","par":"∥","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":"ℏ","plusacir":"⨣","plusb":"⊞","pluscir":"⨢","plus":"+","plusdo":"∔","plusdu":"⨥","pluse":"⩲","PlusMinus":"±","plusmn":"±","plussim":"⨦","plustwo":"⨧","pm":"±","Poincareplane":"ℌ","pointint":"⨕","popf":"𝕡","Popf":"ℙ","pound":"£","prap":"⪷","Pr":"⪻","pr":"≺","prcue":"≼","precapprox":"⪷","prec":"≺","preccurlyeq":"≼","Precedes":"≺","PrecedesEqual":"⪯","PrecedesSlantEqual":"≼","PrecedesTilde":"≾","preceq":"⪯","precnapprox":"⪹","precneqq":"⪵","precnsim":"⋨","pre":"⪯","prE":"⪳","precsim":"≾","prime":"′","Prime":"″","primes":"ℙ","prnap":"⪹","prnE":"⪵","prnsim":"⋨","prod":"∏","Product":"∏","profalar":"⌮","profline":"⌒","profsurf":"⌓","prop":"∝","Proportional":"∝","Proportion":"∷","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":"»","rarrap":"⥵","rarrb":"⇥","rarrbfs":"⤠","rarrc":"⤳","rarr":"→","Rarr":"↠","rArr":"⇒","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":"↳","real":"ℜ","realine":"ℛ","realpart":"ℜ","reals":"ℝ","Re":"ℜ","rect":"▭","reg":"®","REG":"®","ReverseElement":"∋","ReverseEquilibrium":"⇋","ReverseUpEquilibrium":"⥯","rfisht":"⥽","rfloor":"⌋","rfr":"𝔯","Rfr":"ℜ","rHar":"⥤","rhard":"⇁","rharu":"⇀","rharul":"⥬","Rho":"Ρ","rho":"ρ","rhov":"ϱ","RightAngleBracket":"⟩","RightArrowBar":"⇥","rightarrow":"→","RightArrow":"→","Rightarrow":"⇒","RightArrowLeftArrow":"⇄","rightarrowtail":"↣","RightCeiling":"⌉","RightDoubleBracket":"⟧","RightDownTeeVector":"⥝","RightDownVectorBar":"⥕","RightDownVector":"⇂","RightFloor":"⌋","rightharpoondown":"⇁","rightharpoonup":"⇀","rightleftarrows":"⇄","rightleftharpoons":"⇌","rightrightarrows":"⇉","rightsquigarrow":"↝","RightTeeArrow":"↦","RightTee":"⊢","RightTeeVector":"⥛","rightthreetimes":"⋌","RightTriangleBar":"⧐","RightTriangle":"⊳","RightTriangleEqual":"⊵","RightUpDownVector":"⥏","RightUpTeeVector":"⥜","RightUpVectorBar":"⥔","RightUpVector":"↾","RightVectorBar":"⥓","RightVector":"⇀","ring":"˚","risingdotseq":"≓","rlarr":"⇄","rlhar":"⇌","rlm":"","rmoustache":"⎱","rmoust":"⎱","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":"‚","scap":"⪸","Scaron":"Š","scaron":"š","Sc":"⪼","sc":"≻","sccue":"≽","sce":"⪰","scE":"⪴","Scedil":"Ş","scedil":"ş","Scirc":"Ŝ","scirc":"ŝ","scnap":"⪺","scnE":"⪶","scnsim":"⋩","scpolint":"⨓","scsim":"≿","Scy":"С","scy":"с","sdotb":"⊡","sdot":"⋅","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":"ь","solbar":"⌿","solb":"⧄","sol":"/","Sopf":"𝕊","sopf":"𝕤","spades":"♠","spadesuit":"♠","spar":"∥","sqcap":"⊓","sqcaps":"⊓︀","sqcup":"⊔","sqcups":"⊔︀","Sqrt":"√","sqsub":"⊏","sqsube":"⊑","sqsubset":"⊏","sqsubseteq":"⊑","sqsup":"⊐","sqsupe":"⊒","sqsupset":"⊐","sqsupseteq":"⊒","square":"□","Square":"□","SquareIntersection":"⊓","SquareSubset":"⊏","SquareSubsetEqual":"⊑","SquareSuperset":"⊐","SquareSupersetEqual":"⊒","SquareUnion":"⊔","squarf":"▪","squ":"□","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":"⫓","succapprox":"⪸","succ":"≻","succcurlyeq":"≽","Succeeds":"≻","SucceedsEqual":"⪰","SucceedsSlantEqual":"≽","SucceedsTilde":"≿","succeq":"⪰","succnapprox":"⪺","succneqq":"⪶","succnsim":"⋩","succsim":"≿","SuchThat":"∋","sum":"∑","Sum":"∑","sung":"♪","sup1":"¹","sup2":"²","sup3":"³","sup":"⊃","Sup":"⋑","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":"\t","target":"⌖","Tau":"Τ","tau":"τ","tbrk":"⎴","Tcaron":"Ť","tcaron":"ť","Tcedil":"Ţ","tcedil":"ţ","Tcy":"Т","tcy":"т","tdot":"⃛","telrec":"⌕","Tfr":"𝔗","tfr":"𝔱","there4":"∴","therefore":"∴","Therefore":"∴","Theta":"Θ","theta":"θ","thetasym":"ϑ","thetav":"ϑ","thickapprox":"≈","thicksim":"∼","ThickSpace":" ","ThinSpace":" ","thinsp":" ","thkap":"≈","thksim":"∼","THORN":"Þ","thorn":"þ","tilde":"˜","Tilde":"∼","TildeEqual":"≃","TildeFullEqual":"≅","TildeTilde":"≈","timesbar":"⨱","timesb":"⊠","times":"×","timesd":"⨰","tint":"∭","toea":"⤨","topbot":"⌶","topcir":"⫱","top":"⊤","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":"𝕦","UpArrowBar":"⤒","uparrow":"↑","UpArrow":"↑","Uparrow":"⇑","UpArrowDownArrow":"⇅","updownarrow":"↕","UpDownArrow":"↕","Updownarrow":"⇕","UpEquilibrium":"⥮","upharpoonleft":"↿","upharpoonright":"↾","uplus":"⊎","UpperLeftArrow":"↖","UpperRightArrow":"↗","upsi":"υ","Upsi":"ϒ","upsih":"ϒ","Upsilon":"Υ","upsilon":"υ","UpTeeArrow":"↥","UpTee":"⊥","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":"⫦","veebar":"⊻","vee":"∨","Vee":"⋁","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":""} | |
/***/ }), | |
/* 91 */ | |
/***/ (function(module, exports) { | |
module.exports = {"amp":"&","apos":"'","gt":">","lt":"<","quot":"\""} | |
/***/ }), | |
/* 92 */ | |
/***/ (function(module, __webpack_exports__, __webpack_require__) { | |
"use strict"; | |
Object.defineProperty(__webpack_exports__, "__esModule", { value: true }); | |
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_es6_promise__ = __webpack_require__(105); | |
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_es6_promise___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_es6_promise__); | |
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_isomorphic_fetch__ = __webpack_require__(298); | |
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_isomorphic_fetch___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1_isomorphic_fetch__); | |
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_react_dom__ = __webpack_require__(307); | |
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_react_dom___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_2_react_dom__); | |
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_react__ = __webpack_require__(16); | |
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_react___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_3_react__); | |
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4_jquery__ = __webpack_require__(28); | |
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4_jquery___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_4_jquery__); | |
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5_slick_carousel__ = __webpack_require__(392); | |
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5_slick_carousel___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_5_slick_carousel__); | |
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6_lightbox2__ = __webpack_require__(299); | |
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6_lightbox2___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_6_lightbox2__); | |
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_7_lightbox2_dist_css_lightbox_css__ = __webpack_require__(405); | |
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_7_lightbox2_dist_css_lightbox_css___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_7_lightbox2_dist_css_lightbox_css__); | |
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_8_highlight_js__ = __webpack_require__(121); | |
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_8_highlight_js___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_8_highlight_js__); | |
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_9__components_Posts__ = __webpack_require__(400); | |
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_10__components_Positions__ = __webpack_require__(399); | |
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_11__components_SlackForm__ = __webpack_require__(401); | |
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_12__services_link_track__ = __webpack_require__(89); | |
/* eslint-env browser */ | |
__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_0_es6_promise__["polyfill"])(); | |
function renderComponent(component, target) { | |
var props = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}; | |
var elem = target; | |
if (typeof target === 'string') { | |
elem = document.getElementById(target); | |
} | |
if (elem) { | |
__WEBPACK_IMPORTED_MODULE_2_react_dom___default.a.render(__WEBPACK_IMPORTED_MODULE_3_react___default.a.createElement(component, Object.assign({}, props, elem.dataset)), elem); | |
} | |
} | |
function renderBlogCategories(selector, containerId) { | |
var enableBlogContainer = function enableBlogContainer() { | |
document.getElementById(containerId).style.display = 'block'; | |
}; | |
var categories = Array.from(document.querySelectorAll(selector)); | |
categories.forEach(function (category) { | |
var props = { | |
onSuccess: enableBlogContainer, | |
category: category.dataset | |
}; | |
var component = __WEBPACK_IMPORTED_MODULE_3_react___default.a.createElement(__WEBPACK_IMPORTED_MODULE_9__components_Posts__["a" /* default */], props); | |
__WEBPACK_IMPORTED_MODULE_2_react_dom___default.a.render(component, category); | |
}); | |
} | |
function setupSmoothScroll() { | |
var elems = Array.from(document.querySelectorAll('.scroll-to:not([data-tracked])')); | |
elems.forEach(function (elem) { | |
elem.addEventListener('click', function (e) { | |
if (__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_12__services_link_track__["a" /* isScrollableLink */])(elem)) { | |
e.preventDefault(); | |
__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_12__services_link_track__["b" /* scrollTo */])(elem); | |
} | |
}); | |
}); | |
} | |
function setupMenu() { | |
var menu = document.getElementById('menu'); | |
var toggle = document.getElementById('menu-toggle'); | |
toggle.addEventListener('click', function () { | |
menu.classList.toggle('horizontal-menu_open'); | |
toggle.classList.toggle('horizontal-menu-toggle_open'); | |
}); | |
var mainMenu = document.getElementById('menu-main'); | |
var navs = Array.from(document.querySelectorAll('.nav-to')); | |
var menus = Array.from(document.querySelectorAll('#menu > ul')); | |
navs.forEach(function (n) { | |
var to = n.getAttribute('data-nav-to'); | |
n.addEventListener('click', function (e) { | |
e.preventDefault(); | |
menus.forEach(function (m) { | |
return m.classList.remove('visible'); | |
}); | |
var menuTo = document.getElementById('menu-' + to) || mainMenu; | |
menuTo.classList.add('visible'); | |
}); | |
}); | |
} | |
function renderHorizontalSlackForms() { | |
var elems = document.querySelectorAll('.horizontal-slack-join'); | |
Array.from(elems).forEach(function (form) { | |
renderComponent(__WEBPACK_IMPORTED_MODULE_11__components_SlackForm__["a" /* default */], form); | |
}); | |
} | |
function checkTopbarOpacity(topBar, opaqueAtOffset) { | |
if (window.pageYOffset > opaqueAtOffset) { | |
topBar.classList.add('opaque'); | |
} else { | |
topBar.classList.remove('opaque'); | |
} | |
} | |
function setupStickyHeader() { | |
var topBar = document.querySelector('#topbar'); | |
var offset = 50; | |
if (topBar.classList.contains('opaque')) { | |
return; | |
} | |
checkTopbarOpacity(topBar, offset); | |
window.addEventListener('scroll', function () { | |
return checkTopbarOpacity(topBar, offset); | |
}); | |
} | |
function highlightCode(code) { | |
if (code.children.length >= 0) { | |
__WEBPACK_IMPORTED_MODULE_8_highlight_js___default.a.highlightBlock(code.children[0]); | |
} | |
} | |
function setupExamples() { | |
var example = __WEBPACK_IMPORTED_MODULE_4_jquery___default()('.examples__project'); | |
var code = document.getElementById('example-code'); | |
var title = document.getElementById('example-title'); | |
var btn = document.getElementById('example-btn'); | |
if (!code) { | |
return; | |
} | |
example.slick({ | |
dots: true, | |
infinite: true, | |
speed: 500, | |
fade: true, | |
swipe: false, | |
adaptiveHeight: true, | |
appendArrows: '.examples__info__navigation', | |
appendDots: '.examples__info__navigation' | |
}); | |
highlightCode(code); | |
example.on('beforeChange', function (e, slick, currentSlide, nextSlide) { | |
var project = window.examples[nextSlide >= window.examples.length ? 0 : nextSlide]; | |
title.innerText = project.title; | |
btn.title = project.title; | |
btn.href = project.link; | |
code.innerHTML = '\n <pre><code class="' + project.language + '">' + project.code + '</code></pre>\n '; | |
highlightCode(code); | |
}); | |
} | |
function shuffle(arr) { | |
for (var i = arr.length; i > 0; i--) { | |
var j = Math.floor(Math.random() * i); | |
// eslint-disable-next-line no-param-reassign | |
var _ref = [arr[j], arr[i - 1]]; | |
arr[i - 1] = _ref[0]; | |
arr[j] = _ref[1]; | |
} | |
} | |
function setupTestimonials() { | |
var testimonials = document.getElementById('testimonials'); | |
if (!testimonials) { | |
return; | |
} | |
var children = Array.from(testimonials.children); | |
shuffle(children); | |
testimonials.innerHTML = ''; | |
children.slice(0, 2).forEach(function (c) { | |
return testimonials.appendChild(c); | |
}); | |
} | |
function detectSafari() { | |
var detector = function detector(name) { | |
return navigator.userAgent.search(name); | |
}; | |
if (detector('Safari') >= 0 && detector('Chrome') < 0) { | |
document.body.classList.add('safari'); | |
} | |
} | |
window.addEventListener('DOMContentLoaded', function () { | |
setupStickyHeader(); | |
setupMenu(); | |
setupExamples(); | |
renderBlogCategories('.blog__category', 'blog-container'); | |
renderComponent(__WEBPACK_IMPORTED_MODULE_10__components_Positions__["a" /* default */], 'offers'); | |
renderComponent(__WEBPACK_IMPORTED_MODULE_11__components_SlackForm__["a" /* default */], 'slack-join'); | |
renderHorizontalSlackForms(); | |
setupTestimonials(); | |
__WEBPACK_IMPORTED_MODULE_6_lightbox2___default.a.option({ | |
disableScrolling: true | |
}); | |
setupSmoothScroll(); | |
__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_12__services_link_track__["c" /* default */])(); | |
detectSafari(); | |
}); | |
/***/ }), | |
/* 93 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
"use strict"; | |
var React = __webpack_require__(16); | |
var assign = __webpack_require__(300); | |
var isPlainObject = __webpack_require__(301); | |
var xssFilters = __webpack_require__(397); | |
var pascalCase = __webpack_require__(304); | |
var typeAliases = { | |
blockquote: 'block_quote', | |
thematicbreak: 'thematic_break', | |
htmlblock: 'html_block', | |
htmlinline: 'html_inline', | |
codeblock: 'code_block', | |
hardbreak: 'linebreak' | |
}; | |
var defaultRenderers = { | |
block_quote: 'blockquote', // eslint-disable-line camelcase | |
emph: 'em', | |
linebreak: 'br', | |
image: 'img', | |
item: 'li', | |
link: 'a', | |
paragraph: 'p', | |
strong: 'strong', | |
thematic_break: 'hr', // eslint-disable-line camelcase | |
html_block: HtmlRenderer, // eslint-disable-line camelcase | |
html_inline: HtmlRenderer, // eslint-disable-line camelcase | |
list: function List(props) { | |
var tag = props.type.toLowerCase() === 'bullet' ? 'ul' : 'ol'; | |
var attrs = getCoreProps(props); | |
if (props.start !== null && props.start !== 1) { | |
attrs.start = props.start.toString(); | |
} | |
return createElement(tag, attrs, props.children); | |
}, | |
code_block: function CodeBlock(props) { | |
// eslint-disable-line camelcase | |
var className = props.language && 'language-' + props.language; | |
var code = createElement('code', { className: className }, props.literal); | |
return createElement('pre', getCoreProps(props), code); | |
}, | |
code: function Code(props) { | |
return createElement('code', getCoreProps(props), props.children); | |
}, | |
heading: function Heading(props) { | |
return createElement('h' + props.level, getCoreProps(props), props.children); | |
}, | |
text: null, | |
softbreak: null | |
}; | |
var coreTypes = Object.keys(defaultRenderers); | |
function getCoreProps(props) { | |
return { | |
'key': props.nodeKey, | |
'className': props.className, | |
'data-sourcepos': props['data-sourcepos'] | |
}; | |
} | |
function normalizeTypeName(typeName) { | |
var norm = typeName.toLowerCase(); | |
var type = typeAliases[norm] || norm; | |
return typeof defaultRenderers[type] !== 'undefined' ? type : typeName; | |
} | |
function normalizeRenderers(renderers) { | |
return Object.keys(renderers || {}).reduce(function (normalized, type) { | |
var norm = normalizeTypeName(type); | |
normalized[norm] = renderers[type]; | |
return normalized; | |
}, {}); | |
} | |
function HtmlRenderer(props) { | |
var coreProps = getCoreProps(props); | |
var nodeProps = props.escapeHtml ? {} : { dangerouslySetInnerHTML: { __html: props.literal } }; | |
var children = props.escapeHtml ? [props.literal] : null; | |
if (props.escapeHtml || !props.skipHtml) { | |
var actualProps = assign(coreProps, nodeProps); | |
return createElement(props.isBlock ? 'div' : 'span', actualProps, children); | |
} | |
} | |
function isGrandChildOfList(node) { | |
var grandparent = node.parent.parent; | |
return grandparent && grandparent.type.toLowerCase() === 'list' && grandparent.listTight; | |
} | |
function addChild(node, child) { | |
var parent = node; | |
do { | |
parent = parent.parent; | |
} while (!parent.react); | |
parent.react.children.push(child); | |
} | |
function createElement(tagName, props, children) { | |
var nodeChildren = Array.isArray(children) && children.reduce(reduceChildren, []); | |
var args = [tagName, props].concat(nodeChildren || children); | |
return React.createElement.apply(React, args); | |
} | |
function reduceChildren(children, child) { | |
var lastIndex = children.length - 1; | |
if (typeof child === 'string' && typeof children[lastIndex] === 'string') { | |
children[lastIndex] += child; | |
} else { | |
children.push(child); | |
} | |
return children; | |
} | |
function flattenPosition(pos) { | |
return [pos[0][0], ':', pos[0][1], '-', pos[1][0], ':', pos[1][1]].map(String).join(''); | |
} | |
// For some nodes, we want to include more props than for others | |
function getNodeProps(node, key, opts, renderer) { | |
var props = { key: key }, | |
undef; | |
// `sourcePos` is true if the user wants source information (line/column info from markdown source) | |
if (opts.sourcePos && node.sourcepos) { | |
props['data-sourcepos'] = flattenPosition(node.sourcepos); | |
} | |
var type = normalizeTypeName(node.type); | |
switch (type) { | |
case 'html_inline': | |
case 'html_block': | |
props.isBlock = type === 'html_block'; | |
props.escapeHtml = opts.escapeHtml; | |
props.skipHtml = opts.skipHtml; | |
break; | |
case 'code_block': | |
var codeInfo = node.info ? node.info.split(/ +/) : []; | |
if (codeInfo.length > 0 && codeInfo[0].length > 0) { | |
props.language = codeInfo[0]; | |
props.codeinfo = codeInfo; | |
} | |
break; | |
case 'code': | |
props.children = node.literal; | |
props.inline = true; | |
break; | |
case 'heading': | |
props.level = node.level; | |
break; | |
case 'softbreak': | |
props.softBreak = opts.softBreak; | |
break; | |
case 'link': | |
props.href = opts.transformLinkUri ? opts.transformLinkUri(node.destination) : node.destination; | |
props.title = node.title || undef; | |
if (opts.linkTarget) { | |
props.target = opts.linkTarget; | |
} | |
break; | |
case 'image': | |
props.src = opts.transformImageUri ? opts.transformImageUri(node.destination) : node.destination; | |
props.title = node.title || undef; | |
// Commonmark treats image description as children. We just want the text | |
props.alt = node.react.children.join(''); | |
node.react.children = undef; | |
break; | |
case 'list': | |
props.start = node.listStart; | |
props.type = node.listType; | |
props.tight = node.listTight; | |
break; | |
default: | |
} | |
if (typeof renderer !== 'string') { | |
props.literal = node.literal; | |
} | |
var children = props.children || node.react && node.react.children; | |
if (Array.isArray(children)) { | |
props.children = children.reduce(reduceChildren, []) || null; | |
} | |
return props; | |
} | |
function getPosition(node) { | |
if (!node) { | |
return null; | |
} | |
if (node.sourcepos) { | |
return flattenPosition(node.sourcepos); | |
} | |
return getPosition(node.parent); | |
} | |
function renderNodes(block) { | |
var walker = block.walker(); | |
// Softbreaks are usually treated as newlines, but in HTML we might want explicit linebreaks | |
var softBreak = this.softBreak === 'br' ? React.createElement('br') : this.softBreak; | |
var propOptions = { | |
sourcePos: this.sourcePos, | |
escapeHtml: this.escapeHtml, | |
skipHtml: this.skipHtml, | |
transformLinkUri: this.transformLinkUri, | |
transformImageUri: this.transformImageUri, | |
softBreak: softBreak, | |
linkTarget: this.linkTarget | |
}; | |
var e, | |
node, | |
entering, | |
leaving, | |
type, | |
doc, | |
key, | |
nodeProps, | |
prevPos, | |
prevIndex = 0; | |
while (e = walker.next()) { | |
var pos = getPosition(e.node.sourcepos ? e.node : e.node.parent); | |
if (prevPos === pos) { | |
key = pos + prevIndex; | |
prevIndex++; | |
} else { | |
key = pos; | |
prevIndex = 0; | |
} | |
prevPos = pos; | |
entering = e.entering; | |
leaving = !entering; | |
node = e.node; | |
type = normalizeTypeName(node.type); | |
nodeProps = null; | |
// If we have not assigned a document yet, assume the current node is just that | |
if (!doc) { | |
doc = node; | |
node.react = { children: [] }; | |
continue; | |
} else if (node === doc) { | |
// When we're leaving... | |
continue; | |
} | |
// In HTML, we don't want paragraphs inside of list items | |
if (type === 'paragraph' && isGrandChildOfList(node)) { | |
continue; | |
} | |
// If we're skipping HTML nodes, don't keep processing | |
if (this.skipHtml && (type === 'html_block' || type === 'html_inline')) { | |
continue; | |
} | |
var isDocument = node === doc; | |
var disallowedByConfig = this.allowedTypes.indexOf(type) === -1; | |
var disallowedByUser = false; | |
// Do we have a user-defined function? | |
var isCompleteParent = node.isContainer && leaving; | |
var renderer = this.renderers[type]; | |
if (this.allowNode && (isCompleteParent || !node.isContainer)) { | |
var nodeChildren = isCompleteParent ? node.react.children : []; | |
nodeProps = getNodeProps(node, key, propOptions, renderer); | |
disallowedByUser = !this.allowNode({ | |
type: pascalCase(type), | |
renderer: this.renderers[type], | |
props: nodeProps, | |
children: nodeChildren | |
}); | |
} | |
if (!isDocument && (disallowedByUser || disallowedByConfig)) { | |
if (!this.unwrapDisallowed && entering && node.isContainer) { | |
walker.resumeAt(node, false); | |
} | |
continue; | |
} | |
var isSimpleNode = type === 'text' || type === 'softbreak'; | |
if (typeof renderer !== 'function' && !isSimpleNode && typeof renderer !== 'string') { | |
throw new Error('Renderer for type `' + pascalCase(node.type) + '` not defined or is not renderable'); | |
} | |
if (node.isContainer && entering) { | |
node.react = { | |
component: renderer, | |
props: {}, | |
children: [] | |
}; | |
} else { | |
var childProps = nodeProps || getNodeProps(node, key, propOptions, renderer); | |
if (renderer) { | |
childProps = typeof renderer === 'string' ? childProps : assign(childProps, { nodeKey: childProps.key }); | |
addChild(node, React.createElement(renderer, childProps)); | |
} else if (type === 'text') { | |
addChild(node, node.literal); | |
} else if (type === 'softbreak') { | |
addChild(node, softBreak); | |
} | |
} | |
} | |
return doc.react.children; | |
} | |
function defaultLinkUriFilter(uri) { | |
var url = uri.replace(/file:\/\//g, 'x-file://'); | |
// React does a pretty swell job of escaping attributes, | |
// so to prevent double-escaping, we need to decode | |
return decodeURI(xssFilters.uriInDoubleQuotedAttr(url)); | |
} | |
function ReactRenderer(options) { | |
var opts = options || {}; | |
if (opts.allowedTypes && opts.disallowedTypes) { | |
throw new Error('Only one of `allowedTypes` and `disallowedTypes` should be defined'); | |
} | |
if (opts.allowedTypes && !Array.isArray(opts.allowedTypes)) { | |
throw new Error('`allowedTypes` must be an array'); | |
} | |
if (opts.disallowedTypes && !Array.isArray(opts.disallowedTypes)) { | |
throw new Error('`disallowedTypes` must be an array'); | |
} | |
if (opts.allowNode && typeof opts.allowNode !== 'function') { | |
throw new Error('`allowNode` must be a function'); | |
} | |
var linkFilter = opts.transformLinkUri; | |
if (typeof linkFilter === 'undefined') { | |
linkFilter = defaultLinkUriFilter; | |
} else if (linkFilter && typeof linkFilter !== 'function') { | |
throw new Error('`transformLinkUri` must either be a function, or `null` to disable'); | |
} | |
var imageFilter = opts.transformImageUri; | |
if (typeof imageFilter !== 'undefined' && typeof imageFilter !== 'function') { | |
throw new Error('`transformImageUri` must be a function'); | |
} | |
if (opts.renderers && !isPlainObject(opts.renderers)) { | |
throw new Error('`renderers` must be a plain object of `Type`: `Renderer` pairs'); | |
} | |
var allowedTypes = opts.allowedTypes && opts.allowedTypes.map(normalizeTypeName) || coreTypes; | |
if (opts.disallowedTypes) { | |
var disallowed = opts.disallowedTypes.map(normalizeTypeName); | |
allowedTypes = allowedTypes.filter(function filterDisallowed(type) { | |
return disallowed.indexOf(type) === -1; | |
}); | |
} | |
return { | |
sourcePos: Boolean(opts.sourcePos), | |
softBreak: opts.softBreak || '\n', | |
renderers: assign({}, defaultRenderers, normalizeRenderers(opts.renderers)), | |
escapeHtml: Boolean(opts.escapeHtml), | |
skipHtml: Boolean(opts.skipHtml), | |
transformLinkUri: linkFilter, | |
transformImageUri: imageFilter, | |
allowNode: opts.allowNode, | |
allowedTypes: allowedTypes, | |
unwrapDisallowed: Boolean(opts.unwrapDisallowed), | |
render: renderNodes, | |
linkTarget: opts.linkTarget || false | |
}; | |
} | |
ReactRenderer.uriTransformer = defaultLinkUriFilter; | |
ReactRenderer.types = coreTypes.map(pascalCase); | |
ReactRenderer.renderers = coreTypes.reduce(function (renderers, type) { | |
renderers[pascalCase(type)] = defaultRenderers[type]; | |
return renderers; | |
}, {}); | |
module.exports = ReactRenderer; | |
/***/ }), | |
/* 94 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
"use strict"; | |
var Node = __webpack_require__(36); | |
var unescapeString = __webpack_require__(17).unescapeString; | |
var OPENTAG = __webpack_require__(17).OPENTAG; | |
var CLOSETAG = __webpack_require__(17).CLOSETAG; | |
var CODE_INDENT = 4; | |
var C_TAB = 9; | |
var C_NEWLINE = 10; | |
var C_GREATERTHAN = 62; | |
var C_LESSTHAN = 60; | |
var C_SPACE = 32; | |
var C_OPEN_BRACKET = 91; | |
var InlineParser = __webpack_require__(98); | |
var reHtmlBlockOpen = [/./, // dummy for 0 | |
/^<(?:script|pre|style)(?:\s|>|$)/i, /^<!--/, /^<[?]/, /^<![A-Z]/, /^<!\[CDATA\[/, /^<[/]?(?:address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h1|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|section|source|title|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul)(?:\s|[/]?[>]|$)/i, new RegExp('^(?:' + OPENTAG + '|' + CLOSETAG + ')\s*$', 'i')]; | |
var reHtmlBlockClose = [/./, // dummy for 0 | |
/<\/(?:script|pre|style)>/i, /-->/, /\?>/, />/, /\]\]>/]; | |
var reThematicBreak = /^(?:(?:\* *){3,}|(?:_ *){3,}|(?:- *){3,}) *$/; | |
var reMaybeSpecial = /^[#`~*+_=<>0-9-]/; | |
var reNonSpace = /[^ \t\f\v\r\n]/; | |
var reBulletListMarker = /^[*+-]/; | |
var reOrderedListMarker = /^(\d{1,9})([.)])/; | |
var reATXHeadingMarker = /^#{1,6}(?: +|$)/; | |
var reCodeFence = /^`{3,}(?!.*`)|^~{3,}(?!.*~)/; | |
var reClosingCodeFence = /^(?:`{3,}|~{3,})(?= *$)/; | |
var reSetextHeadingLine = /^(?:=+|-+) *$/; | |
var reLineEnding = /\r\n|\n|\r/; | |
// Returns true if string contains only space characters. | |
var isBlank = function isBlank(s) { | |
return !reNonSpace.test(s); | |
}; | |
var peek = function peek(ln, pos) { | |
if (pos < ln.length) { | |
return ln.charCodeAt(pos); | |
} else { | |
return -1; | |
} | |
}; | |
// DOC PARSER | |
// These are methods of a Parser object, defined below. | |
// Returns true if block ends with a blank line, descending if needed | |
// into lists and sublists. | |
var endsWithBlankLine = function endsWithBlankLine(block) { | |
while (block) { | |
if (block._lastLineBlank) { | |
return true; | |
} | |
var t = block.type; | |
if (t === 'List' || t === 'Item') { | |
block = block._lastChild; | |
} else { | |
break; | |
} | |
} | |
return false; | |
}; | |
// Break out of all containing lists, resetting the tip of the | |
// document to the parent of the highest list, and finalizing | |
// all the lists. (This is used to implement the "two blank lines | |
// break out of all lists" feature.) | |
var breakOutOfLists = function breakOutOfLists(block) { | |
var b = block; | |
var last_list = null; | |
do { | |
if (b.type === 'List') { | |
last_list = b; | |
} | |
b = b._parent; | |
} while (b); | |
if (last_list) { | |
while (block !== last_list) { | |
this.finalize(block, this.lineNumber); | |
block = block._parent; | |
} | |
this.finalize(last_list, this.lineNumber); | |
this.tip = last_list._parent; | |
} | |
}; | |
// Add a line to the block at the tip. We assume the tip | |
// can accept lines -- that check should be done before calling this. | |
var addLine = function addLine() { | |
this.tip._string_content += this.currentLine.slice(this.offset) + '\n'; | |
}; | |
// Add block of type tag as a child of the tip. If the tip can't | |
// accept children, close and finalize it and try its parent, | |
// and so on til we find a block that can accept children. | |
var addChild = function addChild(tag, offset) { | |
while (!this.blocks[this.tip.type].canContain(tag)) { | |
this.finalize(this.tip, this.lineNumber - 1); | |
} | |
var column_number = offset + 1; // offset 0 = column 1 | |
var newBlock = new Node(tag, [[this.lineNumber, column_number], [0, 0]]); | |
newBlock._string_content = ''; | |
this.tip.appendChild(newBlock); | |
this.tip = newBlock; | |
return newBlock; | |
}; | |
// Parse a list marker and return data on the marker (type, | |
// start, delimiter, bullet character, padding) or null. | |
var parseListMarker = function parseListMarker(parser) { | |
var rest = parser.currentLine.slice(parser.nextNonspace); | |
var match; | |
var nextc; | |
var spacesStartCol; | |
var spacesStartOffset; | |
var data = { type: null, | |
tight: true, // lists are tight by default | |
bulletChar: null, | |
start: null, | |
delimiter: null, | |
padding: null, | |
markerOffset: parser.indent }; | |
if (match = rest.match(reBulletListMarker)) { | |
data.type = 'Bullet'; | |
data.bulletChar = match[0][0]; | |
} else if (match = rest.match(reOrderedListMarker)) { | |
data.type = 'Ordered'; | |
data.start = parseInt(match[1]); | |
data.delimiter = match[2]; | |
} else { | |
return null; | |
} | |
// make sure we have spaces after | |
nextc = peek(parser.currentLine, parser.nextNonspace + match[0].length); | |
if (!(nextc === -1 || nextc === C_TAB || nextc === C_SPACE)) { | |
return null; | |
} | |
// we've got a match! advance offset and calculate padding | |
parser.advanceNextNonspace(); // to start of marker | |
parser.advanceOffset(match[0].length, true); // to end of marker | |
spacesStartCol = parser.column; | |
spacesStartOffset = parser.offset; | |
do { | |
parser.advanceOffset(1, true); | |
nextc = peek(parser.currentLine, parser.offset); | |
} while (parser.column - spacesStartCol < 5 && (nextc === C_SPACE || nextc === C_TAB)); | |
var blank_item = peek(parser.currentLine, parser.offset) === -1; | |
var spaces_after_marker = parser.column - spacesStartCol; | |
if (spaces_after_marker >= 5 || spaces_after_marker < 1 || blank_item) { | |
data.padding = match[0].length + 1; | |
parser.column = spacesStartCol; | |
parser.offset = spacesStartOffset; | |
if (peek(parser.currentLine, parser.offset) === C_SPACE) { | |
parser.advanceOffset(1, true); | |
} | |
} else { | |
data.padding = match[0].length + spaces_after_marker; | |
} | |
return data; | |
}; | |
// Returns true if the two list items are of the same type, | |
// with the same delimiter and bullet character. This is used | |
// in agglomerating list items into lists. | |
var listsMatch = function listsMatch(list_data, item_data) { | |
return list_data.type === item_data.type && list_data.delimiter === item_data.delimiter && list_data.bulletChar === item_data.bulletChar; | |
}; | |
// Finalize and close any unmatched blocks. | |
var closeUnmatchedBlocks = function closeUnmatchedBlocks() { | |
if (!this.allClosed) { | |
// finalize any blocks not matched | |
while (this.oldtip !== this.lastMatchedContainer) { | |
var parent = this.oldtip._parent; | |
this.finalize(this.oldtip, this.lineNumber - 1); | |
this.oldtip = parent; | |
} | |
this.allClosed = true; | |
} | |
}; | |
// 'finalize' is run when the block is closed. | |
// 'continue' is run to check whether the block is continuing | |
// at a certain line and offset (e.g. whether a block quote | |
// contains a `>`. It returns 0 for matched, 1 for not matched, | |
// and 2 for "we've dealt with this line completely, go to next." | |
var blocks = { | |
Document: { | |
continue: function _continue() { | |
return 0; | |
}, | |
finalize: function finalize() { | |
return; | |
}, | |
canContain: function canContain(t) { | |
return t !== 'Item'; | |
}, | |
acceptsLines: false | |
}, | |
List: { | |
continue: function _continue() { | |
return 0; | |
}, | |
finalize: function finalize(parser, block) { | |
var item = block._firstChild; | |
while (item) { | |
// check for non-final list item ending with blank line: | |
if (endsWithBlankLine(item) && item._next) { | |
block._listData.tight = false; | |
break; | |
} | |
// recurse into children of list item, to see if there are | |
// spaces between any of them: | |
var subitem = item._firstChild; | |
while (subitem) { | |
if (endsWithBlankLine(subitem) && (item._next || subitem._next)) { | |
block._listData.tight = false; | |
break; | |
} | |
subitem = subitem._next; | |
} | |
item = item._next; | |
} | |
}, | |
canContain: function canContain(t) { | |
return t === 'Item'; | |
}, | |
acceptsLines: false | |
}, | |
BlockQuote: { | |
continue: function _continue(parser) { | |
var ln = parser.currentLine; | |
if (!parser.indented && peek(ln, parser.nextNonspace) === C_GREATERTHAN) { | |
parser.advanceNextNonspace(); | |
parser.advanceOffset(1, false); | |
if (peek(ln, parser.offset) === C_SPACE) { | |
parser.offset++; | |
} | |
} else { | |
return 1; | |
} | |
return 0; | |
}, | |
finalize: function finalize() { | |
return; | |
}, | |
canContain: function canContain(t) { | |
return t !== 'Item'; | |
}, | |
acceptsLines: false | |
}, | |
Item: { | |
continue: function _continue(parser, container) { | |
if (parser.blank && container._firstChild !== null) { | |
parser.advanceNextNonspace(); | |
} else if (parser.indent >= container._listData.markerOffset + container._listData.padding) { | |
parser.advanceOffset(container._listData.markerOffset + container._listData.padding, true); | |
} else { | |
return 1; | |
} | |
return 0; | |
}, | |
finalize: function finalize() { | |
return; | |
}, | |
canContain: function canContain(t) { | |
return t !== 'Item'; | |
}, | |
acceptsLines: false | |
}, | |
Heading: { | |
continue: function _continue() { | |
// a heading can never container > 1 line, so fail to match: | |
return 1; | |
}, | |
finalize: function finalize() { | |
return; | |
}, | |
canContain: function canContain() { | |
return false; | |
}, | |
acceptsLines: false | |
}, | |
ThematicBreak: { | |
continue: function _continue() { | |
// a thematic break can never container > 1 line, so fail to match: | |
return 1; | |
}, | |
finalize: function finalize() { | |
return; | |
}, | |
canContain: function canContain() { | |
return false; | |
}, | |
acceptsLines: false | |
}, | |
CodeBlock: { | |
continue: function _continue(parser, container) { | |
var ln = parser.currentLine; | |
var indent = parser.indent; | |
if (container._isFenced) { | |
// fenced | |
var match = indent <= 3 && ln.charAt(parser.nextNonspace) === container._fenceChar && ln.slice(parser.nextNonspace).match(reClosingCodeFence); | |
if (match && match[0].length >= container._fenceLength) { | |
// closing fence - we're at end of line, so we can return | |
parser.finalize(container, parser.lineNumber); | |
return 2; | |
} else { | |
// skip optional spaces of fence offset | |
var i = container._fenceOffset; | |
while (i > 0 && peek(ln, parser.offset) === C_SPACE) { | |
parser.advanceOffset(1, false); | |
i--; | |
} | |
} | |
} else { | |
// indented | |
if (indent >= CODE_INDENT) { | |
parser.advanceOffset(CODE_INDENT, true); | |
} else if (parser.blank) { | |
parser.advanceNextNonspace(); | |
} else { | |
return 1; | |
} | |
} | |
return 0; | |
}, | |
finalize: function finalize(parser, block) { | |
if (block._isFenced) { | |
// fenced | |
// first line becomes info string | |
var content = block._string_content; | |
var newlinePos = content.indexOf('\n'); | |
var firstLine = content.slice(0, newlinePos); | |
var rest = content.slice(newlinePos + 1); | |
block.info = unescapeString(firstLine.trim()); | |
block._literal = rest; | |
} else { | |
// indented | |
block._literal = block._string_content.replace(/(\n *)+$/, '\n'); | |
} | |
block._string_content = null; // allow GC | |
}, | |
canContain: function canContain() { | |
return false; | |
}, | |
acceptsLines: true | |
}, | |
HtmlBlock: { | |
continue: function _continue(parser, container) { | |
return parser.blank && (container._htmlBlockType === 6 || container._htmlBlockType === 7) ? 1 : 0; | |
}, | |
finalize: function finalize(parser, block) { | |
block._literal = block._string_content.replace(/(\n *)+$/, ''); | |
block._string_content = null; // allow GC | |
}, | |
canContain: function canContain() { | |
return false; | |
}, | |
acceptsLines: true | |
}, | |
Paragraph: { | |
continue: function _continue(parser) { | |
return parser.blank ? 1 : 0; | |
}, | |
finalize: function finalize(parser, block) { | |
var pos; | |
var hasReferenceDefs = false; | |
// try parsing the beginning as link reference definitions: | |
while (peek(block._string_content, 0) === C_OPEN_BRACKET && (pos = parser.inlineParser.parseReference(block._string_content, parser.refmap))) { | |
block._string_content = block._string_content.slice(pos); | |
hasReferenceDefs = true; | |
} | |
if (hasReferenceDefs && isBlank(block._string_content)) { | |
block.unlink(); | |
} | |
}, | |
canContain: function canContain() { | |
return false; | |
}, | |
acceptsLines: true | |
} | |
}; | |
// block start functions. Return values: | |
// 0 = no match | |
// 1 = matched container, keep going | |
// 2 = matched leaf, no more block starts | |
var blockStarts = [ | |
// block quote | |
function (parser) { | |
if (!parser.indented && peek(parser.currentLine, parser.nextNonspace) === C_GREATERTHAN) { | |
parser.advanceNextNonspace(); | |
parser.advanceOffset(1, false); | |
// optional following space | |
if (peek(parser.currentLine, parser.offset) === C_SPACE) { | |
parser.advanceOffset(1, false); | |
} | |
parser.closeUnmatchedBlocks(); | |
parser.addChild('BlockQuote', parser.nextNonspace); | |
return 1; | |
} else { | |
return 0; | |
} | |
}, | |
// ATX heading | |
function (parser) { | |
var match; | |
if (!parser.indented && (match = parser.currentLine.slice(parser.nextNonspace).match(reATXHeadingMarker))) { | |
parser.advanceNextNonspace(); | |
parser.advanceOffset(match[0].length, false); | |
parser.closeUnmatchedBlocks(); | |
var container = parser.addChild('Heading', parser.nextNonspace); | |
container.level = match[0].trim().length; // number of #s | |
// remove trailing ###s: | |
container._string_content = parser.currentLine.slice(parser.offset).replace(/^ *#+ *$/, '').replace(/ +#+ *$/, ''); | |
parser.advanceOffset(parser.currentLine.length - parser.offset); | |
return 2; | |
} else { | |
return 0; | |
} | |
}, | |
// Fenced code block | |
function (parser) { | |
var match; | |
if (!parser.indented && (match = parser.currentLine.slice(parser.nextNonspace).match(reCodeFence))) { | |
var fenceLength = match[0].length; | |
parser.closeUnmatchedBlocks(); | |
var container = parser.addChild('CodeBlock', parser.nextNonspace); | |
container._isFenced = true; | |
container._fenceLength = fenceLength; | |
container._fenceChar = match[0][0]; | |
container._fenceOffset = parser.indent; | |
parser.advanceNextNonspace(); | |
parser.advanceOffset(fenceLength, false); | |
return 2; | |
} else { | |
return 0; | |
} | |
}, | |
// HTML block | |
function (parser, container) { | |
if (!parser.indented && peek(parser.currentLine, parser.nextNonspace) === C_LESSTHAN) { | |
var s = parser.currentLine.slice(parser.nextNonspace); | |
var blockType; | |
for (blockType = 1; blockType <= 7; blockType++) { | |
if (reHtmlBlockOpen[blockType].test(s) && (blockType < 7 || container.type !== 'Paragraph')) { | |
parser.closeUnmatchedBlocks(); | |
// We don't adjust parser.offset; | |
// spaces are part of the HTML block: | |
var b = parser.addChild('HtmlBlock', parser.offset); | |
b._htmlBlockType = blockType; | |
return 2; | |
} | |
} | |
} | |
return 0; | |
}, | |
// Setext heading | |
function (parser, container) { | |
var match; | |
if (!parser.indented && container.type === 'Paragraph' && (match = parser.currentLine.slice(parser.nextNonspace).match(reSetextHeadingLine))) { | |
parser.closeUnmatchedBlocks(); | |
var heading = new Node('Heading', container.sourcepos); | |
heading.level = match[0][0] === '=' ? 1 : 2; | |
heading._string_content = container._string_content; | |
container.insertAfter(heading); | |
container.unlink(); | |
parser.tip = heading; | |
parser.advanceOffset(parser.currentLine.length - parser.offset, false); | |
return 2; | |
} else { | |
return 0; | |
} | |
}, | |
// thematic break | |
function (parser) { | |
if (!parser.indented && reThematicBreak.test(parser.currentLine.slice(parser.nextNonspace))) { | |
parser.closeUnmatchedBlocks(); | |
parser.addChild('ThematicBreak', parser.nextNonspace); | |
parser.advanceOffset(parser.currentLine.length - parser.offset, false); | |
return 2; | |
} else { | |
return 0; | |
} | |
}, | |
// list item | |
function (parser, container) { | |
var data; | |
if ((!parser.indented || container.type === 'List') && (data = parseListMarker(parser))) { | |
parser.closeUnmatchedBlocks(); | |
// add the list if needed | |
if (parser.tip.type !== 'List' || !listsMatch(container._listData, data)) { | |
container = parser.addChild('List', parser.nextNonspace); | |
container._listData = data; | |
} | |
// add the list item | |
container = parser.addChild('Item', parser.nextNonspace); | |
container._listData = data; | |
return 1; | |
} else { | |
return 0; | |
} | |
}, | |
// indented code block | |
function (parser) { | |
if (parser.indented && parser.tip.type !== 'Paragraph' && !parser.blank) { | |
// indented code | |
parser.advanceOffset(CODE_INDENT, true); | |
parser.closeUnmatchedBlocks(); | |
parser.addChild('CodeBlock', parser.offset); | |
return 2; | |
} else { | |
return 0; | |
} | |
}]; | |
var advanceOffset = function advanceOffset(count, columns) { | |
var cols = 0; | |
var currentLine = this.currentLine; | |
var charsToTab; | |
var c; | |
while (count > 0 && (c = currentLine[this.offset])) { | |
if (c === '\t') { | |
charsToTab = 4 - this.column % 4; | |
this.column += charsToTab; | |
this.offset += 1; | |
count -= columns ? charsToTab : 1; | |
} else { | |
cols += 1; | |
this.offset += 1; | |
this.column += 1; // assume ascii; block starts are ascii | |
count -= 1; | |
} | |
} | |
}; | |
var advanceNextNonspace = function advanceNextNonspace() { | |
this.offset = this.nextNonspace; | |
this.column = this.nextNonspaceColumn; | |
}; | |
var findNextNonspace = function findNextNonspace() { | |
var currentLine = this.currentLine; | |
var i = this.offset; | |
var cols = this.column; | |
var c; | |
while ((c = currentLine.charAt(i)) !== '') { | |
if (c === ' ') { | |
i++; | |
cols++; | |
} else if (c === '\t') { | |
i++; | |
cols += 4 - cols % 4; | |
} else { | |
break; | |
} | |
} | |
this.blank = c === '\n' || c === '\r' || c === ''; | |
this.nextNonspace = i; | |
this.nextNonspaceColumn = cols; | |
this.indent = this.nextNonspaceColumn - this.column; | |
this.indented = this.indent >= CODE_INDENT; | |
}; | |
// Analyze a line of text and update the document appropriately. | |
// We parse markdown text by calling this on each line of input, | |
// then finalizing the document. | |
var incorporateLine = function incorporateLine(ln) { | |
var all_matched = true; | |
var t; | |
var container = this.doc; | |
this.oldtip = this.tip; | |
this.offset = 0; | |
this.column = 0; | |
this.lineNumber += 1; | |
// replace NUL characters for security | |
if (ln.indexOf('\0') !== -1) { | |
ln = ln.replace(/\0/g, '\uFFFD'); | |
} | |
this.currentLine = ln; | |
// For each containing block, try to parse the associated line start. | |
// Bail out on failure: container will point to the last matching block. | |
// Set all_matched to false if not all containers match. | |
var lastChild; | |
while ((lastChild = container._lastChild) && lastChild._open) { | |
container = lastChild; | |
this.findNextNonspace(); | |
switch (this.blocks[container.type].continue(this, container)) { | |
case 0: | |
// we've matched, keep going | |
break; | |
case 1: | |
// we've failed to match a block | |
all_matched = false; | |
break; | |
case 2: | |
// we've hit end of line for fenced code close and can return | |
this.lastLineLength = ln.length; | |
return; | |
default: | |
throw 'continue returned illegal value, must be 0, 1, or 2'; | |
} | |
if (!all_matched) { | |
container = container._parent; // back up to last matching block | |
break; | |
} | |
} | |
this.allClosed = container === this.oldtip; | |
this.lastMatchedContainer = container; | |
// Check to see if we've hit 2nd blank line; if so break out of list: | |
if (this.blank && container._lastLineBlank) { | |
this.breakOutOfLists(container); | |
container = this.tip; | |
} | |
var matchedLeaf = container.type !== 'Paragraph' && blocks[container.type].acceptsLines; | |
var starts = this.blockStarts; | |
var startsLen = starts.length; | |
// Unless last matched container is a code block, try new container starts, | |
// adding children to the last matched container: | |
while (!matchedLeaf) { | |
this.findNextNonspace(); | |
// this is a little performance optimization: | |
if (!this.indented && !reMaybeSpecial.test(ln.slice(this.nextNonspace))) { | |
this.advanceNextNonspace(); | |
break; | |
} | |
var i = 0; | |
while (i < startsLen) { | |
var res = starts[i](this, container); | |
if (res === 1) { | |
container = this.tip; | |
break; | |
} else if (res === 2) { | |
container = this.tip; | |
matchedLeaf = true; | |
break; | |
} else { | |
i++; | |
} | |
} | |
if (i === startsLen) { | |
// nothing matched | |
this.advanceNextNonspace(); | |
break; | |
} | |
} | |
// What remains at the offset is a text line. Add the text to the | |
// appropriate container. | |
// First check for a lazy paragraph continuation: | |
if (!this.allClosed && !this.blank && this.tip.type === 'Paragraph') { | |
// lazy paragraph continuation | |
this.addLine(); | |
} else { | |
// not a lazy continuation | |
// finalize any blocks not matched | |
this.closeUnmatchedBlocks(); | |
if (this.blank && container.lastChild) { | |
container.lastChild._lastLineBlank = true; | |
} | |
t = container.type; | |
// Block quote lines are never blank as they start with > | |
// and we don't count blanks in fenced code for purposes of tight/loose | |
// lists or breaking out of lists. We also don't set _lastLineBlank | |
// on an empty list item, or if we just closed a fenced block. | |
var lastLineBlank = this.blank && !(t === 'BlockQuote' || t === 'CodeBlock' && container._isFenced || t === 'Item' && !container._firstChild && container.sourcepos[0][0] === this.lineNumber); | |
// propagate lastLineBlank up through parents: | |
var cont = container; | |
while (cont) { | |
cont._lastLineBlank = lastLineBlank; | |
cont = cont._parent; | |
} | |
if (this.blocks[t].acceptsLines) { | |
this.addLine(); | |
// if HtmlBlock, check for end condition | |
if (t === 'HtmlBlock' && container._htmlBlockType >= 1 && container._htmlBlockType <= 5 && reHtmlBlockClose[container._htmlBlockType].test(this.currentLine.slice(this.offset))) { | |
this.finalize(container, this.lineNumber); | |
} | |
} else if (this.offset < ln.length && !this.blank) { | |
// create paragraph container for line | |
container = this.addChild('Paragraph', this.offset); | |
this.advanceNextNonspace(); | |
this.addLine(); | |
} | |
} | |
this.lastLineLength = ln.length; | |
}; | |
// Finalize a block. Close it and do any necessary postprocessing, | |
// e.g. creating string_content from strings, setting the 'tight' | |
// or 'loose' status of a list, and parsing the beginnings | |
// of paragraphs for reference definitions. Reset the tip to the | |
// parent of the closed block. | |
var finalize = function finalize(block, lineNumber) { | |
var above = block._parent; | |
block._open = false; | |
block.sourcepos[1] = [lineNumber, this.lastLineLength]; | |
this.blocks[block.type].finalize(this, block); | |
this.tip = above; | |
}; | |
// Walk through a block & children recursively, parsing string content | |
// into inline content where appropriate. | |
var processInlines = function processInlines(block) { | |
var node, event, t; | |
var walker = block.walker(); | |
this.inlineParser.refmap = this.refmap; | |
this.inlineParser.options = this.options; | |
while (event = walker.next()) { | |
node = event.node; | |
t = node.type; | |
if (!event.entering && (t === 'Paragraph' || t === 'Heading')) { | |
this.inlineParser.parse(node); | |
} | |
} | |
}; | |
var Document = function Document() { | |
var doc = new Node('Document', [[1, 1], [0, 0]]); | |
return doc; | |
}; | |
// The main parsing function. Returns a parsed document AST. | |
var parse = function parse(input) { | |
this.doc = new Document(); | |
this.tip = this.doc; | |
this.refmap = {}; | |
this.lineNumber = 0; | |
this.lastLineLength = 0; | |
this.offset = 0; | |
this.column = 0; | |
this.lastMatchedContainer = this.doc; | |
this.currentLine = ""; | |
if (this.options.time) { | |
console.time("preparing input"); | |
} | |
var lines = input.split(reLineEnding); | |
var len = lines.length; | |
if (input.charCodeAt(input.length - 1) === C_NEWLINE) { | |
// ignore last blank line created by final newline | |
len -= 1; | |
} | |
if (this.options.time) { | |
console.timeEnd("preparing input"); | |
} | |
if (this.options.time) { | |
console.time("block parsing"); | |
} | |
for (var i = 0; i < len; i++) { | |
this.incorporateLine(lines[i]); | |
} | |
while (this.tip) { | |
this.finalize(this.tip, len); | |
} | |
if (this.options.time) { | |
console.timeEnd("block parsing"); | |
} | |
if (this.options.time) { | |
console.time("inline parsing"); | |
} | |
this.processInlines(this.doc); | |
if (this.options.time) { | |
console.timeEnd("inline parsing"); | |
} | |
return this.doc; | |
}; | |
// The Parser object. | |
function Parser(options) { | |
return { | |
doc: new Document(), | |
blocks: blocks, | |
blockStarts: blockStarts, | |
tip: this.doc, | |
oldtip: this.doc, | |
currentLine: "", | |
lineNumber: 0, | |
offset: 0, | |
column: 0, | |
nextNonspace: 0, | |
nextNonspaceColumn: 0, | |
indent: 0, | |
indented: false, | |
blank: false, | |
allClosed: true, | |
lastMatchedContainer: this.doc, | |
refmap: {}, | |
lastLineLength: 0, | |
inlineParser: new InlineParser(options), | |
findNextNonspace: findNextNonspace, | |
advanceOffset: advanceOffset, | |
advanceNextNonspace: advanceNextNonspace, | |
breakOutOfLists: breakOutOfLists, | |
addLine: addLine, | |
addChild: addChild, | |
incorporateLine: incorporateLine, | |
finalize: finalize, | |
processInlines: processInlines, | |
closeUnmatchedBlocks: closeUnmatchedBlocks, | |
parse: parse, | |
options: options || {} | |
}; | |
} | |
module.exports = Parser; | |
/***/ }), | |
/* 95 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
"use strict"; | |
// derived from https://github.com/mathiasbynens/String.fromCodePoint | |
/*! http://mths.be/fromcodepoint v0.2.1 by @mathias */ | |
if (String.fromCodePoint) { | |
module.exports = function (_) { | |
try { | |
return String.fromCodePoint(_); | |
} catch (e) { | |
if (e instanceof RangeError) { | |
return String.fromCharCode(0xFFFD); | |
} | |
throw e; | |
} | |
}; | |
} else { | |
var stringFromCharCode = String.fromCharCode; | |
var floor = Math.floor; | |
var fromCodePoint = function fromCodePoint() { | |
var MAX_SIZE = 0x4000; | |
var codeUnits = []; | |
var highSurrogate; | |
var lowSurrogate; | |
var index = -1; | |
var length = arguments.length; | |
if (!length) { | |
return ''; | |
} | |
var result = ''; | |
while (++index < length) { | |
var codePoint = Number(arguments[index]); | |
if (!isFinite(codePoint) || // `NaN`, `+Infinity`, or `-Infinity` | |
codePoint < 0 || // not a valid Unicode code point | |
codePoint > 0x10FFFF || // not a valid Unicode code point | |
floor(codePoint) !== codePoint // not an integer | |
) { | |
return String.fromCharCode(0xFFFD); | |
} | |
if (codePoint <= 0xFFFF) { | |
// BMP code point | |
codeUnits.push(codePoint); | |
} else { | |
// Astral code point; split in surrogate halves | |
// http://mathiasbynens.be/notes/javascript-encoding#surrogate-formulae | |
codePoint -= 0x10000; | |
highSurrogate = (codePoint >> 10) + 0xD800; | |
lowSurrogate = codePoint % 0x400 + 0xDC00; | |
codeUnits.push(highSurrogate, lowSurrogate); | |
} | |
if (index + 1 === length || codeUnits.length > MAX_SIZE) { | |
result += stringFromCharCode.apply(null, codeUnits); | |
codeUnits.length = 0; | |
} | |
} | |
return result; | |
}; | |
module.exports = fromCodePoint; | |
} | |
/***/ }), | |
/* 96 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
"use strict"; | |
var escapeXml = __webpack_require__(17).escapeXml; | |
// Helper function to produce an HTML tag. | |
var tag = function tag(name, attrs, selfclosing) { | |
var result = '<' + name; | |
if (attrs && attrs.length > 0) { | |
var i = 0; | |
var attrib; | |
while ((attrib = attrs[i]) !== undefined) { | |
result += ' ' + attrib[0] + '="' + attrib[1] + '"'; | |
i++; | |
} | |
} | |
if (selfclosing) { | |
result += ' /'; | |
} | |
result += '>'; | |
return result; | |
}; | |
var reHtmlTag = /\<[^>]*\>/; | |
var reUnsafeProtocol = /^javascript:|vbscript:|file:|data:/i; | |
var reSafeDataProtocol = /^data:image\/(?:png|gif|jpeg|webp)/i; | |
var potentiallyUnsafe = function potentiallyUnsafe(url) { | |
return reUnsafeProtocol.test(url) && !reSafeDataProtocol.test(url); | |
}; | |
var renderNodes = function renderNodes(block) { | |
var attrs; | |
var info_words; | |
var tagname; | |
var walker = block.walker(); | |
var event, node, entering; | |
var buffer = ""; | |
var lastOut = "\n"; | |
var disableTags = 0; | |
var grandparent; | |
var out = function out(s) { | |
if (disableTags > 0) { | |
buffer += s.replace(reHtmlTag, ''); | |
} else { | |
buffer += s; | |
} | |
lastOut = s; | |
}; | |
var esc = this.escape; | |
var cr = function cr() { | |
if (lastOut !== '\n') { | |
buffer += '\n'; | |
lastOut = '\n'; | |
} | |
}; | |
var options = this.options; | |
if (options.time) { | |
console.time("rendering"); | |
} | |
while (event = walker.next()) { | |
entering = event.entering; | |
node = event.node; | |
attrs = []; | |
if (options.sourcepos) { | |
var pos = node.sourcepos; | |
if (pos) { | |
attrs.push(['data-sourcepos', String(pos[0][0]) + ':' + String(pos[0][1]) + '-' + String(pos[1][0]) + ':' + String(pos[1][1])]); | |
} | |
} | |
switch (node.type) { | |
case 'Text': | |
out(esc(node.literal, false)); | |
break; | |
case 'Softbreak': | |
out(this.softbreak); | |
break; | |
case 'Hardbreak': | |
out(tag('br', [], true)); | |
cr(); | |
break; | |
case 'Emph': | |
out(tag(entering ? 'em' : '/em')); | |
break; | |
case 'Strong': | |
out(tag(entering ? 'strong' : '/strong')); | |
break; | |
case 'HtmlInline': | |
if (options.safe) { | |
out('<!-- raw HTML omitted -->'); | |
} else { | |
out(node.literal); | |
} | |
break; | |
case 'CustomInline': | |
if (entering && node.onEnter) { | |
out(node.onEnter); | |
} else if (!entering && node.onExit) { | |
out(node.onExit); | |
} | |
break; | |
case 'Link': | |
if (entering) { | |
if (!(options.safe && potentiallyUnsafe(node.destination))) { | |
attrs.push(['href', esc(node.destination, true)]); | |
} | |
if (node.title) { | |
attrs.push(['title', esc(node.title, true)]); | |
} | |
out(tag('a', attrs)); | |
} else { | |
out(tag('/a')); | |
} | |
break; | |
case 'Image': | |
if (entering) { | |
if (disableTags === 0) { | |
if (options.safe && potentiallyUnsafe(node.destination)) { | |
out('<img src="" alt="'); | |
} else { | |
out('<img src="' + esc(node.destination, true) + '" alt="'); | |
} | |
} | |
disableTags += 1; | |
} else { | |
disableTags -= 1; | |
if (disableTags === 0) { | |
if (node.title) { | |
out('" title="' + esc(node.title, true)); | |
} | |
out('" />'); | |
} | |
} | |
break; | |
case 'Code': | |
out(tag('code') + esc(node.literal, false) + tag('/code')); | |
break; | |
case 'Document': | |
break; | |
case 'Paragraph': | |
grandparent = node.parent.parent; | |
if (grandparent !== null && grandparent.type === 'List') { | |
if (grandparent.listTight) { | |
break; | |
} | |
} | |
if (entering) { | |
cr(); | |
out(tag('p', attrs)); | |
} else { | |
out(tag('/p')); | |
cr(); | |
} | |
break; | |
case 'BlockQuote': | |
if (entering) { | |
cr(); | |
out(tag('blockquote', attrs)); | |
cr(); | |
} else { | |
cr(); | |
out(tag('/blockquote')); | |
cr(); | |
} | |
break; | |
case 'Item': | |
if (entering) { | |
out(tag('li', attrs)); | |
} else { | |
out(tag('/li')); | |
cr(); | |
} | |
break; | |
case 'List': | |
tagname = node.listType === 'Bullet' ? 'ul' : 'ol'; | |
if (entering) { | |
var start = node.listStart; | |
if (start !== null && start !== 1) { | |
attrs.push(['start', start.toString()]); | |
} | |
cr(); | |
out(tag(tagname, attrs)); | |
cr(); | |
} else { | |
cr(); | |
out(tag('/' + tagname)); | |
cr(); | |
} | |
break; | |
case 'Heading': | |
tagname = 'h' + node.level; | |
if (entering) { | |
cr(); | |
out(tag(tagname, attrs)); | |
} else { | |
out(tag('/' + tagname)); | |
cr(); | |
} | |
break; | |
case 'CodeBlock': | |
info_words = node.info ? node.info.split(/\s+/) : []; | |
if (info_words.length > 0 && info_words[0].length > 0) { | |
attrs.push(['class', 'language-' + esc(info_words[0], true)]); | |
} | |
cr(); | |
out(tag('pre') + tag('code', attrs)); | |
out(esc(node.literal, false)); | |
out(tag('/code') + tag('/pre')); | |
cr(); | |
break; | |
case 'HtmlBlock': | |
cr(); | |
if (options.safe) { | |
out('<!-- raw HTML omitted -->'); | |
} else { | |
out(node.literal); | |
} | |
cr(); | |
break; | |
case 'CustomBlock': | |
cr(); | |
if (entering && node.onEnter) { | |
out(node.onEnter); | |
} else if (!entering && node.onExit) { | |
out(node.onExit); | |
} | |
cr(); | |
break; | |
case 'ThematicBreak': | |
cr(); | |
out(tag('hr', attrs, true)); | |
cr(); | |
break; | |
default: | |
throw "Unknown node type " + node.type; | |
} | |
} | |
if (options.time) { | |
console.timeEnd("rendering"); | |
} | |
return buffer; | |
}; | |
// The HtmlRenderer object. | |
function HtmlRenderer(options) { | |
return { | |
// default options: | |
softbreak: '\n', // by default, soft breaks are rendered as newlines in HTML | |
// set to "<br />" to make them hard breaks | |
// set to " " if you want to ignore line wrapping in source | |
escape: escapeXml, | |
options: options || {}, | |
render: renderNodes | |
}; | |
} | |
module.exports = HtmlRenderer; | |
/***/ }), | |
/* 97 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
"use strict"; | |
// commonmark.js - CommomMark in JavaScript | |
// Copyright (C) 2014 John MacFarlane | |
// License: BSD3. | |
// Basic usage: | |
// | |
// var commonmark = require('commonmark'); | |
// var parser = new commonmark.Parser(); | |
// var renderer = new commonmark.HtmlRenderer(); | |
// console.log(renderer.render(parser.parse('Hello *world*'))); | |
module.exports.version = '0.24.0'; | |
module.exports.Node = __webpack_require__(36); | |
module.exports.Parser = __webpack_require__(94); | |
module.exports.HtmlRenderer = __webpack_require__(96); | |
module.exports.XmlRenderer = __webpack_require__(100); | |
/***/ }), | |
/* 98 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
"use strict"; | |
var Node = __webpack_require__(36); | |
var common = __webpack_require__(17); | |
var normalizeReference = __webpack_require__(99); | |
var normalizeURI = common.normalizeURI; | |
var unescapeString = common.unescapeString; | |
var fromCodePoint = __webpack_require__(95); | |
var decodeHTML = __webpack_require__(56).decodeHTML; | |
__webpack_require__(393); // Polyfill for String.prototype.repeat | |
// Constants for character codes: | |
var C_NEWLINE = 10; | |
var C_ASTERISK = 42; | |
var C_UNDERSCORE = 95; | |
var C_BACKTICK = 96; | |
var C_OPEN_BRACKET = 91; | |
var C_CLOSE_BRACKET = 93; | |
var C_LESSTHAN = 60; | |
var C_BANG = 33; | |
var C_BACKSLASH = 92; | |
var C_AMPERSAND = 38; | |
var C_OPEN_PAREN = 40; | |
var C_CLOSE_PAREN = 41; | |
var C_COLON = 58; | |
var C_SINGLEQUOTE = 39; | |
var C_DOUBLEQUOTE = 34; | |
// Some regexps used in inline parser: | |
var ESCAPABLE = common.ESCAPABLE; | |
var ESCAPED_CHAR = '\\\\' + ESCAPABLE; | |
var REG_CHAR = '[^\\\\()\\x00-\\x20]'; | |
var IN_PARENS_NOSP = '\\((' + REG_CHAR + '|' + ESCAPED_CHAR + '|\\\\)*\\)'; | |
var ENTITY = common.ENTITY; | |
var reHtmlTag = common.reHtmlTag; | |
var rePunctuation = new RegExp(/^[\u2000-\u206F\u2E00-\u2E7F\\'!"#\$%&\(\)\*\+,\-\.\/:;<=>\?@\[\]\^_`\{\|\}~]/); | |
var reLinkTitle = new RegExp('^(?:"(' + ESCAPED_CHAR + '|[^"\\x00])*"' + '|' + '\'(' + ESCAPED_CHAR + '|[^\'\\x00])*\'' + '|' + '\\((' + ESCAPED_CHAR + '|[^)\\x00])*\\))'); | |
var reLinkDestinationBraces = new RegExp('^(?:[<](?:[^ <>\\t\\n\\\\\\x00]' + '|' + ESCAPED_CHAR + '|' + '\\\\)*[>])'); | |
var reLinkDestination = new RegExp('^(?:' + REG_CHAR + '+|' + ESCAPED_CHAR + '|\\\\|' + IN_PARENS_NOSP + ')*'); | |
var reEscapable = new RegExp('^' + ESCAPABLE); | |
var reEntityHere = new RegExp('^' + ENTITY, 'i'); | |
var reTicks = /`+/; | |
var reTicksHere = /^`+/; | |
var reEllipses = /\.\.\./g; | |
var reDash = /--+/g; | |
var reEmailAutolink = /^<([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])?)*)>/; | |
var reAutolink = /^<[A-Za-z][A-Za-z0-9.+-]{1,31}:[^<>\x00-\x20]*>/i; | |
var reSpnl = /^ *(?:\n *)?/; | |
var reWhitespaceChar = /^\s/; | |
var reWhitespace = /\s+/g; | |
var reFinalSpace = / *$/; | |
var reInitialSpace = /^ */; | |
var reSpaceAtEndOfLine = /^ *(?:\n|$)/; | |
var reLinkLabel = new RegExp('^\\[(?:[^\\\\\\[\\]]|' + ESCAPED_CHAR + '|\\\\){0,1000}\\]'); | |
// Matches a string of non-special characters. | |
var reMain = /^[^\n`\[\]\\!<&*_'"]+/m; | |
var text = function text(s) { | |
var node = new Node('Text'); | |
node._literal = s; | |
return node; | |
}; | |
// INLINE PARSER | |
// These are methods of an InlineParser object, defined below. | |
// An InlineParser keeps track of a subject (a string to be | |
// parsed) and a position in that subject. | |
// If re matches at current position in the subject, advance | |
// position in subject and return the match; otherwise return null. | |
var match = function match(re) { | |
var m = re.exec(this.subject.slice(this.pos)); | |
if (m === null) { | |
return null; | |
} else { | |
this.pos += m.index + m[0].length; | |
return m[0]; | |
} | |
}; | |
// Returns the code for the character at the current subject position, or -1 | |
// there are no more characters. | |
var peek = function peek() { | |
if (this.pos < this.subject.length) { | |
return this.subject.charCodeAt(this.pos); | |
} else { | |
return -1; | |
} | |
}; | |
// Parse zero or more space characters, including at most one newline | |
var spnl = function spnl() { | |
this.match(reSpnl); | |
return true; | |
}; | |
// All of the parsers below try to match something at the current position | |
// in the subject. If they succeed in matching anything, they | |
// return the inline matched, advancing the subject. | |
// Attempt to parse backticks, adding either a backtick code span or a | |
// literal sequence of backticks. | |
var parseBackticks = function parseBackticks(block) { | |
var ticks = this.match(reTicksHere); | |
if (ticks === null) { | |
return false; | |
} | |
var afterOpenTicks = this.pos; | |
var matched; | |
var node; | |
while ((matched = this.match(reTicks)) !== null) { | |
if (matched === ticks) { | |
node = new Node('Code'); | |
node._literal = this.subject.slice(afterOpenTicks, this.pos - ticks.length).trim().replace(reWhitespace, ' '); | |
block.appendChild(node); | |
return true; | |
} | |
} | |
// If we got here, we didn't match a closing backtick sequence. | |
this.pos = afterOpenTicks; | |
block.appendChild(text(ticks)); | |
return true; | |
}; | |
// Parse a backslash-escaped special character, adding either the escaped | |
// character, a hard line break (if the backslash is followed by a newline), | |
// or a literal backslash to the block's children. Assumes current character | |
// is a backslash. | |
var parseBackslash = function parseBackslash(block) { | |
var subj = this.subject; | |
var node; | |
this.pos += 1; | |
if (this.peek() === C_NEWLINE) { | |
this.pos += 1; | |
node = new Node('Hardbreak'); | |
block.appendChild(node); | |
} else if (reEscapable.test(subj.charAt(this.pos))) { | |
block.appendChild(text(subj.charAt(this.pos))); | |
this.pos += 1; | |
} else { | |
block.appendChild(text('\\')); | |
} | |
return true; | |
}; | |
// Attempt to parse an autolink (URL or email in pointy brackets). | |
var parseAutolink = function parseAutolink(block) { | |
var m; | |
var dest; | |
var node; | |
if (m = this.match(reEmailAutolink)) { | |
dest = m.slice(1, m.length - 1); | |
node = new Node('Link'); | |
node._destination = normalizeURI('mailto:' + dest); | |
node._title = ''; | |
node.appendChild(text(dest)); | |
block.appendChild(node); | |
return true; | |
} else if (m = this.match(reAutolink)) { | |
dest = m.slice(1, m.length - 1); | |
node = new Node('Link'); | |
node._destination = normalizeURI(dest); | |
node._title = ''; | |
node.appendChild(text(dest)); | |
block.appendChild(node); | |
return true; | |
} else { | |
return false; | |
} | |
}; | |
// Attempt to parse a raw HTML tag. | |
var parseHtmlTag = function parseHtmlTag(block) { | |
var m = this.match(reHtmlTag); | |
if (m === null) { | |
return false; | |
} else { | |
var node = new Node('HtmlInline'); | |
node._literal = m; | |
block.appendChild(node); | |
return true; | |
} | |
}; | |
// Scan a sequence of characters with code cc, and return information about | |
// the number of delimiters and whether they are positioned such that | |
// they can open and/or close emphasis or strong emphasis. A utility | |
// function for strong/emph parsing. | |
var scanDelims = function scanDelims(cc) { | |
var numdelims = 0; | |
var char_before, char_after, cc_after; | |
var startpos = this.pos; | |
var left_flanking, right_flanking, can_open, can_close; | |
var after_is_whitespace, after_is_punctuation, before_is_whitespace, before_is_punctuation; | |
if (cc === C_SINGLEQUOTE || cc === C_DOUBLEQUOTE) { | |
numdelims++; | |
this.pos++; | |
} else { | |
while (this.peek() === cc) { | |
numdelims++; | |
this.pos++; | |
} | |
} | |
if (numdelims === 0) { | |
return null; | |
} | |
char_before = startpos === 0 ? '\n' : this.subject.charAt(startpos - 1); | |
cc_after = this.peek(); | |
if (cc_after === -1) { | |
char_after = '\n'; | |
} else { | |
char_after = fromCodePoint(cc_after); | |
} | |
after_is_whitespace = reWhitespaceChar.test(char_after); | |
after_is_punctuation = rePunctuation.test(char_after); | |
before_is_whitespace = reWhitespaceChar.test(char_before); | |
before_is_punctuation = rePunctuation.test(char_before); | |
left_flanking = !after_is_whitespace && !(after_is_punctuation && !before_is_whitespace && !before_is_punctuation); | |
right_flanking = !before_is_whitespace && !(before_is_punctuation && !after_is_whitespace && !after_is_punctuation); | |
if (cc === C_UNDERSCORE) { | |
can_open = left_flanking && (!right_flanking || before_is_punctuation); | |
can_close = right_flanking && (!left_flanking || after_is_punctuation); | |
} else if (cc === C_SINGLEQUOTE || cc === C_DOUBLEQUOTE) { | |
can_open = left_flanking && !right_flanking; | |
can_close = right_flanking; | |
} else { | |
can_open = left_flanking; | |
can_close = right_flanking; | |
} | |
this.pos = startpos; | |
return { numdelims: numdelims, | |
can_open: can_open, | |
can_close: can_close }; | |
}; | |
// Handle a delimiter marker for emphasis or a quote. | |
var handleDelim = function handleDelim(cc, block) { | |
var res = this.scanDelims(cc); | |
if (!res) { | |
return false; | |
} | |
var numdelims = res.numdelims; | |
var startpos = this.pos; | |
var contents; | |
this.pos += numdelims; | |
if (cc === C_SINGLEQUOTE) { | |
contents = '\u2019'; | |
} else if (cc === C_DOUBLEQUOTE) { | |
contents = '\u201C'; | |
} else { | |
contents = this.subject.slice(startpos, this.pos); | |
} | |
var node = text(contents); | |
block.appendChild(node); | |
// Add entry to stack for this opener | |
this.delimiters = { cc: cc, | |
numdelims: numdelims, | |
node: node, | |
previous: this.delimiters, | |
next: null, | |
can_open: res.can_open, | |
can_close: res.can_close, | |
active: true }; | |
if (this.delimiters.previous !== null) { | |
this.delimiters.previous.next = this.delimiters; | |
} | |
return true; | |
}; | |
var removeDelimiter = function removeDelimiter(delim) { | |
if (delim.previous !== null) { | |
delim.previous.next = delim.next; | |
} | |
if (delim.next === null) { | |
// top of stack | |
this.delimiters = delim.previous; | |
} else { | |
delim.next.previous = delim.previous; | |
} | |
}; | |
var removeDelimitersBetween = function removeDelimitersBetween(bottom, top) { | |
if (bottom.next !== top) { | |
bottom.next = top; | |
top.previous = bottom; | |
} | |
}; | |
var processEmphasis = function processEmphasis(stack_bottom) { | |
var opener, closer, old_closer; | |
var opener_inl, closer_inl; | |
var tempstack; | |
var use_delims; | |
var tmp, next; | |
var opener_found; | |
var openers_bottom = []; | |
openers_bottom[C_UNDERSCORE] = stack_bottom; | |
openers_bottom[C_ASTERISK] = stack_bottom; | |
openers_bottom[C_SINGLEQUOTE] = stack_bottom; | |
openers_bottom[C_DOUBLEQUOTE] = stack_bottom; | |
// find first closer above stack_bottom: | |
closer = this.delimiters; | |
while (closer !== null && closer.previous !== stack_bottom) { | |
closer = closer.previous; | |
} | |
// move forward, looking for closers, and handling each | |
while (closer !== null) { | |
var closercc = closer.cc; | |
if (!(closer.can_close && (closercc === C_UNDERSCORE || closercc === C_ASTERISK || closercc === C_SINGLEQUOTE || closercc === C_DOUBLEQUOTE))) { | |
closer = closer.next; | |
} else { | |
// found emphasis closer. now look back for first matching opener: | |
opener = closer.previous; | |
opener_found = false; | |
while (opener !== null && opener !== stack_bottom && opener !== openers_bottom[closercc]) { | |
if (opener.cc === closer.cc && opener.can_open) { | |
opener_found = true; | |
break; | |
} | |
opener = opener.previous; | |
} | |
old_closer = closer; | |
if (closercc === C_ASTERISK || closercc === C_UNDERSCORE) { | |
if (!opener_found) { | |
closer = closer.next; | |
} else { | |
// calculate actual number of delimiters used from closer | |
if (closer.numdelims < 3 || opener.numdelims < 3) { | |
use_delims = closer.numdelims <= opener.numdelims ? closer.numdelims : opener.numdelims; | |
} else { | |
use_delims = closer.numdelims % 2 === 0 ? 2 : 1; | |
} | |
opener_inl = opener.node; | |
closer_inl = closer.node; | |
// remove used delimiters from stack elts and inlines | |
opener.numdelims -= use_delims; | |
closer.numdelims -= use_delims; | |
opener_inl._literal = opener_inl._literal.slice(0, opener_inl._literal.length - use_delims); | |
closer_inl._literal = closer_inl._literal.slice(0, closer_inl._literal.length - use_delims); | |
// build contents for new emph element | |
var emph = new Node(use_delims === 1 ? 'Emph' : 'Strong'); | |
tmp = opener_inl._next; | |
while (tmp && tmp !== closer_inl) { | |
next = tmp._next; | |
tmp.unlink(); | |
emph.appendChild(tmp); | |
tmp = next; | |
} | |
opener_inl.insertAfter(emph); | |
// remove elts between opener and closer in delimiters stack | |
removeDelimitersBetween(opener, closer); | |
// if opener has 0 delims, remove it and the inline | |
if (opener.numdelims === 0) { | |
opener_inl.unlink(); | |
this.removeDelimiter(opener); | |
} | |
if (closer.numdelims === 0) { | |
closer_inl.unlink(); | |
tempstack = closer.next; | |
this.removeDelimiter(closer); | |
closer = tempstack; | |
} | |
} | |
} else if (closercc === C_SINGLEQUOTE) { | |
closer.node._literal = '\u2019'; | |
if (opener_found) { | |
opener.node._literal = '\u2018'; | |
} | |
closer = closer.next; | |
} else if (closercc === C_DOUBLEQUOTE) { | |
closer.node._literal = '\u201D'; | |
if (opener_found) { | |
opener.node.literal = '\u201C'; | |
} | |
closer = closer.next; | |
} | |
if (!opener_found) { | |
// Set lower bound for future searches for openers: | |
openers_bottom[closercc] = old_closer.previous; | |
if (!old_closer.can_open) { | |
// We can remove a closer that can't be an opener, | |
// once we've seen there's no matching opener: | |
this.removeDelimiter(old_closer); | |
} | |
} | |
} | |
} | |
// remove all delimiters | |
while (this.delimiters !== null && this.delimiters !== stack_bottom) { | |
this.removeDelimiter(this.delimiters); | |
} | |
}; | |
// Attempt to parse link title (sans quotes), returning the string | |
// or null if no match. | |
var parseLinkTitle = function parseLinkTitle() { | |
var title = this.match(reLinkTitle); | |
if (title === null) { | |
return null; | |
} else { | |
// chop off quotes from title and unescape: | |
return unescapeString(title.substr(1, title.length - 2)); | |
} | |
}; | |
// Attempt to parse link destination, returning the string or | |
// null if no match. | |
var parseLinkDestination = function parseLinkDestination() { | |
var res = this.match(reLinkDestinationBraces); | |
if (res === null) { | |
res = this.match(reLinkDestination); | |
if (res === null) { | |
return null; | |
} else { | |
return normalizeURI(unescapeString(res)); | |
} | |
} else { | |
// chop off surrounding <..>: | |
return normalizeURI(unescapeString(res.substr(1, res.length - 2))); | |
} | |
}; | |
// Attempt to parse a link label, returning number of characters parsed. | |
var parseLinkLabel = function parseLinkLabel() { | |
var m = this.match(reLinkLabel); | |
if (m === null || m.length > 1001) { | |
return 0; | |
} else { | |
return m.length; | |
} | |
}; | |
// Add open bracket to delimiter stack and add a text node to block's children. | |
var parseOpenBracket = function parseOpenBracket(block) { | |
var startpos = this.pos; | |
this.pos += 1; | |
var node = text('['); | |
block.appendChild(node); | |
// Add entry to stack for this opener | |
this.delimiters = { cc: C_OPEN_BRACKET, | |
numdelims: 1, | |
node: node, | |
previous: this.delimiters, | |
next: null, | |
can_open: true, | |
can_close: false, | |
index: startpos, | |
active: true }; | |
if (this.delimiters.previous !== null) { | |
this.delimiters.previous.next = this.delimiters; | |
} | |
return true; | |
}; | |
// IF next character is [, and ! delimiter to delimiter stack and | |
// add a text node to block's children. Otherwise just add a text node. | |
var parseBang = function parseBang(block) { | |
var startpos = this.pos; | |
this.pos += 1; | |
if (this.peek() === C_OPEN_BRACKET) { | |
this.pos += 1; | |
var node = text('!['); | |
block.appendChild(node); | |
// Add entry to stack for this opener | |
this.delimiters = { cc: C_BANG, | |
numdelims: 1, | |
node: node, | |
previous: this.delimiters, | |
next: null, | |
can_open: true, | |
can_close: false, | |
index: startpos + 1, | |
active: true }; | |
if (this.delimiters.previous !== null) { | |
this.delimiters.previous.next = this.delimiters; | |
} | |
} else { | |
block.appendChild(text('!')); | |
} | |
return true; | |
}; | |
// Try to match close bracket against an opening in the delimiter | |
// stack. Add either a link or image, or a plain [ character, | |
// to block's children. If there is a matching delimiter, | |
// remove it from the delimiter stack. | |
var parseCloseBracket = function parseCloseBracket(block) { | |
var startpos; | |
var is_image; | |
var dest; | |
var title; | |
var matched = false; | |
var reflabel; | |
var opener; | |
this.pos += 1; | |
startpos = this.pos; | |
// look through stack of delimiters for a [ or ![ | |
opener = this.delimiters; | |
while (opener !== null) { | |
if (opener.cc === C_OPEN_BRACKET || opener.cc === C_BANG) { | |
break; | |
} | |
opener = opener.previous; | |
} | |
if (opener === null) { | |
// no matched opener, just return a literal | |
block.appendChild(text(']')); | |
return true; | |
} | |
if (!opener.active) { | |
// no matched opener, just return a literal | |
block.appendChild(text(']')); | |
// take opener off emphasis stack | |
this.removeDelimiter(opener); | |
return true; | |
} | |
// If we got here, open is a potential opener | |
is_image = opener.cc === C_BANG; | |
// Check to see if we have a link/image | |
// Inline link? | |
if (this.peek() === C_OPEN_PAREN) { | |
this.pos++; | |
if (this.spnl() && (dest = this.parseLinkDestination()) !== null && this.spnl() && ( | |
// make sure there's a space before the title: | |
reWhitespaceChar.test(this.subject.charAt(this.pos - 1)) && (title = this.parseLinkTitle()) || true) && this.spnl() && this.peek() === C_CLOSE_PAREN) { | |
this.pos += 1; | |
matched = true; | |
} | |
} else { | |
// Next, see if there's a link label | |
var savepos = this.pos; | |
var beforelabel = this.pos; | |
var n = this.parseLinkLabel(); | |
if (n === 0 || n === 2) { | |
// empty or missing second label | |
reflabel = this.subject.slice(opener.index, startpos); | |
} else { | |
reflabel = this.subject.slice(beforelabel, beforelabel + n); | |
} | |
if (n === 0) { | |
// If shortcut reference link, rewind before spaces we skipped. | |
this.pos = savepos; | |
} | |
// lookup rawlabel in refmap | |
var link = this.refmap[normalizeReference(reflabel)]; | |
if (link) { | |
dest = link.destination; | |
title = link.title; | |
matched = true; | |
} | |
} | |
if (matched) { | |
var node = new Node(is_image ? 'Image' : 'Link'); | |
node._destination = dest; | |
node._title = title || ''; | |
var tmp, next; | |
tmp = opener.node._next; | |
while (tmp) { | |
next = tmp._next; | |
tmp.unlink(); | |
node.appendChild(tmp); | |
tmp = next; | |
} | |
block.appendChild(node); | |
this.processEmphasis(opener.previous); | |
opener.node.unlink(); | |
// processEmphasis will remove this and later delimiters. | |
// Now, for a link, we also deactivate earlier link openers. | |
// (no links in links) | |
if (!is_image) { | |
opener = this.delimiters; | |
while (opener !== null) { | |
if (opener.cc === C_OPEN_BRACKET) { | |
opener.active = false; // deactivate this opener | |
} | |
opener = opener.previous; | |
} | |
} | |
return true; | |
} else { | |
// no match | |
this.removeDelimiter(opener); // remove this opener from stack | |
this.pos = startpos; | |
block.appendChild(text(']')); | |
return true; | |
} | |
}; | |
// Attempt to parse an entity. | |
var parseEntity = function parseEntity(block) { | |
var m; | |
if (m = this.match(reEntityHere)) { | |
block.appendChild(text(decodeHTML(m))); | |
return true; | |
} else { | |
return false; | |
} | |
}; | |
// Parse a run of ordinary characters, or a single character with | |
// a special meaning in markdown, as a plain string. | |
var parseString = function parseString(block) { | |
var m; | |
if (m = this.match(reMain)) { | |
if (this.options.smart) { | |
block.appendChild(text(m.replace(reEllipses, '\u2026').replace(reDash, function (chars) { | |
var enCount = 0; | |
var emCount = 0; | |
if (chars.length % 3 === 0) { | |
// If divisible by 3, use all em dashes | |
emCount = chars.length / 3; | |
} else if (chars.length % 2 === 0) { | |
// If divisible by 2, use all en dashes | |
enCount = chars.length / 2; | |
} else if (chars.length % 3 === 2) { | |
// If 2 extra dashes, use en dash for last 2; em dashes for rest | |
enCount = 1; | |
emCount = (chars.length - 2) / 3; | |
} else { | |
// Use en dashes for last 4 hyphens; em dashes for rest | |
enCount = 2; | |
emCount = (chars.length - 4) / 3; | |
} | |
return '\u2014'.repeat(emCount) + '\u2013'.repeat(enCount); | |
}))); | |
} else { | |
block.appendChild(text(m)); | |
} | |
return true; | |
} else { | |
return false; | |
} | |
}; | |
// Parse a newline. If it was preceded by two spaces, return a hard | |
// line break; otherwise a soft line break. | |
var parseNewline = function parseNewline(block) { | |
this.pos += 1; // assume we're at a \n | |
// check previous node for trailing spaces | |
var lastc = block._lastChild; | |
if (lastc && lastc.type === 'Text' && lastc._literal[lastc._literal.length - 1] === ' ') { | |
var hardbreak = lastc._literal[lastc._literal.length - 2] === ' '; | |
lastc._literal = lastc._literal.replace(reFinalSpace, ''); | |
block.appendChild(new Node(hardbreak ? 'Hardbreak' : 'Softbreak')); | |
} else { | |
block.appendChild(new Node('Softbreak')); | |
} | |
this.match(reInitialSpace); // gobble leading spaces in next line | |
return true; | |
}; | |
// Attempt to parse a link reference, modifying refmap. | |
var parseReference = function parseReference(s, refmap) { | |
this.subject = s; | |
this.pos = 0; | |
var rawlabel; | |
var dest; | |
var title; | |
var matchChars; | |
var startpos = this.pos; | |
// label: | |
matchChars = this.parseLinkLabel(); | |
if (matchChars === 0) { | |
return 0; | |
} else { | |
rawlabel = this.subject.substr(0, matchChars); | |
} | |
// colon: | |
if (this.peek() === C_COLON) { | |
this.pos++; | |
} else { | |
this.pos = startpos; | |
return 0; | |
} | |
// link url | |
this.spnl(); | |
dest = this.parseLinkDestination(); | |
if (dest === null || dest.length === 0) { | |
this.pos = startpos; | |
return 0; | |
} | |
var beforetitle = this.pos; | |
this.spnl(); | |
title = this.parseLinkTitle(); | |
if (title === null) { | |
title = ''; | |
// rewind before spaces | |
this.pos = beforetitle; | |
} | |
// make sure we're at line end: | |
var atLineEnd = true; | |
if (this.match(reSpaceAtEndOfLine) === null) { | |
if (title === '') { | |
atLineEnd = false; | |
} else { | |
// the potential title we found is not at the line end, | |
// but it could still be a legal link reference if we | |
// discard the title | |
title = ''; | |
// rewind before spaces | |
this.pos = beforetitle; | |
// and instead check if the link URL is at the line end | |
atLineEnd = this.match(reSpaceAtEndOfLine) !== null; | |
} | |
} | |
if (!atLineEnd) { | |
this.pos = startpos; | |
return 0; | |
} | |
var normlabel = normalizeReference(rawlabel); | |
if (normlabel === '') { | |
// label must contain non-whitespace characters | |
this.pos = startpos; | |
return 0; | |
} | |
if (!refmap[normlabel]) { | |
refmap[normlabel] = { destination: dest, title: title }; | |
} | |
return this.pos - startpos; | |
}; | |
// Parse the next inline element in subject, advancing subject position. | |
// On success, add the result to block's children and return true. | |
// On failure, return false. | |
var parseInline = function parseInline(block) { | |
var res = false; | |
var c = this.peek(); | |
if (c === -1) { | |
return false; | |
} | |
switch (c) { | |
case C_NEWLINE: | |
res = this.parseNewline(block); | |
break; | |
case C_BACKSLASH: | |
res = this.parseBackslash(block); | |
break; | |
case C_BACKTICK: | |
res = this.parseBackticks(block); | |
break; | |
case C_ASTERISK: | |
case C_UNDERSCORE: | |
res = this.handleDelim(c, block); | |
break; | |
case C_SINGLEQUOTE: | |
case C_DOUBLEQUOTE: | |
res = this.options.smart && this.handleDelim(c, block); | |
break; | |
case C_OPEN_BRACKET: | |
res = this.parseOpenBracket(block); | |
break; | |
case C_BANG: | |
res = this.parseBang(block); | |
break; | |
case C_CLOSE_BRACKET: | |
res = this.parseCloseBracket(block); | |
break; | |
case C_LESSTHAN: | |
res = this.parseAutolink(block) || this.parseHtmlTag(block); | |
break; | |
case C_AMPERSAND: | |
res = this.parseEntity(block); | |
break; | |
default: | |
res = this.parseString(block); | |
break; | |
} | |
if (!res) { | |
this.pos += 1; | |
block.appendChild(text(fromCodePoint(c))); | |
} | |
return true; | |
}; | |
// Parse string content in block into inline children, | |
// using refmap to resolve references. | |
var parseInlines = function parseInlines(block) { | |
this.subject = block._string_content.trim(); | |
this.pos = 0; | |
this.delimiters = null; | |
while (this.parseInline(block)) {} | |
block._string_content = null; // allow raw string to be garbage collected | |
this.processEmphasis(null); | |
}; | |
// The InlineParser object. | |
function InlineParser(options) { | |
return { | |
subject: '', | |
delimiters: null, // used by handleDelim method | |
pos: 0, | |
refmap: {}, | |
match: match, | |
peek: peek, | |
spnl: spnl, | |
parseBackticks: parseBackticks, | |
parseBackslash: parseBackslash, | |
parseAutolink: parseAutolink, | |
parseHtmlTag: parseHtmlTag, | |
scanDelims: scanDelims, | |
handleDelim: handleDelim, | |
parseLinkTitle: parseLinkTitle, | |
parseLinkDestination: parseLinkDestination, | |
parseLinkLabel: parseLinkLabel, | |
parseOpenBracket: parseOpenBracket, | |
parseCloseBracket: parseCloseBracket, | |
parseBang: parseBang, | |
parseEntity: parseEntity, | |
parseString: parseString, | |
parseNewline: parseNewline, | |
parseReference: parseReference, | |
parseInline: parseInline, | |
processEmphasis: processEmphasis, | |
removeDelimiter: removeDelimiter, | |
options: options || {}, | |
parse: parseInlines | |
}; | |
} | |
module.exports = InlineParser; | |
/***/ }), | |
/* 99 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
"use strict"; | |
/* The bulk of this code derives from https://github.com/dmoscrop/fold-case | |
But in addition to case-folding, we also normalize whitespace. | |
fold-case is Copyright Mathias Bynens <https://mathiasbynens.be/> | |
Permission is hereby granted, free of charge, to any person obtaining | |
a copy of this software and associated documentation files (the | |
"Software"), to deal in the Software without restriction, including | |
without limitation the rights to use, copy, modify, merge, publish, | |
distribute, sublicense, and/or sell copies of the Software, and to | |
permit persons to whom the Software is furnished to do so, subject to | |
the following conditions: | |
The above copyright notice and this permission notice shall be | |
included in all copies or substantial portions of the Software. | |
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, | |
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF | |
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND | |
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE | |
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION | |
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION | |
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | |
*/ | |
/*eslint-disable key-spacing, comma-spacing */ | |
var regex = /[ \t\r\n]+|[A-Z\xB5\xC0-\xD6\xD8-\xDF\u0100\u0102\u0104\u0106\u0108\u010A\u010C\u010E\u0110\u0112\u0114\u0116\u0118\u011A\u011C\u011E\u0120\u0122\u0124\u0126\u0128\u012A\u012C\u012E\u0130\u0132\u0134\u0136\u0139\u013B\u013D\u013F\u0141\u0143\u0145\u0147\u0149\u014A\u014C\u014E\u0150\u0152\u0154\u0156\u0158\u015A\u015C\u015E\u0160\u0162\u0164\u0166\u0168\u016A\u016C\u016E\u0170\u0172\u0174\u0176\u0178\u0179\u017B\u017D\u017F\u0181\u0182\u0184\u0186\u0187\u0189-\u018B\u018E-\u0191\u0193\u0194\u0196-\u0198\u019C\u019D\u019F\u01A0\u01A2\u01A4\u01A6\u01A7\u01A9\u01AC\u01AE\u01AF\u01B1-\u01B3\u01B5\u01B7\u01B8\u01BC\u01C4\u01C5\u01C7\u01C8\u01CA\u01CB\u01CD\u01CF\u01D1\u01D3\u01D5\u01D7\u01D9\u01DB\u01DE\u01E0\u01E2\u01E4\u01E6\u01E8\u01EA\u01EC\u01EE\u01F0-\u01F2\u01F4\u01F6-\u01F8\u01FA\u01FC\u01FE\u0200\u0202\u0204\u0206\u0208\u020A\u020C\u020E\u0210\u0212\u0214\u0216\u0218\u021A\u021C\u021E\u0220\u0222\u0224\u0226\u0228\u022A\u022C\u022E\u0230\u0232\u023A\u023B\u023D\u023E\u0241\u0243-\u0246\u0248\u024A\u024C\u024E\u0345\u0370\u0372\u0376\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03AB\u03B0\u03C2\u03CF-\u03D1\u03D5\u03D6\u03D8\u03DA\u03DC\u03DE\u03E0\u03E2\u03E4\u03E6\u03E8\u03EA\u03EC\u03EE\u03F0\u03F1\u03F4\u03F5\u03F7\u03F9\u03FA\u03FD-\u042F\u0460\u0462\u0464\u0466\u0468\u046A\u046C\u046E\u0470\u0472\u0474\u0476\u0478\u047A\u047C\u047E\u0480\u048A\u048C\u048E\u0490\u0492\u0494\u0496\u0498\u049A\u049C\u049E\u04A0\u04A2\u04A4\u04A6\u04A8\u04AA\u04AC\u04AE\u04B0\u04B2\u04B4\u04B6\u04B8\u04BA\u04BC\u04BE\u04C0\u04C1\u04C3\u04C5\u04C7\u04C9\u04CB\u04CD\u04D0\u04D2\u04D4\u04D6\u04D8\u04DA\u04DC\u04DE\u04E0\u04E2\u04E4\u04E6\u04E8\u04EA\u04EC\u04EE\u04F0\u04F2\u04F4\u04F6\u04F8\u04FA\u04FC\u04FE\u0500\u0502\u0504\u0506\u0508\u050A\u050C\u050E\u0510\u0512\u0514\u0516\u0518\u051A\u051C\u051E\u0520\u0522\u0524\u0526\u0528\u052A\u052C\u052E\u0531-\u0556\u0587\u10A0-\u10C5\u10C7\u10CD\u1E00\u1E02\u1E04\u1E06\u1E08\u1E0A\u1E0C\u1E0E\u1E10\u1E12\u1E14\u1E16\u1E18\u1E1A\u1E1C\u1E1E\u1E20\u1E22\u1E24\u1E26\u1E28\u1E2A\u1E2C\u1E2E\u1E30\u1E32\u1E34\u1E36\u1E38\u1E3A\u1E3C\u1E3E\u1E40\u1E42\u1E44\u1E46\u1E48\u1E4A\u1E4C\u1E4E\u1E50\u1E52\u1E54\u1E56\u1E58\u1E5A\u1E5C\u1E5E\u1E60\u1E62\u1E64\u1E66\u1E68\u1E6A\u1E6C\u1E6E\u1E70\u1E72\u1E74\u1E76\u1E78\u1E7A\u1E7C\u1E7E\u1E80\u1E82\u1E84\u1E86\u1E88\u1E8A\u1E8C\u1E8E\u1E90\u1E92\u1E94\u1E96-\u1E9B\u1E9E\u1EA0\u1EA2\u1EA4\u1EA6\u1EA8\u1EAA\u1EAC\u1EAE\u1EB0\u1EB2\u1EB4\u1EB6\u1EB8\u1EBA\u1EBC\u1EBE\u1EC0\u1EC2\u1EC4\u1EC6\u1EC8\u1ECA\u1ECC\u1ECE\u1ED0\u1ED2\u1ED4\u1ED6\u1ED8\u1EDA\u1EDC\u1EDE\u1EE0\u1EE2\u1EE4\u1EE6\u1EE8\u1EEA\u1EEC\u1EEE\u1EF0\u1EF2\u1EF4\u1EF6\u1EF8\u1EFA\u1EFC\u1EFE\u1F08-\u1F0F\u1F18-\u1F1D\u1F28-\u1F2F\u1F38-\u1F3F\u1F48-\u1F4D\u1F50\u1F52\u1F54\u1F56\u1F59\u1F5B\u1F5D\u1F5F\u1F68-\u1F6F\u1F80-\u1FAF\u1FB2-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD2\u1FD3\u1FD6-\u1FDB\u1FE2-\u1FE4\u1FE6-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2126\u212A\u212B\u2132\u2160-\u216F\u2183\u24B6-\u24CF\u2C00-\u2C2E\u2C60\u2C62-\u2C64\u2C67\u2C69\u2C6B\u2C6D-\u2C70\u2C72\u2C75\u2C7E-\u2C80\u2C82\u2C84\u2C86\u2C88\u2C8A\u2C8C\u2C8E\u2C90\u2C92\u2C94\u2C96\u2C98\u2C9A\u2C9C\u2C9E\u2CA0\u2CA2\u2CA4\u2CA6\u2CA8\u2CAA\u2CAC\u2CAE\u2CB0\u2CB2\u2CB4\u2CB6\u2CB8\u2CBA\u2CBC\u2CBE\u2CC0\u2CC2\u2CC4\u2CC6\u2CC8\u2CCA\u2CCC\u2CCE\u2CD0\u2CD2\u2CD4\u2CD6\u2CD8\u2CDA\u2CDC\u2CDE\u2CE0\u2CE2\u2CEB\u2CED\u2CF2\uA640\uA642\uA644\uA646\uA648\uA64A\uA64C\uA64E\uA650\uA652\uA654\uA656\uA658\uA65A\uA65C\uA65E\uA660\uA662\uA664\uA666\uA668\uA66A\uA66C\uA680\uA682\uA684\uA686\uA688\uA68A\uA68C\uA68E\uA690\uA692\uA694\uA696\uA698\uA69A\uA722\uA724\uA726\uA728\uA72A\uA72C\uA72E\uA732\uA734\uA736\uA738\uA73A\uA73C\uA73E\uA740\uA742\uA744\uA746\uA748\uA74A\uA74C\uA74E\uA750\uA752\uA754\uA756\uA758\uA75A\uA75C\uA75E\uA760\uA762\uA764\uA766\uA768\uA76A\uA76C\uA76E\uA779\uA77B\uA77D\uA77E\uA780\uA782\uA784\uA786\uA78B\uA78D\uA790\uA792\uA796\uA798\uA79A\uA79C\uA79E\uA7A0\uA7A2\uA7A4\uA7A6\uA7A8\uA7AA-\uA7AD\uA7B0\uA7B1\uFB00-\uFB06\uFB13-\uFB17\uFF21-\uFF3A]|\uD801[\uDC00-\uDC27]|\uD806[\uDCA0-\uDCBF]/g; | |
var map = { 'A': 'a', 'B': 'b', 'C': 'c', 'D': 'd', 'E': 'e', 'F': 'f', 'G': 'g', 'H': 'h', 'I': 'i', 'J': 'j', 'K': 'k', 'L': 'l', 'M': 'm', 'N': 'n', 'O': 'o', 'P': 'p', 'Q': 'q', 'R': 'r', 'S': 's', 'T': 't', 'U': 'u', 'V': 'v', 'W': 'w', 'X': 'x', 'Y': 'y', 'Z': 'z', '\xB5': '\u03BC', '\xC0': '\xE0', '\xC1': '\xE1', '\xC2': '\xE2', '\xC3': '\xE3', '\xC4': '\xE4', '\xC5': '\xE5', '\xC6': '\xE6', '\xC7': '\xE7', '\xC8': '\xE8', '\xC9': '\xE9', '\xCA': '\xEA', '\xCB': '\xEB', '\xCC': '\xEC', '\xCD': '\xED', '\xCE': '\xEE', '\xCF': '\xEF', '\xD0': '\xF0', '\xD1': '\xF1', '\xD2': '\xF2', '\xD3': '\xF3', '\xD4': '\xF4', '\xD5': '\xF5', '\xD6': '\xF6', '\xD8': '\xF8', '\xD9': '\xF9', '\xDA': '\xFA', '\xDB': '\xFB', '\xDC': '\xFC', '\xDD': '\xFD', '\xDE': '\xFE', '\u0100': '\u0101', '\u0102': '\u0103', '\u0104': '\u0105', '\u0106': '\u0107', '\u0108': '\u0109', '\u010A': '\u010B', '\u010C': '\u010D', '\u010E': '\u010F', '\u0110': '\u0111', '\u0112': '\u0113', '\u0114': '\u0115', '\u0116': '\u0117', '\u0118': '\u0119', '\u011A': '\u011B', '\u011C': '\u011D', '\u011E': '\u011F', '\u0120': '\u0121', '\u0122': '\u0123', '\u0124': '\u0125', '\u0126': '\u0127', '\u0128': '\u0129', '\u012A': '\u012B', '\u012C': '\u012D', '\u012E': '\u012F', '\u0132': '\u0133', '\u0134': '\u0135', '\u0136': '\u0137', '\u0139': '\u013A', '\u013B': '\u013C', '\u013D': '\u013E', '\u013F': '\u0140', '\u0141': '\u0142', '\u0143': '\u0144', '\u0145': '\u0146', '\u0147': '\u0148', '\u014A': '\u014B', '\u014C': '\u014D', '\u014E': '\u014F', '\u0150': '\u0151', '\u0152': '\u0153', '\u0154': '\u0155', '\u0156': '\u0157', '\u0158': '\u0159', '\u015A': '\u015B', '\u015C': '\u015D', '\u015E': '\u015F', '\u0160': '\u0161', '\u0162': '\u0163', '\u0164': '\u0165', '\u0166': '\u0167', '\u0168': '\u0169', '\u016A': '\u016B', '\u016C': '\u016D', '\u016E': '\u016F', '\u0170': '\u0171', '\u0172': '\u0173', '\u0174': '\u0175', '\u0176': '\u0177', '\u0178': '\xFF', '\u0179': '\u017A', '\u017B': '\u017C', '\u017D': '\u017E', '\u017F': 's', '\u0181': '\u0253', '\u0182': '\u0183', '\u0184': '\u0185', '\u0186': '\u0254', '\u0187': '\u0188', '\u0189': '\u0256', '\u018A': '\u0257', '\u018B': '\u018C', '\u018E': '\u01DD', '\u018F': '\u0259', '\u0190': '\u025B', '\u0191': '\u0192', '\u0193': '\u0260', '\u0194': '\u0263', '\u0196': '\u0269', '\u0197': '\u0268', '\u0198': '\u0199', '\u019C': '\u026F', '\u019D': '\u0272', '\u019F': '\u0275', '\u01A0': '\u01A1', '\u01A2': '\u01A3', '\u01A4': '\u01A5', '\u01A6': '\u0280', '\u01A7': '\u01A8', '\u01A9': '\u0283', '\u01AC': '\u01AD', '\u01AE': '\u0288', '\u01AF': '\u01B0', '\u01B1': '\u028A', '\u01B2': '\u028B', '\u01B3': '\u01B4', '\u01B5': '\u01B6', '\u01B7': '\u0292', '\u01B8': '\u01B9', '\u01BC': '\u01BD', '\u01C4': '\u01C6', '\u01C5': '\u01C6', '\u01C7': '\u01C9', '\u01C8': '\u01C9', '\u01CA': '\u01CC', '\u01CB': '\u01CC', '\u01CD': '\u01CE', '\u01CF': '\u01D0', '\u01D1': '\u01D2', '\u01D3': '\u01D4', '\u01D5': '\u01D6', '\u01D7': '\u01D8', '\u01D9': '\u01DA', '\u01DB': '\u01DC', '\u01DE': '\u01DF', '\u01E0': '\u01E1', '\u01E2': '\u01E3', '\u01E4': '\u01E5', '\u01E6': '\u01E7', '\u01E8': '\u01E9', '\u01EA': '\u01EB', '\u01EC': '\u01ED', '\u01EE': '\u01EF', '\u01F1': '\u01F3', '\u01F2': '\u01F3', '\u01F4': '\u01F5', '\u01F6': '\u0195', '\u01F7': '\u01BF', '\u01F8': '\u01F9', '\u01FA': '\u01FB', '\u01FC': '\u01FD', '\u01FE': '\u01FF', '\u0200': '\u0201', '\u0202': '\u0203', '\u0204': '\u0205', '\u0206': '\u0207', '\u0208': '\u0209', '\u020A': '\u020B', '\u020C': '\u020D', '\u020E': '\u020F', '\u0210': '\u0211', '\u0212': '\u0213', '\u0214': '\u0215', '\u0216': '\u0217', '\u0218': '\u0219', '\u021A': '\u021B', '\u021C': '\u021D', '\u021E': '\u021F', '\u0220': '\u019E', '\u0222': '\u0223', '\u0224': '\u0225', '\u0226': '\u0227', '\u0228': '\u0229', '\u022A': '\u022B', '\u022C': '\u022D', '\u022E': '\u022F', '\u0230': '\u0231', '\u0232': '\u0233', '\u023A': '\u2C65', '\u023B': '\u023C', '\u023D': '\u019A', '\u023E': '\u2C66', '\u0241': '\u0242', '\u0243': '\u0180', '\u0244': '\u0289', '\u0245': '\u028C', '\u0246': '\u0247', '\u0248': '\u0249', '\u024A': '\u024B', '\u024C': '\u024D', '\u024E': '\u024F', '\u0345': '\u03B9', '\u0370': '\u0371', '\u0372': '\u0373', '\u0376': '\u0377', '\u037F': '\u03F3', '\u0386': '\u03AC', '\u0388': '\u03AD', '\u0389': '\u03AE', '\u038A': '\u03AF', '\u038C': '\u03CC', '\u038E': '\u03CD', '\u038F': '\u03CE', '\u0391': '\u03B1', '\u0392': '\u03B2', '\u0393': '\u03B3', '\u0394': '\u03B4', '\u0395': '\u03B5', '\u0396': '\u03B6', '\u0397': '\u03B7', '\u0398': '\u03B8', '\u0399': '\u03B9', '\u039A': '\u03BA', '\u039B': '\u03BB', '\u039C': '\u03BC', '\u039D': '\u03BD', '\u039E': '\u03BE', '\u039F': '\u03BF', '\u03A0': '\u03C0', '\u03A1': '\u03C1', '\u03A3': '\u03C3', '\u03A4': '\u03C4', '\u03A5': '\u03C5', '\u03A6': '\u03C6', '\u03A7': '\u03C7', '\u03A8': '\u03C8', '\u03A9': '\u03C9', '\u03AA': '\u03CA', '\u03AB': '\u03CB', '\u03C2': '\u03C3', '\u03CF': '\u03D7', '\u03D0': '\u03B2', '\u03D1': '\u03B8', '\u03D5': '\u03C6', '\u03D6': '\u03C0', '\u03D8': '\u03D9', '\u03DA': '\u03DB', '\u03DC': '\u03DD', '\u03DE': '\u03DF', '\u03E0': '\u03E1', '\u03E2': '\u03E3', '\u03E4': '\u03E5', '\u03E6': '\u03E7', '\u03E8': '\u03E9', '\u03EA': '\u03EB', '\u03EC': '\u03ED', '\u03EE': '\u03EF', '\u03F0': '\u03BA', '\u03F1': '\u03C1', '\u03F4': '\u03B8', '\u03F5': '\u03B5', '\u03F7': '\u03F8', '\u03F9': '\u03F2', '\u03FA': '\u03FB', '\u03FD': '\u037B', '\u03FE': '\u037C', '\u03FF': '\u037D', '\u0400': '\u0450', '\u0401': '\u0451', '\u0402': '\u0452', '\u0403': '\u0453', '\u0404': '\u0454', '\u0405': '\u0455', '\u0406': '\u0456', '\u0407': '\u0457', '\u0408': '\u0458', '\u0409': '\u0459', '\u040A': '\u045A', '\u040B': '\u045B', '\u040C': '\u045C', '\u040D': '\u045D', '\u040E': '\u045E', '\u040F': '\u045F', '\u0410': '\u0430', '\u0411': '\u0431', '\u0412': '\u0432', '\u0413': '\u0433', '\u0414': '\u0434', '\u0415': '\u0435', '\u0416': '\u0436', '\u0417': '\u0437', '\u0418': '\u0438', '\u0419': '\u0439', '\u041A': '\u043A', '\u041B': '\u043B', '\u041C': '\u043C', '\u041D': '\u043D', '\u041E': '\u043E', '\u041F': '\u043F', '\u0420': '\u0440', '\u0421': '\u0441', '\u0422': '\u0442', '\u0423': '\u0443', '\u0424': '\u0444', '\u0425': '\u0445', '\u0426': '\u0446', '\u0427': '\u0447', '\u0428': '\u0448', '\u0429': '\u0449', '\u042A': '\u044A', '\u042B': '\u044B', '\u042C': '\u044C', '\u042D': '\u044D', '\u042E': '\u044E', '\u042F': '\u044F', '\u0460': '\u0461', '\u0462': '\u0463', '\u0464': '\u0465', '\u0466': '\u0467', '\u0468': '\u0469', '\u046A': '\u046B', '\u046C': '\u046D', '\u046E': '\u046F', '\u0470': '\u0471', '\u0472': '\u0473', '\u0474': '\u0475', '\u0476': '\u0477', '\u0478': '\u0479', '\u047A': '\u047B', '\u047C': '\u047D', '\u047E': '\u047F', '\u0480': '\u0481', '\u048A': '\u048B', '\u048C': '\u048D', '\u048E': '\u048F', '\u0490': '\u0491', '\u0492': '\u0493', '\u0494': '\u0495', '\u0496': '\u0497', '\u0498': '\u0499', '\u049A': '\u049B', '\u049C': '\u049D', '\u049E': '\u049F', '\u04A0': '\u04A1', '\u04A2': '\u04A3', '\u04A4': '\u04A5', '\u04A6': '\u04A7', '\u04A8': '\u04A9', '\u04AA': '\u04AB', '\u04AC': '\u04AD', '\u04AE': '\u04AF', '\u04B0': '\u04B1', '\u04B2': '\u04B3', '\u04B4': '\u04B5', '\u04B6': '\u04B7', '\u04B8': '\u04B9', '\u04BA': '\u04BB', '\u04BC': '\u04BD', '\u04BE': '\u04BF', '\u04C0': '\u04CF', '\u04C1': '\u04C2', '\u04C3': '\u04C4', '\u04C5': '\u04C6', '\u04C7': '\u04C8', '\u04C9': '\u04CA', '\u04CB': '\u04CC', '\u04CD': '\u04CE', '\u04D0': '\u04D1', '\u04D2': '\u04D3', '\u04D4': '\u04D5', '\u04D6': '\u04D7', '\u04D8': '\u04D9', '\u04DA': '\u04DB', '\u04DC': '\u04DD', '\u04DE': '\u04DF', '\u04E0': '\u04E1', '\u04E2': '\u04E3', '\u04E4': '\u04E5', '\u04E6': '\u04E7', '\u04E8': '\u04E9', '\u04EA': '\u04EB', '\u04EC': '\u04ED', '\u04EE': '\u04EF', '\u04F0': '\u04F1', '\u04F2': '\u04F3', '\u04F4': '\u04F5', '\u04F6': '\u04F7', '\u04F8': '\u04F9', '\u04FA': '\u04FB', '\u04FC': '\u04FD', '\u04FE': '\u04FF', '\u0500': '\u0501', '\u0502': '\u0503', '\u0504': '\u0505', '\u0506': '\u0507', '\u0508': '\u0509', '\u050A': '\u050B', '\u050C': '\u050D', '\u050E': '\u050F', '\u0510': '\u0511', '\u0512': '\u0513', '\u0514': '\u0515', '\u0516': '\u0517', '\u0518': '\u0519', '\u051A': '\u051B', '\u051C': '\u051D', '\u051E': '\u051F', '\u0520': '\u0521', '\u0522': '\u0523', '\u0524': '\u0525', '\u0526': '\u0527', '\u0528': '\u0529', '\u052A': '\u052B', '\u052C': '\u052D', '\u052E': '\u052F', '\u0531': '\u0561', '\u0532': '\u0562', '\u0533': '\u0563', '\u0534': '\u0564', '\u0535': '\u0565', '\u0536': '\u0566', '\u0537': '\u0567', '\u0538': '\u0568', '\u0539': '\u0569', '\u053A': '\u056A', '\u053B': '\u056B', '\u053C': '\u056C', '\u053D': '\u056D', '\u053E': '\u056E', '\u053F': '\u056F', '\u0540': '\u0570', '\u0541': '\u0571', '\u0542': '\u0572', '\u0543': '\u0573', '\u0544': '\u0574', '\u0545': '\u0575', '\u0546': '\u0576', '\u0547': '\u0577', '\u0548': '\u0578', '\u0549': '\u0579', '\u054A': '\u057A', '\u054B': '\u057B', '\u054C': '\u057C', '\u054D': '\u057D', '\u054E': '\u057E', '\u054F': '\u057F', '\u0550': '\u0580', '\u0551': '\u0581', '\u0552': '\u0582', '\u0553': '\u0583', '\u0554': '\u0584', '\u0555': '\u0585', '\u0556': '\u0586', '\u10A0': '\u2D00', '\u10A1': '\u2D01', '\u10A2': '\u2D02', '\u10A3': '\u2D03', '\u10A4': '\u2D04', '\u10A5': '\u2D05', '\u10A6': '\u2D06', '\u10A7': '\u2D07', '\u10A8': '\u2D08', '\u10A9': '\u2D09', '\u10AA': '\u2D0A', '\u10AB': '\u2D0B', '\u10AC': '\u2D0C', '\u10AD': '\u2D0D', '\u10AE': '\u2D0E', '\u10AF': '\u2D0F', '\u10B0': '\u2D10', '\u10B1': '\u2D11', '\u10B2': '\u2D12', '\u10B3': '\u2D13', '\u10B4': '\u2D14', '\u10B5': '\u2D15', '\u10B6': '\u2D16', '\u10B7': '\u2D17', '\u10B8': '\u2D18', '\u10B9': '\u2D19', '\u10BA': '\u2D1A', '\u10BB': '\u2D1B', '\u10BC': '\u2D1C', '\u10BD': '\u2D1D', '\u10BE': '\u2D1E', '\u10BF': '\u2D1F', '\u10C0': '\u2D20', '\u10C1': '\u2D21', '\u10C2': '\u2D22', '\u10C3': '\u2D23', '\u10C4': '\u2D24', '\u10C5': '\u2D25', '\u10C7': '\u2D27', '\u10CD': '\u2D2D', '\u1E00': '\u1E01', '\u1E02': '\u1E03', '\u1E04': '\u1E05', '\u1E06': '\u1E07', '\u1E08': '\u1E09', '\u1E0A': '\u1E0B', '\u1E0C': '\u1E0D', '\u1E0E': '\u1E0F', '\u1E10': '\u1E11', '\u1E12': '\u1E13', '\u1E14': '\u1E15', '\u1E16': '\u1E17', '\u1E18': '\u1E19', '\u1E1A': '\u1E1B', '\u1E1C': '\u1E1D', '\u1E1E': '\u1E1F', '\u1E20': '\u1E21', '\u1E22': '\u1E23', '\u1E24': '\u1E25', '\u1E26': '\u1E27', '\u1E28': '\u1E29', '\u1E2A': '\u1E2B', '\u1E2C': '\u1E2D', '\u1E2E': '\u1E2F', '\u1E30': '\u1E31', '\u1E32': '\u1E33', '\u1E34': '\u1E35', '\u1E36': '\u1E37', '\u1E38': '\u1E39', '\u1E3A': '\u1E3B', '\u1E3C': '\u1E3D', '\u1E3E': '\u1E3F', '\u1E40': '\u1E41', '\u1E42': '\u1E43', '\u1E44': '\u1E45', '\u1E46': '\u1E47', '\u1E48': '\u1E49', '\u1E4A': '\u1E4B', '\u1E4C': '\u1E4D', '\u1E4E': '\u1E4F', '\u1E50': '\u1E51', '\u1E52': '\u1E53', '\u1E54': '\u1E55', '\u1E56': '\u1E57', '\u1E58': '\u1E59', '\u1E5A': '\u1E5B', '\u1E5C': '\u1E5D', '\u1E5E': '\u1E5F', '\u1E60': '\u1E61', '\u1E62': '\u1E63', '\u1E64': '\u1E65', '\u1E66': '\u1E67', '\u1E68': '\u1E69', '\u1E6A': '\u1E6B', '\u1E6C': '\u1E6D', '\u1E6E': '\u1E6F', '\u1E70': '\u1E71', '\u1E72': '\u1E73', '\u1E74': '\u1E75', '\u1E76': '\u1E77', '\u1E78': '\u1E79', '\u1E7A': '\u1E7B', '\u1E7C': '\u1E7D', '\u1E7E': '\u1E7F', '\u1E80': '\u1E81', '\u1E82': '\u1E83', '\u1E84': '\u1E85', '\u1E86': '\u1E87', '\u1E88': '\u1E89', '\u1E8A': '\u1E8B', '\u1E8C': '\u1E8D', '\u1E8E': '\u1E8F', '\u1E90': '\u1E91', '\u1E92': '\u1E93', '\u1E94': '\u1E95', '\u1E9B': '\u1E61', '\u1EA0': '\u1EA1', '\u1EA2': '\u1EA3', '\u1EA4': '\u1EA5', '\u1EA6': '\u1EA7', '\u1EA8': '\u1EA9', '\u1EAA': '\u1EAB', '\u1EAC': '\u1EAD', '\u1EAE': '\u1EAF', '\u1EB0': '\u1EB1', '\u1EB2': '\u1EB3', '\u1EB4': '\u1EB5', '\u1EB6': '\u1EB7', '\u1EB8': '\u1EB9', '\u1EBA': '\u1EBB', '\u1EBC': '\u1EBD', '\u1EBE': '\u1EBF', '\u1EC0': '\u1EC1', '\u1EC2': '\u1EC3', '\u1EC4': '\u1EC5', '\u1EC6': '\u1EC7', '\u1EC8': '\u1EC9', '\u1ECA': '\u1ECB', '\u1ECC': '\u1ECD', '\u1ECE': '\u1ECF', '\u1ED0': '\u1ED1', '\u1ED2': '\u1ED3', '\u1ED4': '\u1ED5', '\u1ED6': '\u1ED7', '\u1ED8': '\u1ED9', '\u1EDA': '\u1EDB', '\u1EDC': '\u1EDD', '\u1EDE': '\u1EDF', '\u1EE0': '\u1EE1', '\u1EE2': '\u1EE3', '\u1EE4': '\u1EE5', '\u1EE6': '\u1EE7', '\u1EE8': '\u1EE9', '\u1EEA': '\u1EEB', '\u1EEC': '\u1EED', '\u1EEE': '\u1EEF', '\u1EF0': '\u1EF1', '\u1EF2': '\u1EF3', '\u1EF4': '\u1EF5', '\u1EF6': '\u1EF7', '\u1EF8': '\u1EF9', '\u1EFA': '\u1EFB', '\u1EFC': '\u1EFD', '\u1EFE': '\u1EFF', '\u1F08': '\u1F00', '\u1F09': '\u1F01', '\u1F0A': '\u1F02', '\u1F0B': '\u1F03', '\u1F0C': '\u1F04', '\u1F0D': '\u1F05', '\u1F0E': '\u1F06', '\u1F0F': '\u1F07', '\u1F18': '\u1F10', '\u1F19': '\u1F11', '\u1F1A': '\u1F12', '\u1F1B': '\u1F13', '\u1F1C': '\u1F14', '\u1F1D': '\u1F15', '\u1F28': '\u1F20', '\u1F29': '\u1F21', '\u1F2A': '\u1F22', '\u1F2B': '\u1F23', '\u1F2C': '\u1F24', '\u1F2D': '\u1F25', '\u1F2E': '\u1F26', '\u1F2F': '\u1F27', '\u1F38': '\u1F30', '\u1F39': '\u1F31', '\u1F3A': '\u1F32', '\u1F3B': '\u1F33', '\u1F3C': '\u1F34', '\u1F3D': '\u1F35', '\u1F3E': '\u1F36', '\u1F3F': '\u1F37', '\u1F48': '\u1F40', '\u1F49': '\u1F41', '\u1F4A': '\u1F42', '\u1F4B': '\u1F43', '\u1F4C': '\u1F44', '\u1F4D': '\u1F45', '\u1F59': '\u1F51', '\u1F5B': '\u1F53', '\u1F5D': '\u1F55', '\u1F5F': '\u1F57', '\u1F68': '\u1F60', '\u1F69': '\u1F61', '\u1F6A': '\u1F62', '\u1F6B': '\u1F63', '\u1F6C': '\u1F64', '\u1F6D': '\u1F65', '\u1F6E': '\u1F66', '\u1F6F': '\u1F67', '\u1FB8': '\u1FB0', '\u1FB9': '\u1FB1', '\u1FBA': '\u1F70', '\u1FBB': '\u1F71', '\u1FBE': '\u03B9', '\u1FC8': '\u1F72', '\u1FC9': '\u1F73', '\u1FCA': '\u1F74', '\u1FCB': '\u1F75', '\u1FD8': '\u1FD0', '\u1FD9': '\u1FD1', '\u1FDA': '\u1F76', '\u1FDB': '\u1F77', '\u1FE8': '\u1FE0', '\u1FE9': '\u1FE1', '\u1FEA': '\u1F7A', '\u1FEB': '\u1F7B', '\u1FEC': '\u1FE5', '\u1FF8': '\u1F78', '\u1FF9': '\u1F79', '\u1FFA': '\u1F7C', '\u1FFB': '\u1F7D', '\u2126': '\u03C9', '\u212A': 'k', '\u212B': '\xE5', '\u2132': '\u214E', '\u2160': '\u2170', '\u2161': '\u2171', '\u2162': '\u2172', '\u2163': '\u2173', '\u2164': '\u2174', '\u2165': '\u2175', '\u2166': '\u2176', '\u2167': '\u2177', '\u2168': '\u2178', '\u2169': '\u2179', '\u216A': '\u217A', '\u216B': '\u217B', '\u216C': '\u217C', '\u216D': '\u217D', '\u216E': '\u217E', '\u216F': '\u217F', '\u2183': '\u2184', '\u24B6': '\u24D0', '\u24B7': '\u24D1', '\u24B8': '\u24D2', '\u24B9': '\u24D3', '\u24BA': '\u24D4', '\u24BB': '\u24D5', '\u24BC': '\u24D6', '\u24BD': '\u24D7', '\u24BE': '\u24D8', '\u24BF': '\u24D9', '\u24C0': '\u24DA', '\u24C1': '\u24DB', '\u24C2': '\u24DC', '\u24C3': '\u24DD', '\u24C4': '\u24DE', '\u24C5': '\u24DF', '\u24C6': '\u24E0', '\u24C7': '\u24E1', '\u24C8': '\u24E2', '\u24C9': '\u24E3', '\u24CA': '\u24E4', '\u24CB': '\u24E5', '\u24CC': '\u24E6', '\u24CD': '\u24E7', '\u24CE': '\u24E8', '\u24CF': '\u24E9', '\u2C00': '\u2C30', '\u2C01': '\u2C31', '\u2C02': '\u2C32', '\u2C03': '\u2C33', '\u2C04': '\u2C34', '\u2C05': '\u2C35', '\u2C06': '\u2C36', '\u2C07': '\u2C37', '\u2C08': '\u2C38', '\u2C09': '\u2C39', '\u2C0A': '\u2C3A', '\u2C0B': '\u2C3B', '\u2C0C': '\u2C3C', '\u2C0D': '\u2C3D', '\u2C0E': '\u2C3E', '\u2C0F': '\u2C3F', '\u2C10': '\u2C40', '\u2C11': '\u2C41', '\u2C12': '\u2C42', '\u2C13': '\u2C43', '\u2C14': '\u2C44', '\u2C15': '\u2C45', '\u2C16': '\u2C46', '\u2C17': '\u2C47', '\u2C18': '\u2C48', '\u2C19': '\u2C49', '\u2C1A': '\u2C4A', '\u2C1B': '\u2C4B', '\u2C1C': '\u2C4C', '\u2C1D': '\u2C4D', '\u2C1E': '\u2C4E', '\u2C1F': '\u2C4F', '\u2C20': '\u2C50', '\u2C21': '\u2C51', '\u2C22': '\u2C52', '\u2C23': '\u2C53', '\u2C24': '\u2C54', '\u2C25': '\u2C55', '\u2C26': '\u2C56', '\u2C27': '\u2C57', '\u2C28': '\u2C58', '\u2C29': '\u2C59', '\u2C2A': '\u2C5A', '\u2C2B': '\u2C5B', '\u2C2C': '\u2C5C', '\u2C2D': '\u2C5D', '\u2C2E': '\u2C5E', '\u2C60': '\u2C61', '\u2C62': '\u026B', '\u2C63': '\u1D7D', '\u2C64': '\u027D', '\u2C67': '\u2C68', '\u2C69': '\u2C6A', '\u2C6B': '\u2C6C', '\u2C6D': '\u0251', '\u2C6E': '\u0271', '\u2C6F': '\u0250', '\u2C70': '\u0252', '\u2C72': '\u2C73', '\u2C75': '\u2C76', '\u2C7E': '\u023F', '\u2C7F': '\u0240', '\u2C80': '\u2C81', '\u2C82': '\u2C83', '\u2C84': '\u2C85', '\u2C86': '\u2C87', '\u2C88': '\u2C89', '\u2C8A': '\u2C8B', '\u2C8C': '\u2C8D', '\u2C8E': '\u2C8F', '\u2C90': '\u2C91', '\u2C92': '\u2C93', '\u2C94': '\u2C95', '\u2C96': '\u2C97', '\u2C98': '\u2C99', '\u2C9A': '\u2C9B', '\u2C9C': '\u2C9D', '\u2C9E': '\u2C9F', '\u2CA0': '\u2CA1', '\u2CA2': '\u2CA3', '\u2CA4': '\u2CA5', '\u2CA6': '\u2CA7', '\u2CA8': '\u2CA9', '\u2CAA': '\u2CAB', '\u2CAC': '\u2CAD', '\u2CAE': '\u2CAF', '\u2CB0': '\u2CB1', '\u2CB2': '\u2CB3', '\u2CB4': '\u2CB5', '\u2CB6': '\u2CB7', '\u2CB8': '\u2CB9', '\u2CBA': '\u2CBB', '\u2CBC': '\u2CBD', '\u2CBE': '\u2CBF', '\u2CC0': '\u2CC1', '\u2CC2': '\u2CC3', '\u2CC4': '\u2CC5', '\u2CC6': '\u2CC7', '\u2CC8': '\u2CC9', '\u2CCA': '\u2CCB', '\u2CCC': '\u2CCD', '\u2CCE': '\u2CCF', '\u2CD0': '\u2CD1', '\u2CD2': '\u2CD3', '\u2CD4': '\u2CD5', '\u2CD6': '\u2CD7', '\u2CD8': '\u2CD9', '\u2CDA': '\u2CDB', '\u2CDC': '\u2CDD', '\u2CDE': '\u2CDF', '\u2CE0': '\u2CE1', '\u2CE2': '\u2CE3', '\u2CEB': '\u2CEC', '\u2CED': '\u2CEE', '\u2CF2': '\u2CF3', '\uA640': '\uA641', '\uA642': '\uA643', '\uA644': '\uA645', '\uA646': '\uA647', '\uA648': '\uA649', '\uA64A': '\uA64B', '\uA64C': '\uA64D', '\uA64E': '\uA64F', '\uA650': '\uA651', '\uA652': '\uA653', '\uA654': '\uA655', '\uA656': '\uA657', '\uA658': '\uA659', '\uA65A': '\uA65B', '\uA65C': '\uA65D', '\uA65E': '\uA65F', '\uA660': '\uA661', '\uA662': '\uA663', '\uA664': '\uA665', '\uA666': '\uA667', '\uA668': '\uA669', '\uA66A': '\uA66B', '\uA66C': '\uA66D', '\uA680': '\uA681', '\uA682': '\uA683', '\uA684': '\uA685', '\uA686': '\uA687', '\uA688': '\uA689', '\uA68A': '\uA68B', '\uA68C': '\uA68D', '\uA68E': '\uA68F', '\uA690': '\uA691', '\uA692': '\uA693', '\uA694': '\uA695', '\uA696': '\uA697', '\uA698': '\uA699', '\uA69A': '\uA69B', '\uA722': '\uA723', '\uA724': '\uA725', '\uA726': '\uA727', '\uA728': '\uA729', '\uA72A': '\uA72B', '\uA72C': '\uA72D', '\uA72E': '\uA72F', '\uA732': '\uA733', '\uA734': '\uA735', '\uA736': '\uA737', '\uA738': '\uA739', '\uA73A': '\uA73B', '\uA73C': '\uA73D', '\uA73E': '\uA73F', '\uA740': '\uA741', '\uA742': '\uA743', '\uA744': '\uA745', '\uA746': '\uA747', '\uA748': '\uA749', '\uA74A': '\uA74B', '\uA74C': '\uA74D', '\uA74E': '\uA74F', '\uA750': '\uA751', '\uA752': '\uA753', '\uA754': '\uA755', '\uA756': '\uA757', '\uA758': '\uA759', '\uA75A': '\uA75B', '\uA75C': '\uA75D', '\uA75E': '\uA75F', '\uA760': '\uA761', '\uA762': '\uA763', '\uA764': '\uA765', '\uA766': '\uA767', '\uA768': '\uA769', '\uA76A': '\uA76B', '\uA76C': '\uA76D', '\uA76E': '\uA76F', '\uA779': '\uA77A', '\uA77B': '\uA77C', '\uA77D': '\u1D79', '\uA77E': '\uA77F', '\uA780': '\uA781', '\uA782': '\uA783', '\uA784': '\uA785', '\uA786': '\uA787', '\uA78B': '\uA78C', '\uA78D': '\u0265', '\uA790': '\uA791', '\uA792': '\uA793', '\uA796': '\uA797', '\uA798': '\uA799', '\uA79A': '\uA79B', '\uA79C': '\uA79D', '\uA79E': '\uA79F', '\uA7A0': '\uA7A1', '\uA7A2': '\uA7A3', '\uA7A4': '\uA7A5', '\uA7A6': '\uA7A7', '\uA7A8': '\uA7A9', '\uA7AA': '\u0266', '\uA7AB': '\u025C', '\uA7AC': '\u0261', '\uA7AD': '\u026C', '\uA7B0': '\u029E', '\uA7B1': '\u0287', '\uFF21': '\uFF41', '\uFF22': '\uFF42', '\uFF23': '\uFF43', '\uFF24': '\uFF44', '\uFF25': '\uFF45', '\uFF26': '\uFF46', '\uFF27': '\uFF47', '\uFF28': '\uFF48', '\uFF29': '\uFF49', '\uFF2A': '\uFF4A', '\uFF2B': '\uFF4B', '\uFF2C': '\uFF4C', '\uFF2D': '\uFF4D', '\uFF2E': '\uFF4E', '\uFF2F': '\uFF4F', '\uFF30': '\uFF50', '\uFF31': '\uFF51', '\uFF32': '\uFF52', '\uFF33': '\uFF53', '\uFF34': '\uFF54', '\uFF35': '\uFF55', '\uFF36': '\uFF56', '\uFF37': '\uFF57', '\uFF38': '\uFF58', '\uFF39': '\uFF59', '\uFF3A': '\uFF5A', '\uD801\uDC00': '\uD801\uDC28', '\uD801\uDC01': '\uD801\uDC29', '\uD801\uDC02': '\uD801\uDC2A', '\uD801\uDC03': '\uD801\uDC2B', '\uD801\uDC04': '\uD801\uDC2C', '\uD801\uDC05': '\uD801\uDC2D', '\uD801\uDC06': '\uD801\uDC2E', '\uD801\uDC07': '\uD801\uDC2F', '\uD801\uDC08': '\uD801\uDC30', '\uD801\uDC09': '\uD801\uDC31', '\uD801\uDC0A': '\uD801\uDC32', '\uD801\uDC0B': '\uD801\uDC33', '\uD801\uDC0C': '\uD801\uDC34', '\uD801\uDC0D': '\uD801\uDC35', '\uD801\uDC0E': '\uD801\uDC36', '\uD801\uDC0F': '\uD801\uDC37', '\uD801\uDC10': '\uD801\uDC38', '\uD801\uDC11': '\uD801\uDC39', '\uD801\uDC12': '\uD801\uDC3A', '\uD801\uDC13': '\uD801\uDC3B', '\uD801\uDC14': '\uD801\uDC3C', '\uD801\uDC15': '\uD801\uDC3D', '\uD801\uDC16': '\uD801\uDC3E', '\uD801\uDC17': '\uD801\uDC3F', '\uD801\uDC18': '\uD801\uDC40', '\uD801\uDC19': '\uD801\uDC41', '\uD801\uDC1A': '\uD801\uDC42', '\uD801\uDC1B': '\uD801\uDC43', '\uD801\uDC1C': '\uD801\uDC44', '\uD801\uDC1D': '\uD801\uDC45', '\uD801\uDC1E': '\uD801\uDC46', '\uD801\uDC1F': '\uD801\uDC47', '\uD801\uDC20': '\uD801\uDC48', '\uD801\uDC21': '\uD801\uDC49', '\uD801\uDC22': '\uD801\uDC4A', '\uD801\uDC23': '\uD801\uDC4B', '\uD801\uDC24': '\uD801\uDC4C', '\uD801\uDC25': '\uD801\uDC4D', '\uD801\uDC26': '\uD801\uDC4E', '\uD801\uDC27': '\uD801\uDC4F', '\uD806\uDCA0': '\uD806\uDCC0', '\uD806\uDCA1': '\uD806\uDCC1', '\uD806\uDCA2': '\uD806\uDCC2', '\uD806\uDCA3': '\uD806\uDCC3', '\uD806\uDCA4': '\uD806\uDCC4', '\uD806\uDCA5': '\uD806\uDCC5', '\uD806\uDCA6': '\uD806\uDCC6', '\uD806\uDCA7': '\uD806\uDCC7', '\uD806\uDCA8': '\uD806\uDCC8', '\uD806\uDCA9': '\uD806\uDCC9', '\uD806\uDCAA': '\uD806\uDCCA', '\uD806\uDCAB': '\uD806\uDCCB', '\uD806\uDCAC': '\uD806\uDCCC', '\uD806\uDCAD': '\uD806\uDCCD', '\uD806\uDCAE': '\uD806\uDCCE', '\uD806\uDCAF': '\uD806\uDCCF', '\uD806\uDCB0': '\uD806\uDCD0', '\uD806\uDCB1': '\uD806\uDCD1', '\uD806\uDCB2': '\uD806\uDCD2', '\uD806\uDCB3': '\uD806\uDCD3', '\uD806\uDCB4': '\uD806\uDCD4', '\uD806\uDCB5': '\uD806\uDCD5', '\uD806\uDCB6': '\uD806\uDCD6', '\uD806\uDCB7': '\uD806\uDCD7', '\uD806\uDCB8': '\uD806\uDCD8', '\uD806\uDCB9': '\uD806\uDCD9', '\uD806\uDCBA': '\uD806\uDCDA', '\uD806\uDCBB': '\uD806\uDCDB', '\uD806\uDCBC': '\uD806\uDCDC', '\uD806\uDCBD': '\uD806\uDCDD', '\uD806\uDCBE': '\uD806\uDCDE', '\uD806\uDCBF': '\uD806\uDCDF', '\xDF': 'ss', '\u0130': 'i\u0307', '\u0149': '\u02BCn', '\u01F0': 'j\u030C', '\u0390': '\u03B9\u0308\u0301', '\u03B0': '\u03C5\u0308\u0301', '\u0587': '\u0565\u0582', '\u1E96': 'h\u0331', '\u1E97': 't\u0308', '\u1E98': 'w\u030A', '\u1E99': 'y\u030A', '\u1E9A': 'a\u02BE', '\u1E9E': 'ss', '\u1F50': '\u03C5\u0313', '\u1F52': '\u03C5\u0313\u0300', '\u1F54': '\u03C5\u0313\u0301', '\u1F56': '\u03C5\u0313\u0342', '\u1F80': '\u1F00\u03B9', '\u1F81': '\u1F01\u03B9', '\u1F82': '\u1F02\u03B9', '\u1F83': '\u1F03\u03B9', '\u1F84': '\u1F04\u03B9', '\u1F85': '\u1F05\u03B9', '\u1F86': '\u1F06\u03B9', '\u1F87': '\u1F07\u03B9', '\u1F88': '\u1F00\u03B9', '\u1F89': '\u1F01\u03B9', '\u1F8A': '\u1F02\u03B9', '\u1F8B': '\u1F03\u03B9', '\u1F8C': '\u1F04\u03B9', '\u1F8D': '\u1F05\u03B9', '\u1F8E': '\u1F06\u03B9', '\u1F8F': '\u1F07\u03B9', '\u1F90': '\u1F20\u03B9', '\u1F91': '\u1F21\u03B9', '\u1F92': '\u1F22\u03B9', '\u1F93': '\u1F23\u03B9', '\u1F94': '\u1F24\u03B9', '\u1F95': '\u1F25\u03B9', '\u1F96': '\u1F26\u03B9', '\u1F97': '\u1F27\u03B9', '\u1F98': '\u1F20\u03B9', '\u1F99': '\u1F21\u03B9', '\u1F9A': '\u1F22\u03B9', '\u1F9B': '\u1F23\u03B9', '\u1F9C': '\u1F24\u03B9', '\u1F9D': '\u1F25\u03B9', '\u1F9E': '\u1F26\u03B9', '\u1F9F': '\u1F27\u03B9', '\u1FA0': '\u1F60\u03B9', '\u1FA1': '\u1F61\u03B9', '\u1FA2': '\u1F62\u03B9', '\u1FA3': '\u1F63\u03B9', '\u1FA4': '\u1F64\u03B9', '\u1FA5': '\u1F65\u03B9', '\u1FA6': '\u1F66\u03B9', '\u1FA7': '\u1F67\u03B9', '\u1FA8': '\u1F60\u03B9', '\u1FA9': '\u1F61\u03B9', '\u1FAA': '\u1F62\u03B9', '\u1FAB': '\u1F63\u03B9', '\u1FAC': '\u1F64\u03B9', '\u1FAD': '\u1F65\u03B9', '\u1FAE': '\u1F66\u03B9', '\u1FAF': '\u1F67\u03B9', '\u1FB2': '\u1F70\u03B9', '\u1FB3': '\u03B1\u03B9', '\u1FB4': '\u03AC\u03B9', '\u1FB6': '\u03B1\u0342', '\u1FB7': '\u03B1\u0342\u03B9', '\u1FBC': '\u03B1\u03B9', '\u1FC2': '\u1F74\u03B9', '\u1FC3': '\u03B7\u03B9', '\u1FC4': '\u03AE\u03B9', '\u1FC6': '\u03B7\u0342', '\u1FC7': '\u03B7\u0342\u03B9', '\u1FCC': '\u03B7\u03B9', '\u1FD2': '\u03B9\u0308\u0300', '\u1FD3': '\u03B9\u0308\u0301', '\u1FD6': '\u03B9\u0342', '\u1FD7': '\u03B9\u0308\u0342', '\u1FE2': '\u03C5\u0308\u0300', '\u1FE3': '\u03C5\u0308\u0301', '\u1FE4': '\u03C1\u0313', '\u1FE6': '\u03C5\u0342', '\u1FE7': '\u03C5\u0308\u0342', '\u1FF2': '\u1F7C\u03B9', '\u1FF3': '\u03C9\u03B9', '\u1FF4': '\u03CE\u03B9', '\u1FF6': '\u03C9\u0342', '\u1FF7': '\u03C9\u0342\u03B9', '\u1FFC': '\u03C9\u03B9', '\uFB00': 'ff', '\uFB01': 'fi', '\uFB02': 'fl', '\uFB03': 'ffi', '\uFB04': 'ffl', '\uFB05': 'st', '\uFB06': 'st', '\uFB13': '\u0574\u0576', '\uFB14': '\u0574\u0565', '\uFB15': '\u0574\u056B', '\uFB16': '\u057E\u0576', '\uFB17': '\u0574\u056D' }; | |
// Normalize reference label: collapse internal whitespace | |
// to single space, remove leading/trailing whitespace, case fold. | |
module.exports = function (string) { | |
return string.slice(1, string.length - 1).trim().replace(regex, function ($0) { | |
// Note: there is no need to check `hasOwnProperty($0)` here. | |
// If character not found in lookup table, it must be whitespace. | |
return map[$0] || ' '; | |
}); | |
}; | |
/***/ }), | |
/* 100 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
"use strict"; | |
var escapeXml = __webpack_require__(17).escapeXml; | |
// Helper function to produce an XML tag. | |
var tag = function tag(name, attrs, selfclosing) { | |
var result = '<' + name; | |
if (attrs && attrs.length > 0) { | |
var i = 0; | |
var attrib; | |
while ((attrib = attrs[i]) !== undefined) { | |
result += ' ' + attrib[0] + '="' + attrib[1] + '"'; | |
i++; | |
} | |
} | |
if (selfclosing) { | |
result += ' /'; | |
} | |
result += '>'; | |
return result; | |
}; | |
var reXMLTag = /\<[^>]*\>/; | |
var toTagName = function toTagName(s) { | |
return s.replace(/([a-z])([A-Z])/g, "$1_$2").toLowerCase(); | |
}; | |
var renderNodes = function renderNodes(block) { | |
var attrs; | |
var tagname; | |
var walker = block.walker(); | |
var event, node, entering; | |
var buffer = ""; | |
var lastOut = "\n"; | |
var disableTags = 0; | |
var indentLevel = 0; | |
var indent = ' '; | |
var container; | |
var selfClosing; | |
var nodetype; | |
var out = function out(s) { | |
if (disableTags > 0) { | |
buffer += s.replace(reXMLTag, ''); | |
} else { | |
buffer += s; | |
} | |
lastOut = s; | |
}; | |
var esc = this.escape; | |
var cr = function cr() { | |
if (lastOut !== '\n') { | |
buffer += '\n'; | |
lastOut = '\n'; | |
for (var i = indentLevel; i > 0; i--) { | |
buffer += indent; | |
} | |
} | |
}; | |
var options = this.options; | |
if (options.time) { | |
console.time("rendering"); | |
} | |
buffer += '<?xml version="1.0" encoding="UTF-8"?>\n'; | |
buffer += '<!DOCTYPE CommonMark SYSTEM "CommonMark.dtd">\n'; | |
while (event = walker.next()) { | |
entering = event.entering; | |
node = event.node; | |
nodetype = node.type; | |
container = node.isContainer; | |
selfClosing = nodetype === 'ThematicBreak' || nodetype === 'Hardbreak' || nodetype === 'Softbreak'; | |
tagname = toTagName(nodetype); | |
if (entering) { | |
attrs = []; | |
switch (nodetype) { | |
case 'Document': | |
attrs.push(['xmlns', 'http://commonmark.org/xml/1.0']); | |
break; | |
case 'List': | |
if (node.listType !== null) { | |
attrs.push(['type', node.listType.toLowerCase()]); | |
} | |
if (node.listStart !== null) { | |
attrs.push(['start', String(node.listStart)]); | |
} | |
if (node.listTight !== null) { | |
attrs.push(['tight', node.listTight ? 'true' : 'false']); | |
} | |
var delim = node.listDelimiter; | |
if (delim !== null) { | |
var delimword = ''; | |
if (delim === '.') { | |
delimword = 'period'; | |
} else { | |
delimword = 'paren'; | |
} | |
attrs.push(['delimiter', delimword]); | |
} | |
break; | |
case 'CodeBlock': | |
if (node.info) { | |
attrs.push(['info', node.info]); | |
} | |
break; | |
case 'Heading': | |
attrs.push(['level', String(node.level)]); | |
break; | |
case 'Link': | |
case 'Image': | |
attrs.push(['destination', node.destination]); | |
attrs.push(['title', node.title]); | |
break; | |
case 'CustomInline': | |
case 'CustomBlock': | |
attrs.push(['on_enter', node.onEnter]); | |
attrs.push(['on_exit', node.onExit]); | |
break; | |
default: | |
break; | |
} | |
if (options.sourcepos) { | |
var pos = node.sourcepos; | |
if (pos) { | |
attrs.push(['sourcepos', String(pos[0][0]) + ':' + String(pos[0][1]) + '-' + String(pos[1][0]) + ':' + String(pos[1][1])]); | |
} | |
} | |
cr(); | |
out(tag(tagname, attrs, selfClosing)); | |
if (container) { | |
indentLevel += 1; | |
} else if (!container && !selfClosing) { | |
var lit = node.literal; | |
if (lit) { | |
out(esc(lit)); | |
} | |
out(tag('/' + tagname)); | |
} | |
} else { | |
indentLevel -= 1; | |
cr(); | |
out(tag('/' + tagname)); | |
} | |
} | |
if (options.time) { | |
console.timeEnd("rendering"); | |
} | |
buffer += '\n'; | |
return buffer; | |
}; | |
// The XmlRenderer object. | |
function XmlRenderer(options) { | |
return { | |
// default options: | |
softbreak: '\n', // by default, soft breaks are rendered as newlines in HTML | |
// set to "<br />" to make them hard breaks | |
// set to " " if you want to ignore line wrapping in source | |
escape: escapeXml, | |
options: options || {}, | |
render: renderNodes | |
}; | |
} | |
module.exports = XmlRenderer; | |
/***/ }), | |
/* 101 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
"use strict"; | |
/* WEBPACK VAR INJECTION */(function(process) {/** | |
* Copyright 2013-present, Facebook, Inc. | |
* All rights reserved. | |
* | |
* This source code is licensed under the BSD-style license found in the | |
* LICENSE file in the root directory of this source tree. An additional grant | |
* of patent rights can be found in the PATENTS file in the same directory. | |
* | |
*/ | |
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; | |
var _assign = __webpack_require__(4); | |
var emptyObject = __webpack_require__(27); | |
var _invariant = __webpack_require__(1); | |
if (process.env.NODE_ENV !== 'production') { | |
var warning = __webpack_require__(2); | |
} | |
var MIXINS_KEY = 'mixins'; | |
// Helper function to allow the creation of anonymous functions which do not | |
// have .name set to the name of the variable being assigned to. | |
function identity(fn) { | |
return fn; | |
} | |
var ReactPropTypeLocationNames; | |
if (process.env.NODE_ENV !== 'production') { | |
ReactPropTypeLocationNames = { | |
prop: 'prop', | |
context: 'context', | |
childContext: 'child context' | |
}; | |
} else { | |
ReactPropTypeLocationNames = {}; | |
} | |
function factory(ReactComponent, isValidElement, ReactNoopUpdateQueue) { | |
/** | |
* Policies that describe methods in `ReactClassInterface`. | |
*/ | |
var injectedMixins = []; | |
/** | |
* Composite components are higher-level components that compose other composite | |
* or host components. | |
* | |
* To create a new type of `ReactClass`, pass a specification of | |
* your new class to `React.createClass`. The only requirement of your class | |
* specification is that you implement a `render` method. | |
* | |
* var MyComponent = React.createClass({ | |
* render: function() { | |
* return <div>Hello World</div>; | |
* } | |
* }); | |
* | |
* The class specification supports a specific protocol of methods that have | |
* special meaning (e.g. `render`). See `ReactClassInterface` for | |
* more the comprehensive protocol. Any other properties and methods in the | |
* class specification will be available on the prototype. | |
* | |
* @interface ReactClassInterface | |
* @internal | |
*/ | |
var ReactClassInterface = { | |
/** | |
* An array of Mixin objects to include when defining your component. | |
* | |
* @type {array} | |
* @optional | |
*/ | |
mixins: 'DEFINE_MANY', | |
/** | |
* An object containing properties and methods that should be defined on | |
* the component's constructor instead of its prototype (static methods). | |
* | |
* @type {object} | |
* @optional | |
*/ | |
statics: 'DEFINE_MANY', | |
/** | |
* Definition of prop types for this component. | |
* | |
* @type {object} | |
* @optional | |
*/ | |
propTypes: 'DEFINE_MANY', | |
/** | |
* Definition of context types for this component. | |
* | |
* @type {object} | |
* @optional | |
*/ | |
contextTypes: 'DEFINE_MANY', | |
/** | |
* Definition of context types this component sets for its children. | |
* | |
* @type {object} | |
* @optional | |
*/ | |
childContextTypes: 'DEFINE_MANY', | |
// ==== Definition methods ==== | |
/** | |
* Invoked when the component is mounted. Values in the mapping will be set on | |
* `this.props` if that prop is not specified (i.e. using an `in` check). | |
* | |
* This method is invoked before `getInitialState` and therefore cannot rely | |
* on `this.state` or use `this.setState`. | |
* | |
* @return {object} | |
* @optional | |
*/ | |
getDefaultProps: 'DEFINE_MANY_MERGED', | |
/** | |
* Invoked once before the component is mounted. The return value will be used | |
* as the initial value of `this.state`. | |
* | |
* getInitialState: function() { | |
* return { | |
* isOn: false, | |
* fooBaz: new BazFoo() | |
* } | |
* } | |
* | |
* @return {object} | |
* @optional | |
*/ | |
getInitialState: 'DEFINE_MANY_MERGED', | |
/** | |
* @return {object} | |
* @optional | |
*/ | |
getChildContext: 'DEFINE_MANY_MERGED', | |
/** | |
* Uses props from `this.props` and state from `this.state` to render the | |
* structure of the component. | |
* | |
* No guarantees are made about when or how often this method is invoked, so | |
* it must not have side effects. | |
* | |
* render: function() { | |
* var name = this.props.name; | |
* return <div>Hello, {name}!</div>; | |
* } | |
* | |
* @return {ReactComponent} | |
* @required | |
*/ | |
render: 'DEFINE_ONCE', | |
// ==== Delegate methods ==== | |
/** | |
* Invoked when the component is initially created and about to be mounted. | |
* This may have side effects, but any external subscriptions or data created | |
* by this method must be cleaned up in `componentWillUnmount`. | |
* | |
* @optional | |
*/ | |
componentWillMount: 'DEFINE_MANY', | |
/** | |
* Invoked when the component has been mounted and has a DOM representation. | |
* However, there is no guarantee that the DOM node is in the document. | |
* | |
* Use this as an opportunity to operate on the DOM when the component has | |
* been mounted (initialized and rendered) for the first time. | |
* | |
* @param {DOMElement} rootNode DOM element representing the component. | |
* @optional | |
*/ | |
componentDidMount: 'DEFINE_MANY', | |
/** | |
* Invoked before the component receives new props. | |
* | |
* Use this as an opportunity to react to a prop transition by updating the | |
* state using `this.setState`. Current props are accessed via `this.props`. | |
* | |
* componentWillReceiveProps: function(nextProps, nextContext) { | |
* this.setState({ | |
* likesIncreasing: nextProps.likeCount > this.props.likeCount | |
* }); | |
* } | |
* | |
* NOTE: There is no equivalent `componentWillReceiveState`. An incoming prop | |
* transition may cause a state change, but the opposite is not true. If you | |
* need it, you are probably looking for `componentWillUpdate`. | |
* | |
* @param {object} nextProps | |
* @optional | |
*/ | |
componentWillReceiveProps: 'DEFINE_MANY', | |
/** | |
* Invoked while deciding if the component should be updated as a result of | |
* receiving new props, state and/or context. | |
* | |
* Use this as an opportunity to `return false` when you're certain that the | |
* transition to the new props/state/context will not require a component | |
* update. | |
* | |
* shouldComponentUpdate: function(nextProps, nextState, nextContext) { | |
* return !equal(nextProps, this.props) || | |
* !equal(nextState, this.state) || | |
* !equal(nextContext, this.context); | |
* } | |
* | |
* @param {object} nextProps | |
* @param {?object} nextState | |
* @param {?object} nextContext | |
* @return {boolean} True if the component should update. | |
* @optional | |
*/ | |
shouldComponentUpdate: 'DEFINE_ONCE', | |
/** | |
* Invoked when the component is about to update due to a transition from | |
* `this.props`, `this.state` and `this.context` to `nextProps`, `nextState` | |
* and `nextContext`. | |
* | |
* Use this as an opportunity to perform preparation before an update occurs. | |
* | |
* NOTE: You **cannot** use `this.setState()` in this method. | |
* | |
* @param {object} nextProps | |
* @param {?object} nextState | |
* @param {?object} nextContext | |
* @param {ReactReconcileTransaction} transaction | |
* @optional | |
*/ | |
componentWillUpdate: 'DEFINE_MANY', | |
/** | |
* Invoked when the component's DOM representation has been updated. | |
* | |
* Use this as an opportunity to operate on the DOM when the component has | |
* been updated. | |
* | |
* @param {object} prevProps | |
* @param {?object} prevState | |
* @param {?object} prevContext | |
* @param {DOMElement} rootNode DOM element representing the component. | |
* @optional | |
*/ | |
componentDidUpdate: 'DEFINE_MANY', | |
/** | |
* Invoked when the component is about to be removed from its parent and have | |
* its DOM representation destroyed. | |
* | |
* Use this as an opportunity to deallocate any external resources. | |
* | |
* NOTE: There is no `componentDidUnmount` since your component will have been | |
* destroyed by that point. | |
* | |
* @optional | |
*/ | |
componentWillUnmount: 'DEFINE_MANY', | |
// ==== Advanced methods ==== | |
/** | |
* Updates the component's currently mounted DOM representation. | |
* | |
* By default, this implements React's rendering and reconciliation algorithm. | |
* Sophisticated clients may wish to override this. | |
* | |
* @param {ReactReconcileTransaction} transaction | |
* @internal | |
* @overridable | |
*/ | |
updateComponent: 'OVERRIDE_BASE' | |
}; | |
/** | |
* Mapping from class specification keys to special processing functions. | |
* | |
* Although these are declared like instance properties in the specification | |
* when defining classes using `React.createClass`, they are actually static | |
* and are accessible on the constructor instead of the prototype. Despite | |
* being static, they must be defined outside of the "statics" key under | |
* which all other static methods are defined. | |
*/ | |
var RESERVED_SPEC_KEYS = { | |
displayName: function displayName(Constructor, _displayName) { | |
Constructor.displayName = _displayName; | |
}, | |
mixins: function mixins(Constructor, _mixins) { | |
if (_mixins) { | |
for (var i = 0; i < _mixins.length; i++) { | |
mixSpecIntoComponent(Constructor, _mixins[i]); | |
} | |
} | |
}, | |
childContextTypes: function childContextTypes(Constructor, _childContextTypes) { | |
if (process.env.NODE_ENV !== 'production') { | |
validateTypeDef(Constructor, _childContextTypes, 'childContext'); | |
} | |
Constructor.childContextTypes = _assign({}, Constructor.childContextTypes, _childContextTypes); | |
}, | |
contextTypes: function contextTypes(Constructor, _contextTypes) { | |
if (process.env.NODE_ENV !== 'production') { | |
validateTypeDef(Constructor, _contextTypes, 'context'); | |
} | |
Constructor.contextTypes = _assign({}, Constructor.contextTypes, _contextTypes); | |
}, | |
/** | |
* Special case getDefaultProps which should move into statics but requires | |
* automatic merging. | |
*/ | |
getDefaultProps: function getDefaultProps(Constructor, _getDefaultProps) { | |
if (Constructor.getDefaultProps) { | |
Constructor.getDefaultProps = createMergedResultFunction(Constructor.getDefaultProps, _getDefaultProps); | |
} else { | |
Constructor.getDefaultProps = _getDefaultProps; | |
} | |
}, | |
propTypes: function propTypes(Constructor, _propTypes) { | |
if (process.env.NODE_ENV !== 'production') { | |
validateTypeDef(Constructor, _propTypes, 'prop'); | |
} | |
Constructor.propTypes = _assign({}, Constructor.propTypes, _propTypes); | |
}, | |
statics: function statics(Constructor, _statics) { | |
mixStaticSpecIntoComponent(Constructor, _statics); | |
}, | |
autobind: function autobind() {} | |
}; | |
function validateTypeDef(Constructor, typeDef, location) { | |
for (var propName in typeDef) { | |
if (typeDef.hasOwnProperty(propName)) { | |
// use a warning instead of an _invariant so components | |
// don't show up in prod but only in __DEV__ | |
if (process.env.NODE_ENV !== 'production') { | |
warning(typeof typeDef[propName] === 'function', '%s: %s type `%s` is invalid; it must be a function, usually from ' + 'React.PropTypes.', Constructor.displayName || 'ReactClass', ReactPropTypeLocationNames[location], propName); | |
} | |
} | |
} | |
} | |
function validateMethodOverride(isAlreadyDefined, name) { | |
var specPolicy = ReactClassInterface.hasOwnProperty(name) ? ReactClassInterface[name] : null; | |
// Disallow overriding of base class methods unless explicitly allowed. | |
if (ReactClassMixin.hasOwnProperty(name)) { | |
_invariant(specPolicy === 'OVERRIDE_BASE', 'ReactClassInterface: You are attempting to override ' + '`%s` from your class specification. Ensure that your method names ' + 'do not overlap with React methods.', name); | |
} | |
// Disallow defining methods more than once unless explicitly allowed. | |
if (isAlreadyDefined) { | |
_invariant(specPolicy === 'DEFINE_MANY' || specPolicy === 'DEFINE_MANY_MERGED', 'ReactClassInterface: You are attempting to define ' + '`%s` on your component more than once. This conflict may be due ' + 'to a mixin.', name); | |
} | |
} | |
/** | |
* Mixin helper which handles policy validation and reserved | |
* specification keys when building React classes. | |
*/ | |
function mixSpecIntoComponent(Constructor, spec) { | |
if (!spec) { | |
if (process.env.NODE_ENV !== 'production') { | |
var typeofSpec = typeof spec === 'undefined' ? 'undefined' : _typeof(spec); | |
var isMixinValid = typeofSpec === 'object' && spec !== null; | |
if (process.env.NODE_ENV !== '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); | |
} | |
} | |
return; | |
} | |
_invariant(typeof spec !== 'function', "ReactClass: You're attempting to " + 'use a component class or function as a mixin. Instead, just use a ' + 'regular object.'); | |
_invariant(!isValidElement(spec), "ReactClass: You're attempting to " + 'use a component as a mixin. Instead, just use a regular object.'); | |
var proto = Constructor.prototype; | |
var autoBindPairs = proto.__reactAutoBindPairs; | |
// By handling mixins before any other properties, we ensure the same | |
// chaining order is applied to methods with DEFINE_MANY policy, whether | |
// mixins are listed before or after these methods in the spec. | |
if (spec.hasOwnProperty(MIXINS_KEY)) { | |
RESERVED_SPEC_KEYS.mixins(Constructor, spec.mixins); | |
} | |
for (var name in spec) { | |
if (!spec.hasOwnProperty(name)) { | |
continue; | |
} | |
if (name === MIXINS_KEY) { | |
// We have already handled mixins in a special case above. | |
continue; | |
} | |
var property = spec[name]; | |
var isAlreadyDefined = proto.hasOwnProperty(name); | |
validateMethodOverride(isAlreadyDefined, name); | |
if (RESERVED_SPEC_KEYS.hasOwnProperty(name)) { | |
RESERVED_SPEC_KEYS[name](Constructor, property); | |
} else { | |
// Setup methods on prototype: | |
// The following member methods should not be automatically bound: | |
// 1. Expected ReactClass methods (in the "interface"). | |
// 2. Overridden methods (that were mixed in). | |
var isReactClassMethod = ReactClassInterface.hasOwnProperty(name); | |
var isFunction = typeof property === 'function'; | |
var shouldAutoBind = isFunction && !isReactClassMethod && !isAlreadyDefined && spec.autobind !== false; | |
if (shouldAutoBind) { | |
autoBindPairs.push(name, property); | |
proto[name] = property; | |
} else { | |
if (isAlreadyDefined) { | |
var specPolicy = ReactClassInterface[name]; | |
// These cases should already be caught by validateMethodOverride. | |
_invariant(isReactClassMethod && (specPolicy === 'DEFINE_MANY_MERGED' || specPolicy === 'DEFINE_MANY'), 'ReactClass: Unexpected spec policy %s for key %s ' + 'when mixing in component specs.', specPolicy, name); | |
// For methods which are defined more than once, call the existing | |
// methods before calling the new property, merging if appropriate. | |
if (specPolicy === 'DEFINE_MANY_MERGED') { | |
proto[name] = createMergedResultFunction(proto[name], property); | |
} else if (specPolicy === 'DEFINE_MANY') { | |
proto[name] = createChainedFunction(proto[name], property); | |
} | |
} else { | |
proto[name] = property; | |
if (process.env.NODE_ENV !== 'production') { | |
// Add verbose displayName to the function, which helps when looking | |
// at profiling tools. | |
if (typeof property === 'function' && spec.displayName) { | |
proto[name].displayName = spec.displayName + '_' + name; | |
} | |
} | |
} | |
} | |
} | |
} | |
} | |
function mixStaticSpecIntoComponent(Constructor, statics) { | |
if (!statics) { | |
return; | |
} | |
for (var name in statics) { | |
var property = statics[name]; | |
if (!statics.hasOwnProperty(name)) { | |
continue; | |
} | |
var isReserved = name in RESERVED_SPEC_KEYS; | |
_invariant(!isReserved, '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); | |
var isInherited = name in Constructor; | |
_invariant(!isInherited, 'ReactClass: You are attempting to define ' + '`%s` on your component more than once. This conflict may be ' + 'due to a mixin.', name); | |
Constructor[name] = property; | |
} | |
} | |
/** | |
* Merge two objects, but throw if both contain the same key. | |
* | |
* @param {object} one The first object, which is mutated. | |
* @param {object} two The second object | |
* @return {object} one after it has been mutated to contain everything in two. | |
*/ | |
function mergeIntoWithNoDuplicateKeys(one, two) { | |
_invariant(one && two && (typeof one === 'undefined' ? 'undefined' : _typeof(one)) === 'object' && (typeof two === 'undefined' ? 'undefined' : _typeof(two)) === 'object', 'mergeIntoWithNoDuplicateKeys(): Cannot merge non-objects.'); | |
for (var key in two) { | |
if (two.hasOwnProperty(key)) { | |
_invariant(one[key] === undefined, '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); | |
one[key] = two[key]; | |
} | |
} | |
return one; | |
} | |
/** | |
* Creates a function that invokes two functions and merges their return values. | |
* | |
* @param {function} one Function to invoke first. | |
* @param {function} two Function to invoke second. | |
* @return {function} Function that invokes the two argument functions. | |
* @private | |
*/ | |
function createMergedResultFunction(one, two) { | |
return function mergedResult() { | |
var a = one.apply(this, arguments); | |
var b = two.apply(this, arguments); | |
if (a == null) { | |
return b; | |
} else if (b == null) { | |
return a; | |
} | |
var c = {}; | |
mergeIntoWithNoDuplicateKeys(c, a); | |
mergeIntoWithNoDuplicateKeys(c, b); | |
return c; | |
}; | |
} | |
/** | |
* Creates a function that invokes two functions and ignores their return vales. | |
* | |
* @param {function} one Function to invoke first. | |
* @param {function} two Function to invoke second. | |
* @return {function} Function that invokes the two argument functions. | |
* @private | |
*/ | |
function createChainedFunction(one, two) { | |
return function chainedFunction() { | |
one.apply(this, arguments); | |
two.apply(this, arguments); | |
}; | |
} | |
/** | |
* Binds a method to the component. | |
* | |
* @param {object} component Component whose method is going to be bound. | |
* @param {function} method Method to be bound. | |
* @return {function} The bound method. | |
*/ | |
function bindAutoBindMethod(component, method) { | |
var boundMethod = method.bind(component); | |
if (process.env.NODE_ENV !== 'production') { | |
boundMethod.__reactBoundContext = component; | |
boundMethod.__reactBoundMethod = method; | |
boundMethod.__reactBoundArguments = null; | |
var componentName = component.constructor.displayName; | |
var _bind = boundMethod.bind; | |
boundMethod.bind = function (newThis) { | |
for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { | |
args[_key - 1] = arguments[_key]; | |
} | |
// User is trying to bind() an autobound method; we effectively will | |
// ignore the value of "this" that the user is trying to use, so | |
// let's warn. | |
if (newThis !== component && newThis !== null) { | |
if (process.env.NODE_ENV !== 'production') { | |
warning(false, 'bind(): React component methods may only be bound to the ' + 'component instance. See %s', componentName); | |
} | |
} else if (!args.length) { | |
if (process.env.NODE_ENV !== 'production') { | |
warning(false, 'bind(): You are binding a component method to the component. ' + 'React does this for you automatically in a high-performance ' + 'way, so you can safely remove this call. See %s', componentName); | |
} | |
return boundMethod; | |
} | |
var reboundMethod = _bind.apply(boundMethod, arguments); | |
reboundMethod.__reactBoundContext = component; | |
reboundMethod.__reactBoundMethod = method; | |
reboundMethod.__reactBoundArguments = args; | |
return reboundMethod; | |
}; | |
} | |
return boundMethod; | |
} | |
/** | |
* Binds all auto-bound methods in a component. | |
* | |
* @param {object} component Component whose method is going to be bound. | |
*/ | |
function bindAutoBindMethods(component) { | |
var pairs = component.__reactAutoBindPairs; | |
for (var i = 0; i < pairs.length; i += 2) { | |
var autoBindKey = pairs[i]; | |
var method = pairs[i + 1]; | |
component[autoBindKey] = bindAutoBindMethod(component, method); | |
} | |
} | |
var IsMountedPreMixin = { | |
componentDidMount: function componentDidMount() { | |
this.__isMounted = true; | |
} | |
}; | |
var IsMountedPostMixin = { | |
componentWillUnmount: function componentWillUnmount() { | |
this.__isMounted = false; | |
} | |
}; | |
/** | |
* Add more to the ReactClass base class. These are all legacy features and | |
* therefore not already part of the modern ReactComponent. | |
*/ | |
var ReactClassMixin = { | |
/** | |
* TODO: This will be deprecated because state should always keep a consistent | |
* type signature and the only use case for this, is to avoid that. | |
*/ | |
replaceState: function replaceState(newState, callback) { | |
this.updater.enqueueReplaceState(this, newState, callback); | |
}, | |
/** | |
* Checks whether or not this composite component is mounted. | |
* @return {boolean} True if mounted, false otherwise. | |
* @protected | |
* @final | |
*/ | |
isMounted: function isMounted() { | |
if (process.env.NODE_ENV !== 'production') { | |
warning(this.__didWarnIsMounted, '%s: isMounted is deprecated. Instead, make sure to clean up ' + 'subscriptions and pending requests in componentWillUnmount to ' + 'prevent memory leaks.', this.constructor && this.constructor.displayName || this.name || 'Component'); | |
this.__didWarnIsMounted = true; | |
} | |
return !!this.__isMounted; | |
} | |
}; | |
var ReactClassComponent = function ReactClassComponent() {}; | |
_assign(ReactClassComponent.prototype, ReactComponent.prototype, ReactClassMixin); | |
/** | |
* Creates a composite component class given a class specification. | |
* See https://facebook.github.io/react/docs/top-level-api.html#react.createclass | |
* | |
* @param {object} spec Class specification (which must define `render`). | |
* @return {function} Component constructor function. | |
* @public | |
*/ | |
function createClass(spec) { | |
// To keep our warnings more understandable, we'll use a little hack here to | |
// ensure that Constructor.name !== 'Constructor'. This makes sure we don't | |
// unnecessarily identify a class without displayName as 'Constructor'. | |
var Constructor = identity(function (props, context, updater) { | |
// This constructor gets overridden by mocks. The argument is used | |
// by mocks to assert on what gets mounted. | |
if (process.env.NODE_ENV !== 'production') { | |
warning(this instanceof Constructor, 'Something is calling a React component directly. Use a factory or ' + 'JSX instead. See: https://fb.me/react-legacyfactory'); | |
} | |
// Wire up auto-binding | |
if (this.__reactAutoBindPairs.length) { | |
bindAutoBindMethods(this); | |
} | |
this.props = props; | |
this.context = context; | |
this.refs = emptyObject; | |
this.updater = updater || ReactNoopUpdateQueue; | |
this.state = null; | |
// ReactClasses doesn't have constructors. Instead, they use the | |
// getInitialState and componentWillMount methods for initialization. | |
var initialState = this.getInitialState ? this.getInitialState() : null; | |
if (process.env.NODE_ENV !== 'production') { | |
// We allow auto-mocks to proceed as if they're returning null. | |
if (initialState === undefined && this.getInitialState._isMockFunction) { | |
// This is probably bad practice. Consider warning here and | |
// deprecating this convenience. | |
initialState = null; | |
} | |
} | |
_invariant((typeof initialState === 'undefined' ? 'undefined' : _typeof(initialState)) === 'object' && !Array.isArray(initialState), '%s.getInitialState(): must return an object or null', Constructor.displayName || 'ReactCompositeComponent'); | |
this.state = initialState; | |
}); | |
Constructor.prototype = new ReactClassComponent(); | |
Constructor.prototype.constructor = Constructor; | |
Constructor.prototype.__reactAutoBindPairs = []; | |
injectedMixins.forEach(mixSpecIntoComponent.bind(null, Constructor)); | |
mixSpecIntoComponent(Constructor, IsMountedPreMixin); | |
mixSpecIntoComponent(Constructor, spec); | |
mixSpecIntoComponent(Constructor, IsMountedPostMixin); | |
// Initialize the defaultProps property after all mixins have been merged. | |
if (Constructor.getDefaultProps) { | |
Constructor.defaultProps = Constructor.getDefaultProps(); | |
} | |
if (process.env.NODE_ENV !== 'production') { | |
// This is a tag to indicate that the use of these method names is ok, | |
// since it's used with createClass. If it's not, then it's likely a | |
// mistake so we'll warn you to use the static property, property | |
// initializer or constructor respectively. | |
if (Constructor.getDefaultProps) { | |
Constructor.getDefaultProps.isReactClassApproved = {}; | |
} | |
if (Constructor.prototype.getInitialState) { | |
Constructor.prototype.getInitialState.isReactClassApproved = {}; | |
} | |
} | |
_invariant(Constructor.prototype.render, 'createClass(...): Class specification must implement a `render` method.'); | |
if (process.env.NODE_ENV !== 'production') { | |
warning(!Constructor.prototype.componentShouldUpdate, '%s has a method called ' + 'componentShouldUpdate(). Did you mean shouldComponentUpdate()? ' + 'The name is phrased as a question because the function is ' + 'expected to return a value.', spec.displayName || 'A component'); | |
warning(!Constructor.prototype.componentWillRecieveProps, '%s has a method called ' + 'componentWillRecieveProps(). Did you mean componentWillReceiveProps()?', spec.displayName || 'A component'); | |
} | |
// Reduce time spent doing lookups by setting these on the prototype. | |
for (var methodName in ReactClassInterface) { | |
if (!Constructor.prototype[methodName]) { | |
Constructor.prototype[methodName] = null; | |
} | |
} | |
return Constructor; | |
} | |
return createClass; | |
} | |
module.exports = factory; | |
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0))) | |
/***/ }), | |
/* 102 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
var entityMap = __webpack_require__(90), | |
legacyMap = __webpack_require__(404), | |
xmlMap = __webpack_require__(91), | |
decodeCodePoint = __webpack_require__(103); | |
var decodeXMLStrict = getStrictDecoder(xmlMap), | |
decodeHTMLStrict = getStrictDecoder(entityMap); | |
function getStrictDecoder(map) { | |
var keys = Object.keys(map).join("|"), | |
replace = getReplacer(map); | |
keys += "|#[xX][\\da-fA-F]+|#\\d+"; | |
var re = new RegExp("&(?:" + keys + ");", "g"); | |
return function (str) { | |
return String(str).replace(re, replace); | |
}; | |
} | |
var decodeHTML = function () { | |
var legacy = Object.keys(legacyMap).sort(sorter); | |
var keys = Object.keys(entityMap).sort(sorter); | |
for (var i = 0, j = 0; i < keys.length; i++) { | |
if (legacy[j] === keys[i]) { | |
keys[i] += ";?"; | |
j++; | |
} else { | |
keys[i] += ";"; | |
} | |
} | |
var re = new RegExp("&(?:" + keys.join("|") + "|#[xX][\\da-fA-F]+;?|#\\d+;?)", "g"), | |
replace = getReplacer(entityMap); | |
function replacer(str) { | |
if (str.substr(-1) !== ";") str += ";"; | |
return replace(str); | |
} | |
//TODO consider creating a merged map | |
return function (str) { | |
return String(str).replace(re, replacer); | |
}; | |
}(); | |
function sorter(a, b) { | |
return a < b ? 1 : -1; | |
} | |
function getReplacer(map) { | |
return function replace(str) { | |
if (str.charAt(1) === "#") { | |
if (str.charAt(2) === "X" || str.charAt(2) === "x") { | |
return decodeCodePoint(parseInt(str.substr(3), 16)); | |
} | |
return decodeCodePoint(parseInt(str.substr(2), 10)); | |
} | |
return map[str.slice(1, -1)]; | |
}; | |
} | |
module.exports = { | |
XML: decodeXMLStrict, | |
HTML: decodeHTML, | |
HTMLStrict: decodeHTMLStrict | |
}; | |
/***/ }), | |
/* 103 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
var decodeMap = __webpack_require__(403); | |
module.exports = decodeCodePoint; | |
// modified version of https://github.com/mathiasbynens/he/blob/master/src/he.js#L94-L119 | |
function decodeCodePoint(codePoint) { | |
if (codePoint >= 0xD800 && codePoint <= 0xDFFF || codePoint > 0x10FFFF) { | |
return "\uFFFD"; | |
} | |
if (codePoint in decodeMap) { | |
codePoint = decodeMap[codePoint]; | |
} | |
var output = ""; | |
if (codePoint > 0xFFFF) { | |
codePoint -= 0x10000; | |
output += String.fromCharCode(codePoint >>> 10 & 0x3FF | 0xD800); | |
codePoint = 0xDC00 | codePoint & 0x3FF; | |
} | |
output += String.fromCharCode(codePoint); | |
return output; | |
} | |
/***/ }), | |
/* 104 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
var inverseXML = getInverseObj(__webpack_require__(91)), | |
xmlReplacer = getInverseReplacer(inverseXML); | |
exports.XML = getInverse(inverseXML, xmlReplacer); | |
var inverseHTML = getInverseObj(__webpack_require__(90)), | |
htmlReplacer = getInverseReplacer(inverseHTML); | |
exports.HTML = getInverse(inverseHTML, htmlReplacer); | |
function getInverseObj(obj) { | |
return Object.keys(obj).sort().reduce(function (inverse, name) { | |
inverse[obj[name]] = "&" + name + ";"; | |
return inverse; | |
}, {}); | |
} | |
function getInverseReplacer(inverse) { | |
var single = [], | |
multiple = []; | |
Object.keys(inverse).forEach(function (k) { | |
if (k.length === 1) { | |
single.push("\\" + k); | |
} else { | |
multiple.push(k); | |
} | |
}); | |
//TODO add ranges | |
multiple.unshift("[" + single.join("") + "]"); | |
return new RegExp(multiple.join("|"), "g"); | |
} | |
var re_nonASCII = /[^\0-\x7F]/g, | |
re_astralSymbols = /[\uD800-\uDBFF][\uDC00-\uDFFF]/g; | |
function singleCharReplacer(c) { | |
return "&#x" + c.charCodeAt(0).toString(16).toUpperCase() + ";"; | |
} | |
function astralReplacer(c) { | |
// http://mathiasbynens.be/notes/javascript-encoding#surrogate-formulae | |
var high = c.charCodeAt(0); | |
var low = c.charCodeAt(1); | |
var codePoint = (high - 0xD800) * 0x400 + low - 0xDC00 + 0x10000; | |
return "&#x" + codePoint.toString(16).toUpperCase() + ";"; | |
} | |
function getInverse(inverse, re) { | |
function func(name) { | |
return inverse[name]; | |
} | |
return function (data) { | |
return data.replace(re, func).replace(re_astralSymbols, astralReplacer).replace(re_nonASCII, singleCharReplacer); | |
}; | |
} | |
var re_xmlChars = getInverseReplacer(inverseXML); | |
function escapeXML(data) { | |
return data.replace(re_xmlChars, singleCharReplacer).replace(re_astralSymbols, astralReplacer).replace(re_nonASCII, singleCharReplacer); | |
} | |
exports.escape = escapeXML; | |
/***/ }), | |
/* 105 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
/* WEBPACK VAR INJECTION */(function(process, global) {var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_RESULT__;var require;var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; | |
/*! | |
* @overview es6-promise - a tiny implementation of Promises/A+. | |
* @copyright Copyright (c) 2014 Yehuda Katz, Tom Dale, Stefan Penner and contributors (Conversion to ES6 API by Jake Archibald) | |
* @license Licensed under MIT license | |
* See https://raw.githubusercontent.com/stefanpenner/es6-promise/master/LICENSE | |
* @version 4.1.1 | |
*/ | |
(function (global, factory) { | |
( false ? 'undefined' : _typeof(exports)) === 'object' && typeof module !== 'undefined' ? module.exports = factory() : true ? !(__WEBPACK_AMD_DEFINE_FACTORY__ = (factory), | |
__WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ? | |
(__WEBPACK_AMD_DEFINE_FACTORY__.call(exports, __webpack_require__, exports, module)) : | |
__WEBPACK_AMD_DEFINE_FACTORY__), | |
__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)) : global.ES6Promise = factory(); | |
})(this, function () { | |
'use strict'; | |
function objectOrFunction(x) { | |
var type = typeof x === 'undefined' ? 'undefined' : _typeof(x); | |
return x !== null && (type === 'object' || type === 'function'); | |
} | |
function isFunction(x) { | |
return typeof x === 'function'; | |
} | |
var _isArray = undefined; | |
if (Array.isArray) { | |
_isArray = Array.isArray; | |
} else { | |
_isArray = function _isArray(x) { | |
return Object.prototype.toString.call(x) === '[object Array]'; | |
}; | |
} | |
var isArray = _isArray; | |
var len = 0; | |
var vertxNext = undefined; | |
var customSchedulerFn = undefined; | |
var asap = function asap(callback, arg) { | |
queue[len] = callback; | |
queue[len + 1] = arg; | |
len += 2; | |
if (len === 2) { | |
// If len is 2, that means that we need to schedule an async flush. | |
// If additional callbacks are queued before the queue is flushed, they | |
// will be processed by this flush that we are scheduling. | |
if (customSchedulerFn) { | |
customSchedulerFn(flush); | |
} else { | |
scheduleFlush(); | |
} | |
} | |
}; | |
function setScheduler(scheduleFn) { | |
customSchedulerFn = scheduleFn; | |
} | |
function setAsap(asapFn) { | |
asap = asapFn; | |
} | |
var browserWindow = typeof window !== 'undefined' ? window : undefined; | |
var browserGlobal = browserWindow || {}; | |
var BrowserMutationObserver = browserGlobal.MutationObserver || browserGlobal.WebKitMutationObserver; | |
var isNode = typeof self === 'undefined' && typeof process !== 'undefined' && {}.toString.call(process) === '[object process]'; | |
// test for web worker but not in IE10 | |
var isWorker = typeof Uint8ClampedArray !== 'undefined' && typeof importScripts !== 'undefined' && typeof MessageChannel !== 'undefined'; | |
// node | |
function useNextTick() { | |
// node version 0.10.x displays a deprecation warning when nextTick is used recursively | |
// see https://github.com/cujojs/when/issues/410 for details | |
return function () { | |
return process.nextTick(flush); | |
}; | |
} | |
// vertx | |
function useVertxTimer() { | |
if (typeof vertxNext !== 'undefined') { | |
return function () { | |
vertxNext(flush); | |
}; | |
} | |
return useSetTimeout(); | |
} | |
function useMutationObserver() { | |
var iterations = 0; | |
var observer = new BrowserMutationObserver(flush); | |
var node = document.createTextNode(''); | |
observer.observe(node, { characterData: true }); | |
return function () { | |
node.data = iterations = ++iterations % 2; | |
}; | |
} | |
// web worker | |
function useMessageChannel() { | |
var channel = new MessageChannel(); | |
channel.port1.onmessage = flush; | |
return function () { | |
return channel.port2.postMessage(0); | |
}; | |
} | |
function useSetTimeout() { | |
// Store setTimeout reference so es6-promise will be unaffected by | |
// other code modifying setTimeout (like sinon.useFakeTimers()) | |
var globalSetTimeout = setTimeout; | |
return function () { | |
return globalSetTimeout(flush, 1); | |
}; | |
} | |
var queue = new Array(1000); | |
function flush() { | |
for (var i = 0; i < len; i += 2) { | |
var callback = queue[i]; | |
var arg = queue[i + 1]; | |
callback(arg); | |
queue[i] = undefined; | |
queue[i + 1] = undefined; | |
} | |
len = 0; | |
} | |
function attemptVertx() { | |
try { | |
var r = require; | |
var vertx = __webpack_require__(406); | |
vertxNext = vertx.runOnLoop || vertx.runOnContext; | |
return useVertxTimer(); | |
} catch (e) { | |
return useSetTimeout(); | |
} | |
} | |
var scheduleFlush = undefined; | |
// Decide what async method to use to triggering processing of queued callbacks: | |
if (isNode) { | |
scheduleFlush = useNextTick(); | |
} else if (BrowserMutationObserver) { | |
scheduleFlush = useMutationObserver(); | |
} else if (isWorker) { | |
scheduleFlush = useMessageChannel(); | |
} else if (browserWindow === undefined && "function" === 'function') { | |
scheduleFlush = attemptVertx(); | |
} else { | |
scheduleFlush = useSetTimeout(); | |
} | |
function then(onFulfillment, onRejection) { | |
var _arguments = arguments; | |
var parent = this; | |
var child = new this.constructor(noop); | |
if (child[PROMISE_ID] === undefined) { | |
makePromise(child); | |
} | |
var _state = parent._state; | |
if (_state) { | |
(function () { | |
var callback = _arguments[_state - 1]; | |
asap(function () { | |
return invokeCallback(_state, child, callback, parent._result); | |
}); | |
})(); | |
} else { | |
subscribe(parent, child, onFulfillment, onRejection); | |
} | |
return child; | |
} | |
/** | |
`Promise.resolve` returns a promise that will become resolved with the | |
passed `value`. It is shorthand for the following: | |
```javascript | |
let promise = new Promise(function(resolve, reject){ | |
resolve(1); | |
}); | |
promise.then(function(value){ | |
// value === 1 | |
}); | |
``` | |
Instead of writing the above, your code now simply becomes the following: | |
```javascript | |
let promise = Promise.resolve(1); | |
promise.then(function(value){ | |
// value === 1 | |
}); | |
``` | |
@method resolve | |
@static | |
@param {Any} value value that the returned promise will be resolved with | |
Useful for tooling. | |
@return {Promise} a promise that will become fulfilled with the given | |
`value` | |
*/ | |
function resolve$1(object) { | |
/*jshint validthis:true */ | |
var Constructor = this; | |
if (object && (typeof object === 'undefined' ? 'undefined' : _typeof(object)) === 'object' && object.constructor === Constructor) { | |
return object; | |
} | |
var promise = new Constructor(noop); | |
resolve(promise, object); | |
return promise; | |
} | |
var PROMISE_ID = Math.random().toString(36).substring(16); | |
function noop() {} | |
var PENDING = void 0; | |
var FULFILLED = 1; | |
var REJECTED = 2; | |
var GET_THEN_ERROR = new ErrorObject(); | |
function selfFulfillment() { | |
return new TypeError("You cannot resolve a promise with itself"); | |
} | |
function cannotReturnOwn() { | |
return new TypeError('A promises callback cannot return that same promise.'); | |
} | |
function getThen(promise) { | |
try { | |
return promise.then; | |
} catch (error) { | |
GET_THEN_ERROR.error = error; | |
return GET_THEN_ERROR; | |
} | |
} | |
function tryThen(then$$1, value, fulfillmentHandler, rejectionHandler) { | |
try { | |
then$$1.call(value, fulfillmentHandler, rejectionHandler); | |
} catch (e) { | |
return e; | |
} | |
} | |
function handleForeignThenable(promise, thenable, then$$1) { | |
asap(function (promise) { | |
var sealed = false; | |
var error = tryThen(then$$1, thenable, function (value) { | |
if (sealed) { | |
return; | |
} | |
sealed = true; | |
if (thenable !== value) { | |
resolve(promise, value); | |
} else { | |
fulfill(promise, value); | |
} | |
}, function (reason) { | |
if (sealed) { | |
return; | |
} | |
sealed = true; | |
reject(promise, reason); | |
}, 'Settle: ' + (promise._label || ' unknown promise')); | |
if (!sealed && error) { | |
sealed = true; | |
reject(promise, error); | |
} | |
}, promise); | |
} | |
function handleOwnThenable(promise, thenable) { | |
if (thenable._state === FULFILLED) { | |
fulfill(promise, thenable._result); | |
} else if (thenable._state === REJECTED) { | |
reject(promise, thenable._result); | |
} else { | |
subscribe(thenable, undefined, function (value) { | |
return resolve(promise, value); | |
}, function (reason) { | |
return reject(promise, reason); | |
}); | |
} | |
} | |
function handleMaybeThenable(promise, maybeThenable, then$$1) { | |
if (maybeThenable.constructor === promise.constructor && then$$1 === then && maybeThenable.constructor.resolve === resolve$1) { | |
handleOwnThenable(promise, maybeThenable); | |
} else { | |
if (then$$1 === GET_THEN_ERROR) { | |
reject(promise, GET_THEN_ERROR.error); | |
GET_THEN_ERROR.error = null; | |
} else if (then$$1 === undefined) { | |
fulfill(promise, maybeThenable); | |
} else if (isFunction(then$$1)) { | |
handleForeignThenable(promise, maybeThenable, then$$1); | |
} else { | |
fulfill(promise, maybeThenable); | |
} | |
} | |
} | |
function resolve(promise, value) { | |
if (promise === value) { | |
reject(promise, selfFulfillment()); | |
} else if (objectOrFunction(value)) { | |
handleMaybeThenable(promise, value, getThen(value)); | |
} else { | |
fulfill(promise, value); | |
} | |
} | |
function publishRejection(promise) { | |
if (promise._onerror) { | |
promise._onerror(promise._result); | |
} | |
publish(promise); | |
} | |
function fulfill(promise, value) { | |
if (promise._state !== PENDING) { | |
return; | |
} | |
promise._result = value; | |
promise._state = FULFILLED; | |
if (promise._subscribers.length !== 0) { | |
asap(publish, promise); | |
} | |
} | |
function reject(promise, reason) { | |
if (promise._state !== PENDING) { | |
return; | |
} | |
promise._state = REJECTED; | |
promise._result = reason; | |
asap(publishRejection, promise); | |
} | |
function subscribe(parent, child, onFulfillment, onRejection) { | |
var _subscribers = parent._subscribers; | |
var length = _subscribers.length; | |
parent._onerror = null; | |
_subscribers[length] = child; | |
_subscribers[length + FULFILLED] = onFulfillment; | |
_subscribers[length + REJECTED] = onRejection; | |
if (length === 0 && parent._state) { | |
asap(publish, parent); | |
} | |
} | |
function publish(promise) { | |
var subscribers = promise._subscribers; | |
var settled = promise._state; | |
if (subscribers.length === 0) { | |
return; | |
} | |
var child = undefined, | |
callback = undefined, | |
detail = promise._result; | |
for (var i = 0; i < subscribers.length; i += 3) { | |
child = subscribers[i]; | |
callback = subscribers[i + settled]; | |
if (child) { | |
invokeCallback(settled, child, callback, detail); | |
} else { | |
callback(detail); | |
} | |
} | |
promise._subscribers.length = 0; | |
} | |
function ErrorObject() { | |
this.error = null; | |
} | |
var TRY_CATCH_ERROR = new ErrorObject(); | |
function tryCatch(callback, detail) { | |
try { | |
return callback(detail); | |
} catch (e) { | |
TRY_CATCH_ERROR.error = e; | |
return TRY_CATCH_ERROR; | |
} | |
} | |
function invokeCallback(settled, promise, callback, detail) { | |
var hasCallback = isFunction(callback), | |
value = undefined, | |
error = undefined, | |
succeeded = undefined, | |
failed = undefined; | |
if (hasCallback) { | |
value = tryCatch(callback, detail); | |
if (value === TRY_CATCH_ERROR) { | |
failed = true; | |
error = value.error; | |
value.error = null; | |
} else { | |
succeeded = true; | |
} | |
if (promise === value) { | |
reject(promise, cannotReturnOwn()); | |
return; | |
} | |
} else { | |
value = detail; | |
succeeded = true; | |
} | |
if (promise._state !== PENDING) { | |
// noop | |
} else if (hasCallback && succeeded) { | |
resolve(promise, value); | |
} else if (failed) { | |
reject(promise, error); | |
} else if (settled === FULFILLED) { | |
fulfill(promise, value); | |
} else if (settled === REJECTED) { | |
reject(promise, value); | |
} | |
} | |
function initializePromise(promise, resolver) { | |
try { | |
resolver(function resolvePromise(value) { | |
resolve(promise, value); | |
}, function rejectPromise(reason) { | |
reject(promise, reason); | |
}); | |
} catch (e) { | |
reject(promise, e); | |
} | |
} | |
var id = 0; | |
function nextId() { | |
return id++; | |
} | |
function makePromise(promise) { | |
promise[PROMISE_ID] = id++; | |
promise._state = undefined; | |
promise._result = undefined; | |
promise._subscribers = []; | |
} | |
function Enumerator$1(Constructor, input) { | |
this._instanceConstructor = Constructor; | |
this.promise = new Constructor(noop); | |
if (!this.promise[PROMISE_ID]) { | |
makePromise(this.promise); | |
} | |
if (isArray(input)) { | |
this.length = input.length; | |
this._remaining = input.length; | |
this._result = new Array(this.length); | |
if (this.length === 0) { | |
fulfill(this.promise, this._result); | |
} else { | |
this.length = this.length || 0; | |
this._enumerate(input); | |
if (this._remaining === 0) { | |
fulfill(this.promise, this._result); | |
} | |
} | |
} else { | |
reject(this.promise, validationError()); | |
} | |
} | |
function validationError() { | |
return new Error('Array Methods must be provided an Array'); | |
} | |
Enumerator$1.prototype._enumerate = function (input) { | |
for (var i = 0; this._state === PENDING && i < input.length; i++) { | |
this._eachEntry(input[i], i); | |
} | |
}; | |
Enumerator$1.prototype._eachEntry = function (entry, i) { | |
var c = this._instanceConstructor; | |
var resolve$$1 = c.resolve; | |
if (resolve$$1 === resolve$1) { | |
var _then = getThen(entry); | |
if (_then === then && entry._state !== PENDING) { | |
this._settledAt(entry._state, i, entry._result); | |
} else if (typeof _then !== 'function') { | |
this._remaining--; | |
this._result[i] = entry; | |
} else if (c === Promise$2) { | |
var promise = new c(noop); | |
handleMaybeThenable(promise, entry, _then); | |
this._willSettleAt(promise, i); | |
} else { | |
this._willSettleAt(new c(function (resolve$$1) { | |
return resolve$$1(entry); | |
}), i); | |
} | |
} else { | |
this._willSettleAt(resolve$$1(entry), i); | |
} | |
}; | |
Enumerator$1.prototype._settledAt = function (state, i, value) { | |
var promise = this.promise; | |
if (promise._state === PENDING) { | |
this._remaining--; | |
if (state === REJECTED) { | |
reject(promise, value); | |
} else { | |
this._result[i] = value; | |
} | |
} | |
if (this._remaining === 0) { | |
fulfill(promise, this._result); | |
} | |
}; | |
Enumerator$1.prototype._willSettleAt = function (promise, i) { | |
var enumerator = this; | |
subscribe(promise, undefined, function (value) { | |
return enumerator._settledAt(FULFILLED, i, value); | |
}, function (reason) { | |
return enumerator._settledAt(REJECTED, i, reason); | |
}); | |
}; | |
/** | |
`Promise.all` accepts an array of promises, and returns a new promise which | |
is fulfilled with an array of fulfillment values for the passed promises, or | |
rejected with the reason of the first passed promise to be rejected. It casts all | |
elements of the passed iterable to promises as it runs this algorithm. | |
Example: | |
```javascript | |
let promise1 = resolve(1); | |
let promise2 = resolve(2); | |
let promise3 = resolve(3); | |
let promises = [ promise1, promise2, promise3 ]; | |
Promise.all(promises).then(function(array){ | |
// The array here would be [ 1, 2, 3 ]; | |
}); | |
``` | |
If any of the `promises` given to `all` are rejected, the first promise | |
that is rejected will be given as an argument to the returned promises's | |
rejection handler. For example: | |
Example: | |
```javascript | |
let promise1 = resolve(1); | |
let promise2 = reject(new Error("2")); | |
let promise3 = reject(new Error("3")); | |
let promises = [ promise1, promise2, promise3 ]; | |
Promise.all(promises).then(function(array){ | |
// Code here never runs because there are rejected promises! | |
}, function(error) { | |
// error.message === "2" | |
}); | |
``` | |
@method all | |
@static | |
@param {Array} entries array of promises | |
@param {String} label optional string for labeling the promise. | |
Useful for tooling. | |
@return {Promise} promise that is fulfilled when all `promises` have been | |
fulfilled, or rejected if any of them become rejected. | |
@static | |
*/ | |
function all$1(entries) { | |
return new Enumerator$1(this, entries).promise; | |
} | |
/** | |
`Promise.race` returns a new promise which is settled in the same way as the | |
first passed promise to settle. | |
Example: | |
```javascript | |
let promise1 = new Promise(function(resolve, reject){ | |
setTimeout(function(){ | |
resolve('promise 1'); | |
}, 200); | |
}); | |
let promise2 = new Promise(function(resolve, reject){ | |
setTimeout(function(){ | |
resolve('promise 2'); | |
}, 100); | |
}); | |
Promise.race([promise1, promise2]).then(function(result){ | |
// result === 'promise 2' because it was resolved before promise1 | |
// was resolved. | |
}); | |
``` | |
`Promise.race` is deterministic in that only the state of the first | |
settled promise matters. For example, even if other promises given to the | |
`promises` array argument are resolved, but the first settled promise has | |
become rejected before the other promises became fulfilled, the returned | |
promise will become rejected: | |
```javascript | |
let promise1 = new Promise(function(resolve, reject){ | |
setTimeout(function(){ | |
resolve('promise 1'); | |
}, 200); | |
}); | |
let promise2 = new Promise(function(resolve, reject){ | |
setTimeout(function(){ | |
reject(new Error('promise 2')); | |
}, 100); | |
}); | |
Promise.race([promise1, promise2]).then(function(result){ | |
// Code here never runs | |
}, function(reason){ | |
// reason.message === 'promise 2' because promise 2 became rejected before | |
// promise 1 became fulfilled | |
}); | |
``` | |
An example real-world use case is implementing timeouts: | |
```javascript | |
Promise.race([ajax('foo.json'), timeout(5000)]) | |
``` | |
@method race | |
@static | |
@param {Array} promises array of promises to observe | |
Useful for tooling. | |
@return {Promise} a promise which settles in the same way as the first passed | |
promise to settle. | |
*/ | |
function race$1(entries) { | |
/*jshint validthis:true */ | |
var Constructor = this; | |
if (!isArray(entries)) { | |
return new Constructor(function (_, reject) { | |
return reject(new TypeError('You must pass an array to race.')); | |
}); | |
} else { | |
return new Constructor(function (resolve, reject) { | |
var length = entries.length; | |
for (var i = 0; i < length; i++) { | |
Constructor.resolve(entries[i]).then(resolve, reject); | |
} | |
}); | |
} | |
} | |
/** | |
`Promise.reject` returns a promise rejected with the passed `reason`. | |
It is shorthand for the following: | |
```javascript | |
let promise = new Promise(function(resolve, reject){ | |
reject(new Error('WHOOPS')); | |
}); | |
promise.then(function(value){ | |
// Code here doesn't run because the promise is rejected! | |
}, function(reason){ | |
// reason.message === 'WHOOPS' | |
}); | |
``` | |
Instead of writing the above, your code now simply becomes the following: | |
```javascript | |
let promise = Promise.reject(new Error('WHOOPS')); | |
promise.then(function(value){ | |
// Code here doesn't run because the promise is rejected! | |
}, function(reason){ | |
// reason.message === 'WHOOPS' | |
}); | |
``` | |
@method reject | |
@static | |
@param {Any} reason value that the returned promise will be rejected with. | |
Useful for tooling. | |
@return {Promise} a promise rejected with the given `reason`. | |
*/ | |
function reject$1(reason) { | |
/*jshint validthis:true */ | |
var Constructor = this; | |
var promise = new Constructor(noop); | |
reject(promise, reason); | |
return promise; | |
} | |
function needsResolver() { | |
throw new TypeError('You must pass a resolver function as the first argument to the promise constructor'); | |
} | |
function needsNew() { | |
throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function."); | |
} | |
/** | |
Promise objects represent the eventual result of an asynchronous operation. The | |
primary way of interacting with a promise is through its `then` method, which | |
registers callbacks to receive either a promise's eventual value or the reason | |
why the promise cannot be fulfilled. | |
Terminology | |
----------- | |
- `promise` is an object or function with a `then` method whose behavior conforms to this specification. | |
- `thenable` is an object or function that defines a `then` method. | |
- `value` is any legal JavaScript value (including undefined, a thenable, or a promise). | |
- `exception` is a value that is thrown using the throw statement. | |
- `reason` is a value that indicates why a promise was rejected. | |
- `settled` the final resting state of a promise, fulfilled or rejected. | |
A promise can be in one of three states: pending, fulfilled, or rejected. | |
Promises that are fulfilled have a fulfillment value and are in the fulfilled | |
state. Promises that are rejected have a rejection reason and are in the | |
rejected state. A fulfillment value is never a thenable. | |
Promises can also be said to *resolve* a value. If this value is also a | |
promise, then the original promise's settled state will match the value's | |
settled state. So a promise that *resolves* a promise that rejects will | |
itself reject, and a promise that *resolves* a promise that fulfills will | |
itself fulfill. | |
Basic Usage: | |
------------ | |
```js | |
let promise = new Promise(function(resolve, reject) { | |
// on success | |
resolve(value); | |
// on failure | |
reject(reason); | |
}); | |
promise.then(function(value) { | |
// on fulfillment | |
}, function(reason) { | |
// on rejection | |
}); | |
``` | |
Advanced Usage: | |
--------------- | |
Promises shine when abstracting away asynchronous interactions such as | |
`XMLHttpRequest`s. | |
```js | |
function getJSON(url) { | |
return new Promise(function(resolve, reject){ | |
let xhr = new XMLHttpRequest(); | |
xhr.open('GET', url); | |
xhr.onreadystatechange = handler; | |
xhr.responseType = 'json'; | |
xhr.setRequestHeader('Accept', 'application/json'); | |
xhr.send(); | |
function handler() { | |
if (this.readyState === this.DONE) { | |
if (this.status === 200) { | |
resolve(this.response); | |
} else { | |
reject(new Error('getJSON: `' + url + '` failed with status: [' + this.status + ']')); | |
} | |
} | |
}; | |
}); | |
} | |
getJSON('/posts.json').then(function(json) { | |
// on fulfillment | |
}, function(reason) { | |
// on rejection | |
}); | |
``` | |
Unlike callbacks, promises are great composable primitives. | |
```js | |
Promise.all([ | |
getJSON('/posts'), | |
getJSON('/comments') | |
]).then(function(values){ | |
values[0] // => postsJSON | |
values[1] // => commentsJSON | |
return values; | |
}); | |
``` | |
@class Promise | |
@param {function} resolver | |
Useful for tooling. | |
@constructor | |
*/ | |
function Promise$2(resolver) { | |
this[PROMISE_ID] = nextId(); | |
this._result = this._state = undefined; | |
this._subscribers = []; | |
if (noop !== resolver) { | |
typeof resolver !== 'function' && needsResolver(); | |
this instanceof Promise$2 ? initializePromise(this, resolver) : needsNew(); | |
} | |
} | |
Promise$2.all = all$1; | |
Promise$2.race = race$1; | |
Promise$2.resolve = resolve$1; | |
Promise$2.reject = reject$1; | |
Promise$2._setScheduler = setScheduler; | |
Promise$2._setAsap = setAsap; | |
Promise$2._asap = asap; | |
Promise$2.prototype = { | |
constructor: Promise$2, | |
/** | |
The primary way of interacting with a promise is through its `then` method, | |
which registers callbacks to receive either a promise's eventual value or the | |
reason why the promise cannot be fulfilled. | |
```js | |
findUser().then(function(user){ | |
// user is available | |
}, function(reason){ | |
// user is unavailable, and you are given the reason why | |
}); | |
``` | |
Chaining | |
-------- | |
The return value of `then` is itself a promise. This second, 'downstream' | |
promise is resolved with the return value of the first promise's fulfillment | |
or rejection handler, or rejected if the handler throws an exception. | |
```js | |
findUser().then(function (user) { | |
return user.name; | |
}, function (reason) { | |
return 'default name'; | |
}).then(function (userName) { | |
// If `findUser` fulfilled, `userName` will be the user's name, otherwise it | |
// will be `'default name'` | |
}); | |
findUser().then(function (user) { | |
throw new Error('Found user, but still unhappy'); | |
}, function (reason) { | |
throw new Error('`findUser` rejected and we're unhappy'); | |
}).then(function (value) { | |
// never reached | |
}, function (reason) { | |
// if `findUser` fulfilled, `reason` will be 'Found user, but still unhappy'. | |
// If `findUser` rejected, `reason` will be '`findUser` rejected and we're unhappy'. | |
}); | |
``` | |
If the downstream promise does not specify a rejection handler, rejection reasons will be propagated further downstream. | |
```js | |
findUser().then(function (user) { | |
throw new PedagogicalException('Upstream error'); | |
}).then(function (value) { | |
// never reached | |
}).then(function (value) { | |
// never reached | |
}, function (reason) { | |
// The `PedgagocialException` is propagated all the way down to here | |
}); | |
``` | |
Assimilation | |
------------ | |
Sometimes the value you want to propagate to a downstream promise can only be | |
retrieved asynchronously. This can be achieved by returning a promise in the | |
fulfillment or rejection handler. The downstream promise will then be pending | |
until the returned promise is settled. This is called *assimilation*. | |
```js | |
findUser().then(function (user) { | |
return findCommentsByAuthor(user); | |
}).then(function (comments) { | |
// The user's comments are now available | |
}); | |
``` | |
If the assimliated promise rejects, then the downstream promise will also reject. | |
```js | |
findUser().then(function (user) { | |
return findCommentsByAuthor(user); | |
}).then(function (comments) { | |
// If `findCommentsByAuthor` fulfills, we'll have the value here | |
}, function (reason) { | |
// If `findCommentsByAuthor` rejects, we'll have the reason here | |
}); | |
``` | |
Simple Example | |
-------------- | |
Synchronous Example | |
```javascript | |
let result; | |
try { | |
result = findResult(); | |
// success | |
} catch(reason) { | |
// failure | |
} | |
``` | |
Errback Example | |
```js | |
findResult(function(result, err){ | |
if (err) { | |
// failure | |
} else { | |
// success | |
} | |
}); | |
``` | |
Promise Example; | |
```javascript | |
findResult().then(function(result){ | |
// success | |
}, function(reason){ | |
// failure | |
}); | |
``` | |
Advanced Example | |
-------------- | |
Synchronous Example | |
```javascript | |
let author, books; | |
try { | |
author = findAuthor(); | |
books = findBooksByAuthor(author); | |
// success | |
} catch(reason) { | |
// failure | |
} | |
``` | |
Errback Example | |
```js | |
function foundBooks(books) { | |
} | |
function failure(reason) { | |
} | |
findAuthor(function(author, err){ | |
if (err) { | |
failure(err); | |
// failure | |
} else { | |
try { | |
findBoooksByAuthor(author, function(books, err) { | |
if (err) { | |
failure(err); | |
} else { | |
try { | |
foundBooks(books); | |
} catch(reason) { | |
failure(reason); | |
} | |
} | |
}); | |
} catch(error) { | |
failure(err); | |
} | |
// success | |
} | |
}); | |
``` | |
Promise Example; | |
```javascript | |
findAuthor(). | |
then(findBooksByAuthor). | |
then(function(books){ | |
// found books | |
}).catch(function(reason){ | |
// something went wrong | |
}); | |
``` | |
@method then | |
@param {Function} onFulfilled | |
@param {Function} onRejected | |
Useful for tooling. | |
@return {Promise} | |
*/ | |
then: then, | |
/** | |
`catch` is simply sugar for `then(undefined, onRejection)` which makes it the same | |
as the catch block of a try/catch statement. | |
```js | |
function findAuthor(){ | |
throw new Error('couldn't find that author'); | |
} | |
// synchronous | |
try { | |
findAuthor(); | |
} catch(reason) { | |
// something went wrong | |
} | |
// async with promises | |
findAuthor().catch(function(reason){ | |
// something went wrong | |
}); | |
``` | |
@method catch | |
@param {Function} onRejection | |
Useful for tooling. | |
@return {Promise} | |
*/ | |
'catch': function _catch(onRejection) { | |
return this.then(null, onRejection); | |
} | |
}; | |
/*global self*/ | |
function polyfill$1() { | |
var local = undefined; | |
if (typeof global !== 'undefined') { | |
local = global; | |
} else if (typeof self !== 'undefined') { | |
local = self; | |
} else { | |
try { | |
local = Function('return this')(); | |
} catch (e) { | |
throw new Error('polyfill failed because global object is unavailable in this environment'); | |
} | |
} | |
var P = local.Promise; | |
if (P) { | |
var promiseToString = null; | |
try { | |
promiseToString = Object.prototype.toString.call(P.resolve()); | |
} catch (e) { | |
// silently ignored | |
} | |
if (promiseToString === '[object Promise]' && !P.cast) { | |
return; | |
} | |
} | |
local.Promise = Promise$2; | |
} | |
// Strange compat.. | |
Promise$2.polyfill = polyfill$1; | |
Promise$2.Promise = Promise$2; | |
return Promise$2; | |
}); | |
//# sourceMappingURL=es6-promise.map | |
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0), __webpack_require__(394))) | |
/***/ }), | |
/* 106 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
"use strict"; | |
/** | |
* Copyright (c) 2013-present, Facebook, Inc. | |
* All rights reserved. | |
* | |
* This source code is licensed under the BSD-style license found in the | |
* LICENSE file in the root directory of this source tree. An additional grant | |
* of patent rights can be found in the PATENTS file in the same directory. | |
* | |
* @typechecks | |
*/ | |
var _hyphenPattern = /-(.)/g; | |
/** | |
* Camelcases a hyphenated string, for example: | |
* | |
* > camelize('background-color') | |
* < "backgroundColor" | |
* | |
* @param {string} string | |
* @return {string} | |
*/ | |
function camelize(string) { | |
return string.replace(_hyphenPattern, function (_, character) { | |
return character.toUpperCase(); | |
}); | |
} | |
module.exports = camelize; | |
/***/ }), | |
/* 107 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
"use strict"; | |
/** | |
* Copyright (c) 2013-present, Facebook, Inc. | |
* All rights reserved. | |
* | |
* This source code is licensed under the BSD-style license found in the | |
* LICENSE file in the root directory of this source tree. An additional grant | |
* of patent rights can be found in the PATENTS file in the same directory. | |
* | |
* @typechecks | |
*/ | |
var camelize = __webpack_require__(106); | |
var msPattern = /^-ms-/; | |
/** | |
* Camelcases a hyphenated CSS property name, for example: | |
* | |
* > camelizeStyleName('background-color') | |
* < "backgroundColor" | |
* > camelizeStyleName('-moz-transition') | |
* < "MozTransition" | |
* > camelizeStyleName('-ms-transition') | |
* < "msTransition" | |
* | |
* As Andi Smith suggests | |
* (http://www.andismith.com/blog/2012/02/modernizr-prefixed/), an `-ms` prefix | |
* is converted to lowercase `ms`. | |
* | |
* @param {string} string | |
* @return {string} | |
*/ | |
function camelizeStyleName(string) { | |
return camelize(string.replace(msPattern, 'ms-')); | |
} | |
module.exports = camelizeStyleName; | |
/***/ }), | |
/* 108 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
"use strict"; | |
/** | |
* Copyright (c) 2013-present, Facebook, Inc. | |
* All rights reserved. | |
* | |
* This source code is licensed under the BSD-style license found in the | |
* LICENSE file in the root directory of this source tree. An additional grant | |
* of patent rights can be found in the PATENTS file in the same directory. | |
* | |
* | |
*/ | |
var isTextNode = __webpack_require__(116); | |
/*eslint-disable no-bitwise */ | |
/** | |
* Checks if a given DOM node contains or is another DOM node. | |
*/ | |
function containsNode(outerNode, innerNode) { | |
if (!outerNode || !innerNode) { | |
return false; | |
} else if (outerNode === innerNode) { | |
return true; | |
} else if (isTextNode(outerNode)) { | |
return false; | |
} else if (isTextNode(innerNode)) { | |
return containsNode(outerNode, innerNode.parentNode); | |
} else if ('contains' in outerNode) { | |
return outerNode.contains(innerNode); | |
} else if (outerNode.compareDocumentPosition) { | |
return !!(outerNode.compareDocumentPosition(innerNode) & 16); | |
} else { | |
return false; | |
} | |
} | |
module.exports = containsNode; | |
/***/ }), | |
/* 109 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
"use strict"; | |
/* WEBPACK VAR INJECTION */(function(process) { | |
/** | |
* Copyright (c) 2013-present, Facebook, Inc. | |
* All rights reserved. | |
* | |
* This source code is licensed under the BSD-style license found in the | |
* LICENSE file in the root directory of this source tree. An additional grant | |
* of patent rights can be found in the PATENTS file in the same directory. | |
* | |
* @typechecks | |
*/ | |
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; | |
var invariant = __webpack_require__(1); | |
/** | |
* Convert array-like objects to arrays. | |
* | |
* This API assumes the caller knows the contents of the data type. For less | |
* well defined inputs use createArrayFromMixed. | |
* | |
* @param {object|function|filelist} obj | |
* @return {array} | |
*/ | |
function toArray(obj) { | |
var length = obj.length; | |
// Some browsers builtin objects can report typeof 'function' (e.g. NodeList | |
// in old versions of Safari). | |
!(!Array.isArray(obj) && ((typeof obj === 'undefined' ? 'undefined' : _typeof(obj)) === 'object' || typeof obj === 'function')) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'toArray: Array-like object expected') : invariant(false) : void 0; | |
!(typeof length === 'number') ? process.env.NODE_ENV !== 'production' ? invariant(false, 'toArray: Object needs a length property') : invariant(false) : void 0; | |
!(length === 0 || length - 1 in obj) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'toArray: Object should have keys for indices') : invariant(false) : void 0; | |
!(typeof obj.callee !== 'function') ? process.env.NODE_ENV !== 'production' ? invariant(false, 'toArray: Object can\'t be `arguments`. Use rest params ' + '(function(...args) {}) or Array.from() instead.') : invariant(false) : void 0; | |
// Old IE doesn't give collections access to hasOwnProperty. Assume inputs | |
// without method will throw during the slice call and skip straight to the | |
// fallback. | |
if (obj.hasOwnProperty) { | |
try { | |
return Array.prototype.slice.call(obj); | |
} catch (e) { | |
// IE < 9 does not support Array#slice on collections objects | |
} | |
} | |
// Fall back to copying key by key. This assumes all keys have a value, | |
// so will not preserve sparsely populated inputs. | |
var ret = Array(length); | |
for (var ii = 0; ii < length; ii++) { | |
ret[ii] = obj[ii]; | |
} | |
return ret; | |
} | |
/** | |
* Perform a heuristic test to determine if an object is "array-like". | |
* | |
* A monk asked Joshu, a Zen master, "Has a dog Buddha nature?" | |
* Joshu replied: "Mu." | |
* | |
* This function determines if its argument has "array nature": it returns | |
* true if the argument is an actual array, an `arguments' object, or an | |
* HTMLCollection (e.g. node.childNodes or node.getElementsByTagName()). | |
* | |
* It will return false for other array-like objects like Filelist. | |
* | |
* @param {*} obj | |
* @return {boolean} | |
*/ | |
function hasArrayNature(obj) { | |
return ( | |
// not null/false | |
!!obj && ( | |
// arrays are objects, NodeLists are functions in Safari | |
(typeof obj === 'undefined' ? 'undefined' : _typeof(obj)) == 'object' || typeof obj == 'function') && | |
// quacks like an array | |
'length' in obj && | |
// not window | |
!('setInterval' in obj) && | |
// no DOM node should be considered an array-like | |
// a 'select' element has 'length' and 'item' properties on IE8 | |
typeof obj.nodeType != 'number' && ( | |
// a real array | |
Array.isArray(obj) || | |
// arguments | |
'callee' in obj || | |
// HTMLCollection/NodeList | |
'item' in obj) | |
); | |
} | |
/** | |
* Ensure that the argument is an array by wrapping it in an array if it is not. | |
* Creates a copy of the argument if it is already an array. | |
* | |
* This is mostly useful idiomatically: | |
* | |
* var createArrayFromMixed = require('createArrayFromMixed'); | |
* | |
* function takesOneOrMoreThings(things) { | |
* things = createArrayFromMixed(things); | |
* ... | |
* } | |
* | |
* This allows you to treat `things' as an array, but accept scalars in the API. | |
* | |
* If you need to convert an array-like object, like `arguments`, into an array | |
* use toArray instead. | |
* | |
* @param {*} obj | |
* @return {array} | |
*/ | |
function createArrayFromMixed(obj) { | |
if (!hasArrayNature(obj)) { | |
return [obj]; | |
} else if (Array.isArray(obj)) { | |
return obj.slice(); | |
} else { | |
return toArray(obj); | |
} | |
} | |
module.exports = createArrayFromMixed; | |
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0))) | |
/***/ }), | |
/* 110 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
"use strict"; | |
/* WEBPACK VAR INJECTION */(function(process) { | |
/** | |
* Copyright (c) 2013-present, Facebook, Inc. | |
* All rights reserved. | |
* | |
* This source code is licensed under the BSD-style license found in the | |
* LICENSE file in the root directory of this source tree. An additional grant | |
* of patent rights can be found in the PATENTS file in the same directory. | |
* | |
* @typechecks | |
*/ | |
/*eslint-disable fb-www/unsafe-html*/ | |
var ExecutionEnvironment = __webpack_require__(6); | |
var createArrayFromMixed = __webpack_require__(109); | |
var getMarkupWrap = __webpack_require__(111); | |
var invariant = __webpack_require__(1); | |
/** | |
* Dummy container used to render all markup. | |
*/ | |
var dummyNode = ExecutionEnvironment.canUseDOM ? document.createElement('div') : null; | |
/** | |
* Pattern used by `getNodeName`. | |
*/ | |
var nodeNamePattern = /^\s*<(\w+)/; | |
/** | |
* Extracts the `nodeName` of the first element in a string of markup. | |
* | |
* @param {string} markup String of markup. | |
* @return {?string} Node name of the supplied markup. | |
*/ | |
function getNodeName(markup) { | |
var nodeNameMatch = markup.match(nodeNamePattern); | |
return nodeNameMatch && nodeNameMatch[1].toLowerCase(); | |
} | |
/** | |
* Creates an array containing the nodes rendered from the supplied markup. The | |
* optionally supplied `handleScript` function will be invoked once for each | |
* <script> element that is rendered. If no `handleScript` function is supplied, | |
* an exception is thrown if any <script> elements are rendered. | |
* | |
* @param {string} markup A string of valid HTML markup. | |
* @param {?function} handleScript Invoked once for each rendered <script>. | |
* @return {array<DOMElement|DOMTextNode>} An array of rendered nodes. | |
*/ | |
function createNodesFromMarkup(markup, handleScript) { | |
var node = dummyNode; | |
!!!dummyNode ? process.env.NODE_ENV !== 'production' ? invariant(false, 'createNodesFromMarkup dummy not initialized') : invariant(false) : void 0; | |
var nodeName = getNodeName(markup); | |
var wrap = nodeName && getMarkupWrap(nodeName); | |
if (wrap) { | |
node.innerHTML = wrap[1] + markup + wrap[2]; | |
var wrapDepth = wrap[0]; | |
while (wrapDepth--) { | |
node = node.lastChild; | |
} | |
} else { | |
node.innerHTML = markup; | |
} | |
var scripts = node.getElementsByTagName('script'); | |
if (scripts.length) { | |
!handleScript ? process.env.NODE_ENV !== 'production' ? invariant(false, 'createNodesFromMarkup(...): Unexpected <script> element rendered.') : invariant(false) : void 0; | |
createArrayFromMixed(scripts).forEach(handleScript); | |
} | |
var nodes = Array.from(node.childNodes); | |
while (node.lastChild) { | |
node.removeChild(node.lastChild); | |
} | |
return nodes; | |
} | |
module.exports = createNodesFromMarkup; | |
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0))) | |
/***/ }), | |
/* 111 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
"use strict"; | |
/* WEBPACK VAR INJECTION */(function(process) { | |
/** | |
* Copyright (c) 2013-present, Facebook, Inc. | |
* All rights reserved. | |
* | |
* This source code is licensed under the BSD-style license found in the | |
* LICENSE file in the root directory of this source tree. An additional grant | |
* of patent rights can be found in the PATENTS file in the same directory. | |
* | |
*/ | |
/*eslint-disable fb-www/unsafe-html */ | |
var ExecutionEnvironment = __webpack_require__(6); | |
var invariant = __webpack_require__(1); | |
/** | |
* Dummy container used to detect which wraps are necessary. | |
*/ | |
var dummyNode = ExecutionEnvironment.canUseDOM ? document.createElement('div') : null; | |
/** | |
* Some browsers cannot use `innerHTML` to render certain elements standalone, | |
* so we wrap them, render the wrapped nodes, then extract the desired node. | |
* | |
* In IE8, certain elements cannot render alone, so wrap all elements ('*'). | |
*/ | |
var shouldWrap = {}; | |
var selectWrap = [1, '<select multiple="true">', '</select>']; | |
var tableWrap = [1, '<table>', '</table>']; | |
var trWrap = [3, '<table><tbody><tr>', '</tr></tbody></table>']; | |
var svgWrap = [1, '<svg xmlns="http://www.w3.org/2000/svg">', '</svg>']; | |
var markupWrap = { | |
'*': [1, '?<div>', '</div>'], | |
'area': [1, '<map>', '</map>'], | |
'col': [2, '<table><tbody></tbody><colgroup>', '</colgroup></table>'], | |
'legend': [1, '<fieldset>', '</fieldset>'], | |
'param': [1, '<object>', '</object>'], | |
'tr': [2, '<table><tbody>', '</tbody></table>'], | |
'optgroup': selectWrap, | |
'option': selectWrap, | |
'caption': tableWrap, | |
'colgroup': tableWrap, | |
'tbody': tableWrap, | |
'tfoot': tableWrap, | |
'thead': tableWrap, | |
'td': trWrap, | |
'th': trWrap | |
}; | |
// Initialize the SVG elements since we know they'll always need to be wrapped | |
// consistently. If they are created inside a <div> they will be initialized in | |
// the wrong namespace (and will not display). | |
var svgElements = ['circle', 'clipPath', 'defs', 'ellipse', 'g', 'image', 'line', 'linearGradient', 'mask', 'path', 'pattern', 'polygon', 'polyline', 'radialGradient', 'rect', 'stop', 'text', 'tspan']; | |
svgElements.forEach(function (nodeName) { | |
markupWrap[nodeName] = svgWrap; | |
shouldWrap[nodeName] = true; | |
}); | |
/** | |
* Gets the markup wrap configuration for the supplied `nodeName`. | |
* | |
* NOTE: This lazily detects which wraps are necessary for the current browser. | |
* | |
* @param {string} nodeName Lowercase `nodeName`. | |
* @return {?array} Markup wrap configuration, if applicable. | |
*/ | |
function getMarkupWrap(nodeName) { | |
!!!dummyNode ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Markup wrapping node not initialized') : invariant(false) : void 0; | |
if (!markupWrap.hasOwnProperty(nodeName)) { | |
nodeName = '*'; | |
} | |
if (!shouldWrap.hasOwnProperty(nodeName)) { | |
if (nodeName === '*') { | |
dummyNode.innerHTML = '<link />'; | |
} else { | |
dummyNode.innerHTML = '<' + nodeName + '></' + nodeName + '>'; | |
} | |
shouldWrap[nodeName] = !dummyNode.firstChild; | |
} | |
return shouldWrap[nodeName] ? markupWrap[nodeName] : null; | |
} | |
module.exports = getMarkupWrap; | |
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0))) | |
/***/ }), | |
/* 112 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
"use strict"; | |
/** | |
* Copyright (c) 2013-present, Facebook, Inc. | |
* All rights reserved. | |
* | |
* This source code is licensed under the BSD-style license found in the | |
* LICENSE file in the root directory of this source tree. An additional grant | |
* of patent rights can be found in the PATENTS file in the same directory. | |
* | |
* @typechecks | |
*/ | |
/** | |
* Gets the scroll position of the supplied element or window. | |
* | |
* The return values are unbounded, unlike `getScrollPosition`. This means they | |
* may be negative or exceed the element boundaries (which is possible using | |
* inertial scrolling). | |
* | |
* @param {DOMWindow|DOMElement} scrollable | |
* @return {object} Map with `x` and `y` keys. | |
*/ | |
function getUnboundedScrollPosition(scrollable) { | |
if (scrollable.Window && scrollable instanceof scrollable.Window) { | |
return { | |
x: scrollable.pageXOffset || scrollable.document.documentElement.scrollLeft, | |
y: scrollable.pageYOffset || scrollable.document.documentElement.scrollTop | |
}; | |
} | |
return { | |
x: scrollable.scrollLeft, | |
y: scrollable.scrollTop | |
}; | |
} | |
module.exports = getUnboundedScrollPosition; | |
/***/ }), | |
/* 113 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
"use strict"; | |
/** | |
* Copyright (c) 2013-present, Facebook, Inc. | |
* All rights reserved. | |
* | |
* This source code is licensed under the BSD-style license found in the | |
* LICENSE file in the root directory of this source tree. An additional grant | |
* of patent rights can be found in the PATENTS file in the same directory. | |
* | |
* @typechecks | |
*/ | |
var _uppercasePattern = /([A-Z])/g; | |
/** | |
* Hyphenates a camelcased string, for example: | |
* | |
* > hyphenate('backgroundColor') | |
* < "background-color" | |
* | |
* For CSS style names, use `hyphenateStyleName` instead which works properly | |
* with all vendor prefixes, including `ms`. | |
* | |
* @param {string} string | |
* @return {string} | |
*/ | |
function hyphenate(string) { | |
return string.replace(_uppercasePattern, '-$1').toLowerCase(); | |
} | |
module.exports = hyphenate; | |
/***/ }), | |
/* 114 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
"use strict"; | |
/** | |
* Copyright (c) 2013-present, Facebook, Inc. | |
* All rights reserved. | |
* | |
* This source code is licensed under the BSD-style license found in the | |
* LICENSE file in the root directory of this source tree. An additional grant | |
* of patent rights can be found in the PATENTS file in the same directory. | |
* | |
* @typechecks | |
*/ | |
var hyphenate = __webpack_require__(113); | |
var msPattern = /^ms-/; | |
/** | |
* Hyphenates a camelcased CSS property name, for example: | |
* | |
* > hyphenateStyleName('backgroundColor') | |
* < "background-color" | |
* > hyphenateStyleName('MozTransition') | |
* < "-moz-transition" | |
* > hyphenateStyleName('msTransition') | |
* < "-ms-transition" | |
* | |
* As Modernizr suggests (http://modernizr.com/docs/#prefixed), an `ms` prefix | |
* is converted to `-ms-`. | |
* | |
* @param {string} string | |
* @return {string} | |
*/ | |
function hyphenateStyleName(string) { | |
return hyphenate(string).replace(msPattern, '-ms-'); | |
} | |
module.exports = hyphenateStyleName; | |
/***/ }), | |
/* 115 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
"use strict"; | |
/** | |
* Copyright (c) 2013-present, Facebook, Inc. | |
* All rights reserved. | |
* | |
* This source code is licensed under the BSD-style license found in the | |
* LICENSE file in the root directory of this source tree. An additional grant | |
* of patent rights can be found in the PATENTS file in the same directory. | |
* | |
* @typechecks | |
*/ | |
/** | |
* @param {*} object The object to check. | |
* @return {boolean} Whether or not the object is a DOM node. | |
*/ | |
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; | |
function isNode(object) { | |
var doc = object ? object.ownerDocument || object : document; | |
var defaultView = doc.defaultView || window; | |
return !!(object && (typeof defaultView.Node === 'function' ? object instanceof defaultView.Node : (typeof object === 'undefined' ? 'undefined' : _typeof(object)) === 'object' && typeof object.nodeType === 'number' && typeof object.nodeName === 'string')); | |
} | |
module.exports = isNode; | |
/***/ }), | |
/* 116 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
"use strict"; | |
/** | |
* Copyright (c) 2013-present, Facebook, Inc. | |
* All rights reserved. | |
* | |
* This source code is licensed under the BSD-style license found in the | |
* LICENSE file in the root directory of this source tree. An additional grant | |
* of patent rights can be found in the PATENTS file in the same directory. | |
* | |
* @typechecks | |
*/ | |
var isNode = __webpack_require__(115); | |
/** | |
* @param {*} object The object to check. | |
* @return {boolean} Whether or not the object is a DOM text node. | |
*/ | |
function isTextNode(object) { | |
return isNode(object) && object.nodeType == 3; | |
} | |
module.exports = isTextNode; | |
/***/ }), | |
/* 117 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
"use strict"; | |
/** | |
* Copyright (c) 2013-present, Facebook, Inc. | |
* All rights reserved. | |
* | |
* This source code is licensed under the BSD-style license found in the | |
* LICENSE file in the root directory of this source tree. An additional grant | |
* of patent rights can be found in the PATENTS file in the same directory. | |
* | |
* | |
* @typechecks static-only | |
*/ | |
/** | |
* Memoizes the return value of a function that accepts one string argument. | |
*/ | |
function memoizeStringOnly(callback) { | |
var cache = {}; | |
return function (string) { | |
if (!cache.hasOwnProperty(string)) { | |
cache[string] = callback.call(this, string); | |
} | |
return cache[string]; | |
}; | |
} | |
module.exports = memoizeStringOnly; | |
/***/ }), | |
/* 118 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
"use strict"; | |
/** | |
* Copyright (c) 2013-present, Facebook, Inc. | |
* All rights reserved. | |
* | |
* This source code is licensed under the BSD-style license found in the | |
* LICENSE file in the root directory of this source tree. An additional grant | |
* of patent rights can be found in the PATENTS file in the same directory. | |
* | |
* @typechecks | |
*/ | |
var ExecutionEnvironment = __webpack_require__(6); | |
var performance; | |
if (ExecutionEnvironment.canUseDOM) { | |
performance = window.performance || window.msPerformance || window.webkitPerformance; | |
} | |
module.exports = performance || {}; | |
/***/ }), | |
/* 119 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
"use strict"; | |
/** | |
* Copyright (c) 2013-present, Facebook, Inc. | |
* All rights reserved. | |
* | |
* This source code is licensed under the BSD-style license found in the | |
* LICENSE file in the root directory of this source tree. An additional grant | |
* of patent rights can be found in the PATENTS file in the same directory. | |
* | |
* @typechecks | |
*/ | |
var performance = __webpack_require__(118); | |
var performanceNow; | |
/** | |
* Detect if we can use `window.performance.now()` and gracefully fallback to | |
* `Date.now()` if it doesn't exist. We need to support Firefox < 15 for now | |
* because of Facebook's testing infrastructure. | |
*/ | |
if (performance.now) { | |
performanceNow = function performanceNow() { | |
return performance.now(); | |
}; | |
} else { | |
performanceNow = function performanceNow() { | |
return Date.now(); | |
}; | |
} | |
module.exports = performanceNow; | |
/***/ }), | |
/* 120 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; | |
/* | |
Syntax highlighting with language autodetection. | |
https://highlightjs.org/ | |
*/ | |
(function (factory) { | |
// Find the global object for export to both the browser and web workers. | |
var globalObject = (typeof window === 'undefined' ? 'undefined' : _typeof(window)) === 'object' && window || (typeof self === 'undefined' ? 'undefined' : _typeof(self)) === 'object' && self; | |
// Setup highlight.js for different environments. First is Node.js or | |
// CommonJS. | |
if (true) { | |
factory(exports); | |
} else if (globalObject) { | |
// Export hljs globally even when using AMD for cases when this script | |
// is loaded with others that may still expect a global hljs. | |
globalObject.hljs = factory({}); | |
// Finally register the global hljs with AMD. | |
if (typeof define === 'function' && define.amd) { | |
define([], function () { | |
return globalObject.hljs; | |
}); | |
} | |
} | |
})(function (hljs) { | |
// Convenience variables for build-in objects | |
var ArrayProto = [], | |
objectKeys = Object.keys; | |
// Global internal variables used within the highlight.js library. | |
var languages = {}, | |
aliases = {}; | |
// Regular expressions used throughout the highlight.js library. | |
var noHighlightRe = /^(no-?highlight|plain|text)$/i, | |
languagePrefixRe = /\blang(?:uage)?-([\w-]+)\b/i, | |
fixMarkupRe = /((^(<[^>]+>|\t|)+|(?:\n)))/gm; | |
var spanEndTag = '</span>'; | |
// Global options used when within external APIs. This is modified when | |
// calling the `hljs.configure` function. | |
var options = { | |
classPrefix: 'hljs-', | |
tabReplace: null, | |
useBR: false, | |
languages: undefined | |
}; | |
/* Utility functions */ | |
function escape(value) { | |
return value.replace(/&/g, '&').replace(/</g, '<').replace(/>/g, '>'); | |
} | |
function tag(node) { | |
return node.nodeName.toLowerCase(); | |
} | |
function testRe(re, lexeme) { | |
var match = re && re.exec(lexeme); | |
return match && match.index === 0; | |
} | |
function isNotHighlighted(language) { | |
return noHighlightRe.test(language); | |
} | |
function blockLanguage(block) { | |
var i, match, length, _class; | |
var classes = block.className + ' '; | |
classes += block.parentNode ? block.parentNode.className : ''; | |
// language-* takes precedence over non-prefixed class names. | |
match = languagePrefixRe.exec(classes); | |
if (match) { | |
return getLanguage(match[1]) ? match[1] : 'no-highlight'; | |
} | |
classes = classes.split(/\s+/); | |
for (i = 0, length = classes.length; i < length; i++) { | |
_class = classes[i]; | |
if (isNotHighlighted(_class) || getLanguage(_class)) { | |
return _class; | |
} | |
} | |
} | |
function inherit(parent) { | |
// inherit(parent, override_obj, override_obj, ...) | |
var key; | |
var result = {}; | |
var objects = Array.prototype.slice.call(arguments, 1); | |
for (key in parent) { | |
result[key] = parent[key]; | |
}objects.forEach(function (obj) { | |
for (key in obj) { | |
result[key] = obj[key]; | |
} | |
}); | |
return result; | |
} | |
/* Stream merging */ | |
function nodeStream(node) { | |
var result = []; | |
(function _nodeStream(node, offset) { | |
for (var child = node.firstChild; child; child = child.nextSibling) { | |
if (child.nodeType === 3) offset += child.nodeValue.length;else if (child.nodeType === 1) { | |
result.push({ | |
event: 'start', | |
offset: offset, | |
node: child | |
}); | |
offset = _nodeStream(child, offset); | |
// Prevent void elements from having an end tag that would actually | |
// double them in the output. There are more void elements in HTML | |
// but we list only those realistically expected in code display. | |
if (!tag(child).match(/br|hr|img|input/)) { | |
result.push({ | |
event: 'stop', | |
offset: offset, | |
node: child | |
}); | |
} | |
} | |
} | |
return offset; | |
})(node, 0); | |
return result; | |
} | |
function mergeStreams(original, highlighted, value) { | |
var processed = 0; | |
var result = ''; | |
var nodeStack = []; | |
function selectStream() { | |
if (!original.length || !highlighted.length) { | |
return original.length ? original : highlighted; | |
} | |
if (original[0].offset !== highlighted[0].offset) { | |
return original[0].offset < highlighted[0].offset ? original : highlighted; | |
} | |
/* | |
To avoid starting the stream just before it should stop the order is | |
ensured that original always starts first and closes last: | |
if (event1 == 'start' && event2 == 'start') | |
return original; | |
if (event1 == 'start' && event2 == 'stop') | |
return highlighted; | |
if (event1 == 'stop' && event2 == 'start') | |
return original; | |
if (event1 == 'stop' && event2 == 'stop') | |
return highlighted; | |
... which is collapsed to: | |
*/ | |
return highlighted[0].event === 'start' ? original : highlighted; | |
} | |
function open(node) { | |
function attr_str(a) { | |
return ' ' + a.nodeName + '="' + escape(a.value).replace('"', '"') + '"'; | |
} | |
result += '<' + tag(node) + ArrayProto.map.call(node.attributes, attr_str).join('') + '>'; | |
} | |
function close(node) { | |
result += '</' + tag(node) + '>'; | |
} | |
function render(event) { | |
(event.event === 'start' ? open : close)(event.node); | |
} | |
while (original.length || highlighted.length) { | |
var stream = selectStream(); | |
result += escape(value.substring(processed, stream[0].offset)); | |
processed = stream[0].offset; | |
if (stream === original) { | |
/* | |
On any opening or closing tag of the original markup we first close | |
the entire highlighted node stack, then render the original tag along | |
with all the following original tags at the same offset and then | |
reopen all the tags on the highlighted stack. | |
*/ | |
nodeStack.reverse().forEach(close); | |
do { | |
render(stream.splice(0, 1)[0]); | |
stream = selectStream(); | |
} while (stream === original && stream.length && stream[0].offset === processed); | |
nodeStack.reverse().forEach(open); | |
} else { | |
if (stream[0].event === 'start') { | |
nodeStack.push(stream[0].node); | |
} else { | |
nodeStack.pop(); | |
} | |
render(stream.splice(0, 1)[0]); | |
} | |
} | |
return result + escape(value.substr(processed)); | |
} | |
/* Initialization */ | |
function expand_mode(mode) { | |
if (mode.variants && !mode.cached_variants) { | |
mode.cached_variants = mode.variants.map(function (variant) { | |
return inherit(mode, { variants: null }, variant); | |
}); | |
} | |
return mode.cached_variants || mode.endsWithParent && [inherit(mode)] || [mode]; | |
} | |
function compileLanguage(language) { | |
function reStr(re) { | |
return re && re.source || re; | |
} | |
function langRe(value, global) { | |
return new RegExp(reStr(value), 'm' + (language.case_insensitive ? 'i' : '') + (global ? 'g' : '')); | |
} | |
function compileMode(mode, parent) { | |
if (mode.compiled) return; | |
mode.compiled = true; | |
mode.keywords = mode.keywords || mode.beginKeywords; | |
if (mode.keywords) { | |
var compiled_keywords = {}; | |
var flatten = function flatten(className, str) { | |
if (language.case_insensitive) { | |
str = str.toLowerCase(); | |
} | |
str.split(' ').forEach(function (kw) { | |
var pair = kw.split('|'); | |
compiled_keywords[pair[0]] = [className, pair[1] ? Number(pair[1]) : 1]; | |
}); | |
}; | |
if (typeof mode.keywords === 'string') { | |
// string | |
flatten('keyword', mode.keywords); | |
} else { | |
objectKeys(mode.keywords).forEach(function (className) { | |
flatten(className, mode.keywords[className]); | |
}); | |
} | |
mode.keywords = compiled_keywords; | |
} | |
mode.lexemesRe = langRe(mode.lexemes || /\w+/, true); | |
if (parent) { | |
if (mode.beginKeywords) { | |
mode.begin = '\\b(' + mode.beginKeywords.split(' ').join('|') + ')\\b'; | |
} | |
if (!mode.begin) mode.begin = /\B|\b/; | |
mode.beginRe = langRe(mode.begin); | |
if (!mode.end && !mode.endsWithParent) mode.end = /\B|\b/; | |
if (mode.end) mode.endRe = langRe(mode.end); | |
mode.terminator_end = reStr(mode.end) || ''; | |
if (mode.endsWithParent && parent.terminator_end) mode.terminator_end += (mode.end ? '|' : '') + parent.terminator_end; | |
} | |
if (mode.illegal) mode.illegalRe = langRe(mode.illegal); | |
if (mode.relevance == null) mode.relevance = 1; | |
if (!mode.contains) { | |
mode.contains = []; | |
} | |
mode.contains = Array.prototype.concat.apply([], mode.contains.map(function (c) { | |
return expand_mode(c === 'self' ? mode : c); | |
})); | |
mode.contains.forEach(function (c) { | |
compileMode(c, mode); | |
}); | |
if (mode.starts) { | |
compileMode(mode.starts, parent); | |
} | |
var terminators = mode.contains.map(function (c) { | |
return c.beginKeywords ? '\\.?(' + c.begin + ')\\.?' : c.begin; | |
}).concat([mode.terminator_end, mode.illegal]).map(reStr).filter(Boolean); | |
mode.terminators = terminators.length ? langRe(terminators.join('|'), true) : { exec: function exec() /*s*/{ | |
return null; | |
} }; | |
} | |
compileMode(language); | |
} | |
/* | |
Core highlighting function. Accepts a language name, or an alias, and a | |
string with the code to highlight. Returns an object with the following | |
properties: | |
- relevance (int) | |
- value (an HTML string with highlighting markup) | |
*/ | |
function highlight(name, value, ignore_illegals, continuation) { | |
function subMode(lexeme, mode) { | |
var i, length; | |
for (i = 0, length = mode.contains.length; i < length; i++) { | |
if (testRe(mode.contains[i].beginRe, lexeme)) { | |
return mode.contains[i]; | |
} | |
} | |
} | |
function endOfMode(mode, lexeme) { | |
if (testRe(mode.endRe, lexeme)) { | |
while (mode.endsParent && mode.parent) { | |
mode = mode.parent; | |
} | |
return mode; | |
} | |
if (mode.endsWithParent) { | |
return endOfMode(mode.parent, lexeme); | |
} | |
} | |
function isIllegal(lexeme, mode) { | |
return !ignore_illegals && testRe(mode.illegalRe, lexeme); | |
} | |
function keywordMatch(mode, match) { | |
var match_str = language.case_insensitive ? match[0].toLowerCase() : match[0]; | |
return mode.keywords.hasOwnProperty(match_str) && mode.keywords[match_str]; | |
} | |
function buildSpan(classname, insideSpan, leaveOpen, noPrefix) { | |
var classPrefix = noPrefix ? '' : options.classPrefix, | |
openSpan = '<span class="' + classPrefix, | |
closeSpan = leaveOpen ? '' : spanEndTag; | |
openSpan += classname + '">'; | |
return openSpan + insideSpan + closeSpan; | |
} | |
function processKeywords() { | |
var keyword_match, last_index, match, result; | |
if (!top.keywords) return escape(mode_buffer); | |
result = ''; | |
last_index = 0; | |
top.lexemesRe.lastIndex = 0; | |
match = top.lexemesRe.exec(mode_buffer); | |
while (match) { | |
result += escape(mode_buffer.substring(last_index, match.index)); | |
keyword_match = keywordMatch(top, match); | |
if (keyword_match) { | |
relevance += keyword_match[1]; | |
result += buildSpan(keyword_match[0], escape(match[0])); | |
} else { | |
result += escape(match[0]); | |
} | |
last_index = top.lexemesRe.lastIndex; | |
match = top.lexemesRe.exec(mode_buffer); | |
} | |
return result + escape(mode_buffer.substr(last_index)); | |
} | |
function processSubLanguage() { | |
var explicit = typeof top.subLanguage === 'string'; | |
if (explicit && !languages[top.subLanguage]) { | |
return escape(mode_buffer); | |
} | |
var result = explicit ? highlight(top.subLanguage, mode_buffer, true, continuations[top.subLanguage]) : highlightAuto(mode_buffer, top.subLanguage.length ? top.subLanguage : undefined); | |
// Counting embedded language score towards the host language may be disabled | |
// with zeroing the containing mode relevance. Usecase in point is Markdown that | |
// allows XML everywhere and makes every XML snippet to have a much larger Markdown | |
// score. | |
if (top.relevance > 0) { | |
relevance += result.relevance; | |
} | |
if (explicit) { | |
continuations[top.subLanguage] = result.top; | |
} | |
return buildSpan(result.language, result.value, false, true); | |
} | |
function processBuffer() { | |
result += top.subLanguage != null ? processSubLanguage() : processKeywords(); | |
mode_buffer = ''; | |
} | |
function startNewMode(mode) { | |
result += mode.className ? buildSpan(mode.className, '', true) : ''; | |
top = Object.create(mode, { parent: { value: top } }); | |
} | |
function processLexeme(buffer, lexeme) { | |
mode_buffer += buffer; | |
if (lexeme == null) { | |
processBuffer(); | |
return 0; | |
} | |
var new_mode = subMode(lexeme, top); | |
if (new_mode) { | |
if (new_mode.skip) { | |
mode_buffer += lexeme; | |
} else { | |
if (new_mode.excludeBegin) { | |
mode_buffer += lexeme; | |
} | |
processBuffer(); | |
if (!new_mode.returnBegin && !new_mode.excludeBegin) { | |
mode_buffer = lexeme; | |
} | |
} | |
startNewMode(new_mode, lexeme); | |
return new_mode.returnBegin ? 0 : lexeme.length; | |
} | |
var end_mode = endOfMode(top, lexeme); | |
if (end_mode) { | |
var origin = top; | |
if (origin.skip) { | |
mode_buffer += lexeme; | |
} else { | |
if (!(origin.returnEnd || origin.excludeEnd)) { | |
mode_buffer += lexeme; | |
} | |
processBuffer(); | |
if (origin.excludeEnd) { | |
mode_buffer = lexeme; | |
} | |
} | |
do { | |
if (top.className) { | |
result += spanEndTag; | |
} | |
if (!top.skip) { | |
relevance += top.relevance; | |
} | |
top = top.parent; | |
} while (top !== end_mode.parent); | |
if (end_mode.starts) { | |
startNewMode(end_mode.starts, ''); | |
} | |
return origin.returnEnd ? 0 : lexeme.length; | |
} | |
if (isIllegal(lexeme, top)) throw new Error('Illegal lexeme "' + lexeme + '" for mode "' + (top.className || '<unnamed>') + '"'); | |
/* | |
Parser should not reach this point as all types of lexemes should be caught | |
earlier, but if it does due to some bug make sure it advances at least one | |
character forward to prevent infinite looping. | |
*/ | |
mode_buffer += lexeme; | |
return lexeme.length || 1; | |
} | |
var language = getLanguage(name); | |
if (!language) { | |
throw new Error('Unknown language: "' + name + '"'); | |
} | |
compileLanguage(language); | |
var top = continuation || language; | |
var continuations = {}; // keep continuations for sub-languages | |
var result = '', | |
current; | |
for (current = top; current !== language; current = current.parent) { | |
if (current.className) { | |
result = buildSpan(current.className, '', true) + result; | |
} | |
} | |
var mode_buffer = ''; | |
var relevance = 0; | |
try { | |
var match, | |
count, | |
index = 0; | |
while (true) { | |
top.terminators.lastIndex = index; | |
match = top.terminators.exec(value); | |
if (!match) break; | |
count = processLexeme(value.substring(index, match.index), match[0]); | |
index = match.index + count; | |
} | |
processLexeme(value.substr(index)); | |
for (current = top; current.parent; current = current.parent) { | |
// close dangling modes | |
if (current.className) { | |
result += spanEndTag; | |
} | |
} | |
return { | |
relevance: relevance, | |
value: result, | |
language: name, | |
top: top | |
}; | |
} catch (e) { | |
if (e.message && e.message.indexOf('Illegal') !== -1) { | |
return { | |
relevance: 0, | |
value: escape(value) | |
}; | |
} else { | |
throw e; | |
} | |
} | |
} | |
/* | |
Highlighting with language detection. Accepts a string with the code to | |
highlight. Returns an object with the following properties: | |
- language (detected language) | |
- relevance (int) | |
- value (an HTML string with highlighting markup) | |
- second_best (object with the same structure for second-best heuristically | |
detected language, may be absent) | |
*/ | |
function highlightAuto(text, languageSubset) { | |
languageSubset = languageSubset || options.languages || objectKeys(languages); | |
var result = { | |
relevance: 0, | |
value: escape(text) | |
}; | |
var second_best = result; | |
languageSubset.filter(getLanguage).forEach(function (name) { | |
var current = highlight(name, text, false); | |
current.language = name; | |
if (current.relevance > second_best.relevance) { | |
second_best = current; | |
} | |
if (current.relevance > result.relevance) { | |
second_best = result; | |
result = current; | |
} | |
}); | |
if (second_best.language) { | |
result.second_best = second_best; | |
} | |
return result; | |
} | |
/* | |
Post-processing of the highlighted markup: | |
- replace TABs with something more useful | |
- replace real line-breaks with '<br>' for non-pre containers | |
*/ | |
function fixMarkup(value) { | |
return !(options.tabReplace || options.useBR) ? value : value.replace(fixMarkupRe, function (match, p1) { | |
if (options.useBR && match === '\n') { | |
return '<br>'; | |
} else if (options.tabReplace) { | |
return p1.replace(/\t/g, options.tabReplace); | |
} | |
return ''; | |
}); | |
} | |
function buildClassName(prevClassName, currentLang, resultLang) { | |
var language = currentLang ? aliases[currentLang] : resultLang, | |
result = [prevClassName.trim()]; | |
if (!prevClassName.match(/\bhljs\b/)) { | |
result.push('hljs'); | |
} | |
if (prevClassName.indexOf(language) === -1) { | |
result.push(language); | |
} | |
return result.join(' ').trim(); | |
} | |
/* | |
Applies highlighting to a DOM node containing code. Accepts a DOM node and | |
two optional parameters for fixMarkup. | |
*/ | |
function highlightBlock(block) { | |
var node, originalStream, result, resultNode, text; | |
var language = blockLanguage(block); | |
if (isNotHighlighted(language)) return; | |
if (options.useBR) { | |
node = document.createElementNS('http://www.w3.org/1999/xhtml', 'div'); | |
node.innerHTML = block.innerHTML.replace(/\n/g, '').replace(/<br[ \/]*>/g, '\n'); | |
} else { | |
node = block; | |
} | |
text = node.textContent; | |
result = language ? highlight(language, text, true) : highlightAuto(text); | |
originalStream = nodeStream(node); | |
if (originalStream.length) { | |
resultNode = document.createElementNS('http://www.w3.org/1999/xhtml', 'div'); | |
resultNode.innerHTML = result.value; | |
result.value = mergeStreams(originalStream, nodeStream(resultNode), text); | |
} | |
result.value = fixMarkup(result.value); | |
block.innerHTML = result.value; | |
block.className = buildClassName(block.className, language, result.language); | |
block.result = { | |
language: result.language, | |
re: result.relevance | |
}; | |
if (result.second_best) { | |
block.second_best = { | |
language: result.second_best.language, | |
re: result.second_best.relevance | |
}; | |
} | |
} | |
/* | |
Updates highlight.js global options with values passed in the form of an object. | |
*/ | |
function configure(user_options) { | |
options = inherit(options, user_options); | |
} | |
/* | |
Applies highlighting to all <pre><code>..</code></pre> blocks on a page. | |
*/ | |
function initHighlighting() { | |
if (initHighlighting.called) return; | |
initHighlighting.called = true; | |
var blocks = document.querySelectorAll('pre code'); | |
ArrayProto.forEach.call(blocks, highlightBlock); | |
} | |
/* | |
Attaches highlighting to the page load event. | |
*/ | |
function initHighlightingOnLoad() { | |
addEventListener('DOMContentLoaded', initHighlighting, false); | |
addEventListener('load', initHighlighting, false); | |
} | |
function registerLanguage(name, language) { | |
var lang = languages[name] = language(hljs); | |
if (lang.aliases) { | |
lang.aliases.forEach(function (alias) { | |
aliases[alias] = name; | |
}); | |
} | |
} | |
function listLanguages() { | |
return objectKeys(languages); | |
} | |
function getLanguage(name) { | |
name = (name || '').toLowerCase(); | |
return languages[name] || languages[aliases[name]]; | |
} | |
/* Interface definition */ | |
hljs.highlight = highlight; | |
hljs.highlightAuto = highlightAuto; | |
hljs.fixMarkup = fixMarkup; | |
hljs.highlightBlock = highlightBlock; | |
hljs.configure = configure; | |
hljs.initHighlighting = initHighlighting; | |
hljs.initHighlightingOnLoad = initHighlightingOnLoad; | |
hljs.registerLanguage = registerLanguage; | |
hljs.listLanguages = listLanguages; | |
hljs.getLanguage = getLanguage; | |
hljs.inherit = inherit; | |
// Common regexps | |
hljs.IDENT_RE = '[a-zA-Z]\\w*'; | |
hljs.UNDERSCORE_IDENT_RE = '[a-zA-Z_]\\w*'; | |
hljs.NUMBER_RE = '\\b\\d+(\\.\\d+)?'; | |
hljs.C_NUMBER_RE = '(-?)(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)'; // 0x..., 0..., decimal, float | |
hljs.BINARY_NUMBER_RE = '\\b(0b[01]+)'; // 0b... | |
hljs.RE_STARTERS_RE = '!|!=|!==|%|%=|&|&&|&=|\\*|\\*=|\\+|\\+=|,|-|-=|/=|/|:|;|<<|<<=|<=|<|===|==|=|>>>=|>>=|>=|>>>|>>|>|\\?|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~'; | |
// Common modes | |
hljs.BACKSLASH_ESCAPE = { | |
begin: '\\\\[\\s\\S]', relevance: 0 | |
}; | |
hljs.APOS_STRING_MODE = { | |
className: 'string', | |
begin: '\'', end: '\'', | |
illegal: '\\n', | |
contains: [hljs.BACKSLASH_ESCAPE] | |
}; | |
hljs.QUOTE_STRING_MODE = { | |
className: 'string', | |
begin: '"', end: '"', | |
illegal: '\\n', | |
contains: [hljs.BACKSLASH_ESCAPE] | |
}; | |
hljs.PHRASAL_WORDS_MODE = { | |
begin: /\b(a|an|the|are|I'm|isn't|don't|doesn't|won't|but|just|should|pretty|simply|enough|gonna|going|wtf|so|such|will|you|your|they|like|more)\b/ | |
}; | |
hljs.COMMENT = function (begin, end, inherits) { | |
var mode = hljs.inherit({ | |
className: 'comment', | |
begin: begin, end: end, | |
contains: [] | |
}, inherits || {}); | |
mode.contains.push(hljs.PHRASAL_WORDS_MODE); | |
mode.contains.push({ | |
className: 'doctag', | |
begin: '(?:TODO|FIXME|NOTE|BUG|XXX):', | |
relevance: 0 | |
}); | |
return mode; | |
}; | |
hljs.C_LINE_COMMENT_MODE = hljs.COMMENT('//', '$'); | |
hljs.C_BLOCK_COMMENT_MODE = hljs.COMMENT('/\\*', '\\*/'); | |
hljs.HASH_COMMENT_MODE = hljs.COMMENT('#', '$'); | |
hljs.NUMBER_MODE = { | |
className: 'number', | |
begin: hljs.NUMBER_RE, | |
relevance: 0 | |
}; | |
hljs.C_NUMBER_MODE = { | |
className: 'number', | |
begin: hljs.C_NUMBER_RE, | |
relevance: 0 | |
}; | |
hljs.BINARY_NUMBER_MODE = { | |
className: 'number', | |
begin: hljs.BINARY_NUMBER_RE, | |
relevance: 0 | |
}; | |
hljs.CSS_NUMBER_MODE = { | |
className: 'number', | |
begin: hljs.NUMBER_RE + '(' + '%|em|ex|ch|rem' + '|vw|vh|vmin|vmax' + '|cm|mm|in|pt|pc|px' + '|deg|grad|rad|turn' + '|s|ms' + '|Hz|kHz' + '|dpi|dpcm|dppx' + ')?', | |
relevance: 0 | |
}; | |
hljs.REGEXP_MODE = { | |
className: 'regexp', | |
begin: /\//, end: /\/[gimuy]*/, | |
illegal: /\n/, | |
contains: [hljs.BACKSLASH_ESCAPE, { | |
begin: /\[/, end: /\]/, | |
relevance: 0, | |
contains: [hljs.BACKSLASH_ESCAPE] | |
}] | |
}; | |
hljs.TITLE_MODE = { | |
className: 'title', | |
begin: hljs.IDENT_RE, | |
relevance: 0 | |
}; | |
hljs.UNDERSCORE_TITLE_MODE = { | |
className: 'title', | |
begin: hljs.UNDERSCORE_IDENT_RE, | |
relevance: 0 | |
}; | |
hljs.METHOD_GUARD = { | |
// excludes method names from keyword processing | |
begin: '\\.\\s*' + hljs.UNDERSCORE_IDENT_RE, | |
relevance: 0 | |
}; | |
return hljs; | |
}); | |
/***/ }), | |
/* 121 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
var hljs = __webpack_require__(120); | |
hljs.registerLanguage('1c', __webpack_require__(122)); | |
hljs.registerLanguage('abnf', __webpack_require__(123)); | |
hljs.registerLanguage('accesslog', __webpack_require__(124)); | |
hljs.registerLanguage('actionscript', __webpack_require__(125)); | |
hljs.registerLanguage('ada', __webpack_require__(126)); | |
hljs.registerLanguage('apache', __webpack_require__(127)); | |
hljs.registerLanguage('applescript', __webpack_require__(128)); | |
hljs.registerLanguage('cpp', __webpack_require__(152)); | |
hljs.registerLanguage('arduino', __webpack_require__(129)); | |
hljs.registerLanguage('armasm', __webpack_require__(130)); | |
hljs.registerLanguage('xml', __webpack_require__(294)); | |
hljs.registerLanguage('asciidoc', __webpack_require__(131)); | |
hljs.registerLanguage('aspectj', __webpack_require__(132)); | |
hljs.registerLanguage('autohotkey', __webpack_require__(133)); | |
hljs.registerLanguage('autoit', __webpack_require__(134)); | |
hljs.registerLanguage('avrasm', __webpack_require__(135)); | |
hljs.registerLanguage('awk', __webpack_require__(136)); | |
hljs.registerLanguage('axapta', __webpack_require__(137)); | |
hljs.registerLanguage('bash', __webpack_require__(138)); | |
hljs.registerLanguage('basic', __webpack_require__(139)); | |
hljs.registerLanguage('bnf', __webpack_require__(140)); | |
hljs.registerLanguage('brainfuck', __webpack_require__(141)); | |
hljs.registerLanguage('cal', __webpack_require__(142)); | |
hljs.registerLanguage('capnproto', __webpack_require__(143)); | |
hljs.registerLanguage('ceylon', __webpack_require__(144)); | |
hljs.registerLanguage('clean', __webpack_require__(145)); | |
hljs.registerLanguage('clojure', __webpack_require__(147)); | |
hljs.registerLanguage('clojure-repl', __webpack_require__(146)); | |
hljs.registerLanguage('cmake', __webpack_require__(148)); | |
hljs.registerLanguage('coffeescript', __webpack_require__(149)); | |
hljs.registerLanguage('coq', __webpack_require__(150)); | |
hljs.registerLanguage('cos', __webpack_require__(151)); | |
hljs.registerLanguage('crmsh', __webpack_require__(153)); | |
hljs.registerLanguage('crystal', __webpack_require__(154)); | |
hljs.registerLanguage('cs', __webpack_require__(155)); | |
hljs.registerLanguage('csp', __webpack_require__(156)); | |
hljs.registerLanguage('css', __webpack_require__(157)); | |
hljs.registerLanguage('d', __webpack_require__(158)); | |
hljs.registerLanguage('markdown', __webpack_require__(218)); | |
hljs.registerLanguage('dart', __webpack_require__(159)); | |
hljs.registerLanguage('delphi', __webpack_require__(160)); | |
hljs.registerLanguage('diff', __webpack_require__(161)); | |
hljs.registerLanguage('django', __webpack_require__(162)); | |
hljs.registerLanguage('dns', __webpack_require__(163)); | |
hljs.registerLanguage('dockerfile', __webpack_require__(164)); | |
hljs.registerLanguage('dos', __webpack_require__(165)); | |
hljs.registerLanguage('dsconfig', __webpack_require__(166)); | |
hljs.registerLanguage('dts', __webpack_require__(167)); | |
hljs.registerLanguage('dust', __webpack_require__(168)); | |
hljs.registerLanguage('ebnf', __webpack_require__(169)); | |
hljs.registerLanguage('elixir', __webpack_require__(170)); | |
hljs.registerLanguage('elm', __webpack_require__(171)); | |
hljs.registerLanguage('ruby', __webpack_require__(258)); | |
hljs.registerLanguage('erb', __webpack_require__(172)); | |
hljs.registerLanguage('erlang-repl', __webpack_require__(173)); | |
hljs.registerLanguage('erlang', __webpack_require__(174)); | |
hljs.registerLanguage('excel', __webpack_require__(175)); | |
hljs.registerLanguage('fix', __webpack_require__(176)); | |
hljs.registerLanguage('flix', __webpack_require__(177)); | |
hljs.registerLanguage('fortran', __webpack_require__(178)); | |
hljs.registerLanguage('fsharp', __webpack_require__(179)); | |
hljs.registerLanguage('gams', __webpack_require__(180)); | |
hljs.registerLanguage('gauss', __webpack_require__(181)); | |
hljs.registerLanguage('gcode', __webpack_require__(182)); | |
hljs.registerLanguage('gherkin', __webpack_require__(183)); | |
hljs.registerLanguage('glsl', __webpack_require__(184)); | |
hljs.registerLanguage('go', __webpack_require__(185)); | |
hljs.registerLanguage('golo', __webpack_require__(186)); | |
hljs.registerLanguage('gradle', __webpack_require__(187)); | |
hljs.registerLanguage('groovy', __webpack_require__(188)); | |
hljs.registerLanguage('haml', __webpack_require__(189)); | |
hljs.registerLanguage('handlebars', __webpack_require__(190)); | |
hljs.registerLanguage('haskell', __webpack_require__(191)); | |
hljs.registerLanguage('haxe', __webpack_require__(192)); | |
hljs.registerLanguage('hsp', __webpack_require__(193)); | |
hljs.registerLanguage('htmlbars', __webpack_require__(194)); | |
hljs.registerLanguage('http', __webpack_require__(195)); | |
hljs.registerLanguage('hy', __webpack_require__(196)); | |
hljs.registerLanguage('inform7', __webpack_require__(197)); | |
hljs.registerLanguage('ini', __webpack_require__(198)); | |
hljs.registerLanguage('irpf90', __webpack_require__(199)); | |
hljs.registerLanguage('java', __webpack_require__(200)); | |
hljs.registerLanguage('javascript', __webpack_require__(201)); | |
hljs.registerLanguage('jboss-cli', __webpack_require__(202)); | |
hljs.registerLanguage('json', __webpack_require__(203)); | |
hljs.registerLanguage('julia', __webpack_require__(205)); | |
hljs.registerLanguage('julia-repl', __webpack_require__(204)); | |
hljs.registerLanguage('kotlin', __webpack_require__(206)); | |
hljs.registerLanguage('lasso', __webpack_require__(207)); | |
hljs.registerLanguage('ldif', __webpack_require__(208)); | |
hljs.registerLanguage('leaf', __webpack_require__(209)); | |
hljs.registerLanguage('less', __webpack_require__(210)); | |
hljs.registerLanguage('lisp', __webpack_require__(211)); | |
hljs.registerLanguage('livecodeserver', __webpack_require__(212)); | |
hljs.registerLanguage('livescript', __webpack_require__(213)); | |
hljs.registerLanguage('llvm', __webpack_require__(214)); | |
hljs.registerLanguage('lsl', __webpack_require__(215)); | |
hljs.registerLanguage('l |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment